mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-07 16:37:06 +08:00
add mark for message will be used as context in llm test dialog
This commit is contained in:
@@ -547,12 +547,17 @@ export default function initIpc() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ipcMain.on('test-llm-config-effect', () => {
|
ipcMain.on('test-llm-config-effect', (_, { autoReminderConfig } = {}) => {
|
||||||
createReadNoReplyReminderLlmMockWindow({
|
createReadNoReplyReminderLlmMockWindow(
|
||||||
|
{
|
||||||
parent: mainWindow!,
|
parent: mainWindow!,
|
||||||
modal: true,
|
modal: true,
|
||||||
show: true
|
show: true
|
||||||
})
|
},
|
||||||
|
{
|
||||||
|
autoReminderConfig
|
||||||
|
}
|
||||||
|
)
|
||||||
async function requestLlm(_, requestPayload) {
|
async function requestLlm(_, requestPayload) {
|
||||||
return await requestNewMessageContent(requestPayload.messageList, {
|
return await requestNewMessageContent(requestPayload.messageList, {
|
||||||
requestScene: RequestSceneEnum.testing,
|
requestScene: RequestSceneEnum.testing,
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { BrowserWindow } from 'electron'
|
import { BrowserWindow } from 'electron'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { URL } from 'node:url'
|
||||||
|
|
||||||
export let readNoReplyReminderLlmMockWindow: BrowserWindow | null = null
|
export let readNoReplyReminderLlmMockWindow: BrowserWindow | null = null
|
||||||
export function createReadNoReplyReminderLlmMockWindow(
|
export function createReadNoReplyReminderLlmMockWindow(
|
||||||
opt?: Electron.BrowserWindowConstructorOptions
|
opt?: Electron.BrowserWindowConstructorOptions,
|
||||||
|
{ autoReminderConfig } = {}
|
||||||
): BrowserWindow {
|
): BrowserWindow {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
if (readNoReplyReminderLlmMockWindow) {
|
if (readNoReplyReminderLlmMockWindow) {
|
||||||
@@ -29,16 +31,19 @@ export function createReadNoReplyReminderLlmMockWindow(
|
|||||||
|
|
||||||
// HMR for renderer base on electron-vite cli.
|
// HMR for renderer base on electron-vite cli.
|
||||||
// Load the remote URL for development or the local html file for production.
|
// Load the remote URL for development or the local html file for production.
|
||||||
|
let urlObj: URL
|
||||||
if (process.env.NODE_ENV === 'development' && process.env['ELECTRON_RENDERER_URL']) {
|
if (process.env.NODE_ENV === 'development' && process.env['ELECTRON_RENDERER_URL']) {
|
||||||
readNoReplyReminderLlmMockWindow.loadURL(
|
urlObj = new URL(process.env['ELECTRON_RENDERER_URL'] + '#/readNoReplyReminderLlmMock')
|
||||||
process.env['ELECTRON_RENDERER_URL'] + '#/readNoReplyReminderLlmMock'
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
readNoReplyReminderLlmMockWindow.loadURL(
|
urlObj = new URL(
|
||||||
'file://' + path.join(__dirname, '../renderer/index.html') + '#/readNoReplyReminderLlmMock'
|
'file://' + path.join(__dirname, '../renderer/index.html') + '#/readNoReplyReminderLlmMock'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const [k, v] of Object.entries(autoReminderConfig || {})) {
|
||||||
|
urlObj.searchParams.append(k, v)
|
||||||
|
}
|
||||||
|
readNoReplyReminderLlmMockWindow.loadURL(String(urlObj))
|
||||||
readNoReplyReminderLlmMockWindow!.once('closed', () => {
|
readNoReplyReminderLlmMockWindow!.once('closed', () => {
|
||||||
readNoReplyReminderLlmMockWindow = null
|
readNoReplyReminderLlmMockWindow = null
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -116,6 +116,11 @@
|
|||||||
次聊天内容作为上下文生成新消息
|
次聊天内容作为上下文生成新消息
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button size="small" type="primary" @click="handleTestEffectClicked"
|
||||||
|
>使用当前配置模拟已读不回复聊过程</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item prop="recentMessageQuantityForLlm">
|
<el-form-item prop="recentMessageQuantityForLlm">
|
||||||
<div class="flex flex-items-center">
|
<div class="flex flex-items-center">
|
||||||
<span class="whitespace-nowrap">当所有模型均不可使用时 </span>
|
<span class="whitespace-nowrap">当所有模型均不可使用时 </span>
|
||||||
@@ -133,11 +138,6 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
|
||||||
<el-button size="small" type="primary" @click="handleTestEffectClicked"
|
|
||||||
>使用当前配置模拟已读不回复聊过程</el-button
|
|
||||||
>
|
|
||||||
</el-form-item>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<el-form-item label="跟进间隔(分钟)" prop="throttleIntervalMinutes">
|
<el-form-item label="跟进间隔(分钟)" prop="throttleIntervalMinutes">
|
||||||
@@ -473,7 +473,9 @@ async function handleTestEffectClicked() {
|
|||||||
if (!(await checkIsCanRun())) {
|
if (!(await checkIsCanRun())) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
electron.ipcRenderer.send('test-llm-config-effect')
|
electron.ipcRenderer.send('test-llm-config-effect', {
|
||||||
|
autoReminderConfig: JSON.parse(JSON.stringify(formContent.value.autoReminder))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,12 @@
|
|||||||
<div class="pb20px"></div>
|
<div class="pb20px"></div>
|
||||||
<div v-for="(item, index) in messageList" :key="index" flex flex-col flex-items-end>
|
<div v-for="(item, index) in messageList" :key="index" flex flex-col flex-items-end>
|
||||||
<div class="message-item-wrap flex flex-col">
|
<div class="message-item-wrap flex flex-col">
|
||||||
<div class="message-item">
|
<div
|
||||||
|
class="message-item"
|
||||||
|
:class="{
|
||||||
|
'will-enter-context': getIsEnterContent(index)
|
||||||
|
}"
|
||||||
|
>
|
||||||
{{ item.text }}
|
{{ item.text }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -148,6 +153,12 @@ type MessageItem = {
|
|||||||
}
|
}
|
||||||
const messageList = ref<MessageItem[]>([])
|
const messageList = ref<MessageItem[]>([])
|
||||||
|
|
||||||
|
const recentMessageQuantityForLlm =
|
||||||
|
Number(new URL(location.href).searchParams.get('recentMessageQuantityForLlm')) || 8
|
||||||
|
function getIsEnterContent(index) {
|
||||||
|
return messageList.value.length - index - 1 < recentMessageQuantityForLlm
|
||||||
|
}
|
||||||
|
|
||||||
const llmConfigList = ref([])
|
const llmConfigList = ref([])
|
||||||
const llmConfigListForRender = computed(() => {
|
const llmConfigListForRender = computed(() => {
|
||||||
return [
|
return [
|
||||||
@@ -172,7 +183,7 @@ async function sendLlmGeneratedContent() {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
try {
|
try {
|
||||||
const response = await electron.ipcRenderer.invoke('request-llm-for-test', {
|
const response = await electron.ipcRenderer.invoke('request-llm-for-test', {
|
||||||
messageList: JSON.parse(JSON.stringify(messageList.value ?? [])),
|
messageList: JSON.parse(JSON.stringify((messageList.value ?? []).slice(-8))),
|
||||||
llmConfigIdForPick: selectedLlmConfig.value ? [selectedLlmConfig.value] : null
|
llmConfigIdForPick: selectedLlmConfig.value ? [selectedLlmConfig.value] : null
|
||||||
})
|
})
|
||||||
console.log(response)
|
console.log(response)
|
||||||
@@ -224,7 +235,22 @@ function formatApiSecret(text) {
|
|||||||
background-color: #d1f0ef;
|
background-color: #d1f0ef;
|
||||||
color: #333;
|
color: #333;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 8px 8px 0 8px;
|
border-radius: 8px 8px 0 0;
|
||||||
|
&.will-enter-context {
|
||||||
|
position: relative;
|
||||||
|
&::before {
|
||||||
|
content: '聊天上下文';
|
||||||
|
display: flex;
|
||||||
|
font-size: 10px;
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
left: 0;
|
||||||
|
background-color: #10c7c3;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 2px 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user