diff --git a/packages/ui/src/common/constant.ts b/packages/ui/src/common/constant.ts new file mode 100644 index 0000000..1570f00 --- /dev/null +++ b/packages/ui/src/common/constant.ts @@ -0,0 +1 @@ +export const SINGLE_ITEM_DEFAULT_SERVE_WEIGHT = 1 diff --git a/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/boss-operation.ts b/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/boss-operation.ts index 3febf6b..d7411da 100644 --- a/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/boss-operation.ts +++ b/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/boss-operation.ts @@ -7,6 +7,7 @@ import { writeStorageFile } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs' import { formatResumeJsonToMarkdown } from '../../../common/utils/format-resume-json-to-markdown' +import { SINGLE_ITEM_DEFAULT_SERVE_WEIGHT } from '../../../common/constant' export const sendLookForwardReplyEmotion = async (page: Page) => { const emotionEntryButtonProxy = await page.$('.chat-conversation .message-controls .btn-emotion') @@ -25,6 +26,8 @@ export const sendLookForwardReplyEmotion = async (page: Page) => { const pickLlmConfigFromList = (llmConfigList) => { if (llmConfigList.length === 1) { + llmConfigList[0].enabled = true + llmConfigList[0].serveWeight = SINGLE_ITEM_DEFAULT_SERVE_WEIGHT return llmConfigList[0] } llmConfigList = llmConfigList.filter((it) => it.enabled) @@ -34,6 +37,9 @@ const pickLlmConfigFromList = (llmConfigList) => { pool.push(i) } } + if (!pool.length) { + throw new Error(`cannot find a usable model`) + } const index = Math.floor(pool.length * Math.random()) return llmConfigList[ pool[index] diff --git a/packages/ui/src/renderer/src/page/LlmConfig/index.vue b/packages/ui/src/renderer/src/page/LlmConfig/index.vue index 6228de7..181d075 100644 --- a/packages/ui/src/renderer/src/page/LlmConfig/index.vue +++ b/packages/ui/src/renderer/src/page/LlmConfig/index.vue @@ -16,7 +16,7 @@ " > 申请 API Secret 获取 API Secret