mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-07-10 23:12:53 +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', () => {
|
||||
createReadNoReplyReminderLlmMockWindow({
|
||||
parent: mainWindow!,
|
||||
modal: true,
|
||||
show: true
|
||||
})
|
||||
ipcMain.on('test-llm-config-effect', (_, { autoReminderConfig } = {}) => {
|
||||
createReadNoReplyReminderLlmMockWindow(
|
||||
{
|
||||
parent: mainWindow!,
|
||||
modal: true,
|
||||
show: true
|
||||
},
|
||||
{
|
||||
autoReminderConfig
|
||||
}
|
||||
)
|
||||
async function requestLlm(_, requestPayload) {
|
||||
return await requestNewMessageContent(requestPayload.messageList, {
|
||||
requestScene: RequestSceneEnum.testing,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { BrowserWindow } from 'electron'
|
||||
import path from 'path'
|
||||
import { URL } from 'node:url'
|
||||
|
||||
export let readNoReplyReminderLlmMockWindow: BrowserWindow | null = null
|
||||
export function createReadNoReplyReminderLlmMockWindow(
|
||||
opt?: Electron.BrowserWindowConstructorOptions
|
||||
opt?: Electron.BrowserWindowConstructorOptions,
|
||||
{ autoReminderConfig } = {}
|
||||
): BrowserWindow {
|
||||
// Create the browser window.
|
||||
if (readNoReplyReminderLlmMockWindow) {
|
||||
@@ -29,16 +31,19 @@ export function createReadNoReplyReminderLlmMockWindow(
|
||||
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
// 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']) {
|
||||
readNoReplyReminderLlmMockWindow.loadURL(
|
||||
process.env['ELECTRON_RENDERER_URL'] + '#/readNoReplyReminderLlmMock'
|
||||
)
|
||||
urlObj = new URL(process.env['ELECTRON_RENDERER_URL'] + '#/readNoReplyReminderLlmMock')
|
||||
} else {
|
||||
readNoReplyReminderLlmMockWindow.loadURL(
|
||||
urlObj = new URL(
|
||||
'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 = null
|
||||
})
|
||||
|
||||
@@ -116,6 +116,11 @@
|
||||
次聊天内容作为上下文生成新消息
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" @click="handleTestEffectClicked"
|
||||
>使用当前配置模拟已读不回复聊过程</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item prop="recentMessageQuantityForLlm">
|
||||
<div class="flex flex-items-center">
|
||||
<span class="whitespace-nowrap">当所有模型均不可使用时 </span>
|
||||
@@ -133,11 +138,6 @@
|
||||
</el-select>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" @click="handleTestEffectClicked"
|
||||
>使用当前配置模拟已读不回复聊过程</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</div>
|
||||
<el-form-item label="跟进间隔(分钟)" prop="throttleIntervalMinutes">
|
||||
@@ -473,7 +473,9 @@ async function handleTestEffectClicked() {
|
||||
if (!(await checkIsCanRun())) {
|
||||
return
|
||||
}
|
||||
electron.ipcRenderer.send('test-llm-config-effect')
|
||||
electron.ipcRenderer.send('test-llm-config-effect', {
|
||||
autoReminderConfig: JSON.parse(JSON.stringify(formContent.value.autoReminder))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -22,7 +22,12 @@
|
||||
<div class="pb20px"></div>
|
||||
<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">
|
||||
<div
|
||||
class="message-item"
|
||||
:class="{
|
||||
'will-enter-context': getIsEnterContent(index)
|
||||
}"
|
||||
>
|
||||
{{ item.text }}
|
||||
</div>
|
||||
<div
|
||||
@@ -148,6 +153,12 @@ type 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 llmConfigListForRender = computed(() => {
|
||||
return [
|
||||
@@ -172,7 +183,7 @@ async function sendLlmGeneratedContent() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
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
|
||||
})
|
||||
console.log(response)
|
||||
@@ -224,7 +235,22 @@ function formatApiSecret(text) {
|
||||
background-color: #d1f0ef;
|
||||
color: #333;
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user