diff --git a/packages/geek-auto-start-chat-with-boss/default-config-file/boss.json b/packages/geek-auto-start-chat-with-boss/default-config-file/boss.json index c724ced..678ca57 100644 --- a/packages/geek-auto-start-chat-with-boss/default-config-file/boss.json +++ b/packages/geek-auto-start-chat-with-boss/default-config-file/boss.json @@ -16,6 +16,7 @@ "geminiApiKey": "", "rechatContentSource": 1, "recentMessageQuantityForLlm": 8, - "rechatLlmFallback": 1 + "rechatLlmFallback": 1, + "onlyRemindBossWithExpectJobType": true } } \ No newline at end of file diff --git a/packages/ui/package.json b/packages/ui/package.json index 6126c3b..09b6be6 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -39,6 +39,7 @@ "diff": "^7.0.0", "electron-updater": "^6.1.7", "minimist": "^1.2.8", + "mitt": "^3.0.1", "node-machine-id": "^1.1.12", "pinia": "^3.0.2", "puppeteer": "20.1.0", diff --git a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts index d5c2681..bb7e1cb 100644 --- a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts +++ b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts @@ -510,16 +510,15 @@ export default function initIpc() { ipcMain.handle('save-resume-content', saveResumeHandler) resumeEditorWindow?.once('closed', () => { ipcMain.removeHandler('save-resume-content') - ipcMain.removeHandler('fetch-resume-content') defer.reject(new Error('cancel')) }) - ipcMain.handle('fetch-resume-content', async () => { - const res = (await readConfigFile('resumes.json'))?.[0] - return res?.content ?? null - }) return defer.promise }) + ipcMain.handle('fetch-resume-content', async () => { + const res = (await readConfigFile('resumes.json'))?.[0] + return res?.content ?? null + }) ipcMain.on('no-reply-reminder-prompt-edit', async () => { const template = await readStorageFile(autoReminderPromptTemplateFileName, { isJson: false }) if (!template) { diff --git a/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/index.ts b/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/index.ts index 0e6f617..174f1bc 100644 --- a/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/index.ts +++ b/packages/ui/src/main/flow/READ_NO_REPLY_AUTO_REMINDER/index.ts @@ -32,6 +32,10 @@ const rechatLlmFallback = readConfigFile('boss.json').autoReminder?.rechatLlmFallback ?? RECHAT_LLM_FALLBACK.SEND_LOOK_FORWARD_EMOTION +const expectJobTypeRegExpStr = readConfigFile('boss.json').expectJobTypeRegExpStr +const onlyRemindBossWithExpectJobType = + readConfigFile('boss.json').autoReminder?.onlyRemindBossWithExpectJobType ?? !!expectJobTypeRegExpStr + const dbInitPromise = initDb(getPublicDbFilePath()) export const pageMapByName: { @@ -267,6 +271,24 @@ const mainLoop = async () => { }) } await sleepWithRandomDelay(1500) + // check if expect job type match + let isExpectJobTypeMatch = true + if (onlyRemindBossWithExpectJobType) { + const selectedFriendInfo = await pageMapByName.boss?.evaluate( + `document.querySelector('.chat-conversation')?.__vue__?.selectedFriend$` + ) + if (!selectedFriendInfo) { + isExpectJobTypeMatch = false + } else { + const jobType = selectedFriendInfo?.positionName + if (!jobType) { + isExpectJobTypeMatch = false + } else { + const regExp = new RegExp(expectJobTypeRegExpStr) + isExpectJobTypeMatch = regExp.test(jobType) + } + } + } const conversationInfo = await pageMapByName.boss?.evaluate( `document.querySelector('.chat-conversation .chat-im.chat-editor')?.__vue__?.conversation$` ) @@ -280,6 +302,7 @@ const mainLoop = async () => { const lastGeekMessageSendTime = historyMessageList.findLast((it) => it.isSelf)?.time ?? 0 if ( + isExpectJobTypeMatch && historyMessageList[historyMessageList.length - 1].isSelf && historyMessageList[historyMessageList.length - 1].status === MsgStatus.HAS_READ && ((conversationInfo && diff --git a/packages/ui/src/renderer/src/page/MainLayout/GeekAutoStartChatWithBoss.vue b/packages/ui/src/renderer/src/page/MainLayout/GeekAutoStartChatWithBoss.vue index 4b9a96c..819ea12 100644 --- a/packages/ui/src/renderer/src/page/MainLayout/GeekAutoStartChatWithBoss.vue +++ b/packages/ui/src/renderer/src/page/MainLayout/GeekAutoStartChatWithBoss.vue @@ -133,7 +133,7 @@