mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-06 16:07:17 +08:00
Merge branch 'feature/ui' into feature/aigc
This commit is contained in:
@@ -146,7 +146,7 @@ async function markJobAsNotSuitInRecommendPage (reasonCode) {
|
|||||||
}
|
}
|
||||||
case MarkAsNotSuitReason.JOB_NOT_SUIT:
|
case MarkAsNotSuitReason.JOB_NOT_SUIT:
|
||||||
default: {
|
default: {
|
||||||
const jobNotSuitOptionProxy = await chooseReasonDialogProxy.$(`.zp-type-item[title="面试过/入职过"]`)
|
const jobNotSuitOptionProxy = (await chooseReasonDialogProxy.$(`.zp-type-item[title$="职位"]`)) ?? (await chooseReasonDialogProxy.$(`.zp-type-item[title="面试过/入职过"]`))
|
||||||
if (jobNotSuitOptionProxy) {
|
if (jobNotSuitOptionProxy) {
|
||||||
await jobNotSuitOptionProxy.click()
|
await jobNotSuitOptionProxy.click()
|
||||||
isOptionChosen = true
|
isOptionChosen = true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "geekgeekrun-ui",
|
"name": "geekgeekrun-ui",
|
||||||
"version": "0.3.0",
|
"version": "0.3.2",
|
||||||
"description": "Boss 炸弹 - 自动开聊Boss,助力每位打工人求职!",
|
"description": "Boss 炸弹 - 自动开聊Boss,助力每位打工人求职!",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "geekgeekrun",
|
"author": "geekgeekrun",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": "0.3.0",
|
"version": "0.3.2",
|
||||||
"buildVersion": 6,
|
"buildVersion": 8,
|
||||||
"buildTime": 1735446486022,
|
"buildTime": 1743435647129,
|
||||||
"buildHash": "6f8dab0c0550b594de1d23f92f21a5194b0c8b62",
|
"buildHash": "482ea006be25bc7014793c09cc748fae6606e27e",
|
||||||
"name": "geekgeekrun-ui"
|
"name": "geekgeekrun-ui"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export function messageForSaveFilter(it) {
|
||||||
|
return (
|
||||||
|
it.status !== 3 && // filter system notification out
|
||||||
|
it.templateId === 1 && // filter system notification out
|
||||||
|
((['text', 'sticker', 'image', 'sound', 'comDesc'].includes(it.messageType) &&
|
||||||
|
!it.extend?.greetingQuestionAnswer) || // include those message, filter out auto ask
|
||||||
|
(it.messageType === 'dialog' && [0, 1, 2, 8, 11, 12, 14, 17, 33].includes(it?.dialog?.type))) // include message like resume, phone, map, etc., filter out auto ask
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ import gtag from '../../utils/gtag'
|
|||||||
import attachListenerForKillSelfOnParentExited from '../../utils/attachListenerForKillSelfOnParentExited'
|
import attachListenerForKillSelfOnParentExited from '../../utils/attachListenerForKillSelfOnParentExited'
|
||||||
import { type ChatMessageRecord } from '@geekgeekrun/sqlite-plugin/src/entity/ChatMessageRecord'
|
import { type ChatMessageRecord } from '@geekgeekrun/sqlite-plugin/src/entity/ChatMessageRecord'
|
||||||
import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
|
import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
|
||||||
|
import { messageForSaveFilter } from '../../../common/utils/chat-list'
|
||||||
|
|
||||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||||
const isRunFromUi = Boolean(process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE)
|
const isRunFromUi = Boolean(process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE)
|
||||||
@@ -181,9 +182,14 @@ const attachRequestsListener = async (target: Target) => {
|
|||||||
const url = new URL(request)
|
const url = new URL(request)
|
||||||
const encryptBossIdInAddFriendUrl = url.searchParams.get('bossId')
|
const encryptBossIdInAddFriendUrl = url.searchParams.get('bossId')
|
||||||
|
|
||||||
const bossInfo: any = await page.evaluate(
|
const bossInfo =
|
||||||
'document.querySelector(".chat-conversation").__vue__.bossInfo$'
|
(await page.evaluate(
|
||||||
)
|
'document.querySelector(".chat-conversation .chat-record")?.__vue__?.boss'
|
||||||
|
)) ?? null
|
||||||
|
if (!bossInfo) {
|
||||||
|
console.warn('cannot find boss info on page.')
|
||||||
|
return
|
||||||
|
}
|
||||||
const ds = await dbInitPromise
|
const ds = await dbInitPromise
|
||||||
// save boss info
|
// save boss info
|
||||||
const bossInfoRepository = ds.getRepository(BossInfo)
|
const bossInfoRepository = ds.getRepository(BossInfo)
|
||||||
@@ -206,15 +212,15 @@ const attachRequestsListener = async (target: Target) => {
|
|||||||
const rawChatRecordList =
|
const rawChatRecordList =
|
||||||
(
|
(
|
||||||
await page.evaluate(
|
await page.evaluate(
|
||||||
'document.querySelector(".message-content .chat-record").__vue__.records$'
|
'document.querySelector(".message-content .chat-record").__vue__.list$'
|
||||||
)
|
)
|
||||||
)?.filter((msg) => ['received', 'sent'].includes(msg.style)) ?? []
|
)?.filter(messageForSaveFilter) ?? []
|
||||||
|
|
||||||
const chatRecordList = rawChatRecordList.map(it => {
|
const chatRecordList = rawChatRecordList.map(it => {
|
||||||
const mappedItem = {} as InstanceType<typeof ChatMessageRecord>
|
const mappedItem = {} as InstanceType<typeof ChatMessageRecord>
|
||||||
mappedItem.mid = it.mid
|
mappedItem.mid = it.mid
|
||||||
mappedItem.encryptFromUserId = it.style === 'sent' ? currentUserInfo.encryptUserId : it.style === 'received' ? bossInfo.encryptBossId : ''
|
mappedItem.encryptFromUserId = it.isSelf ? currentUserInfo.encryptUserId : bossInfo.encryptBossId
|
||||||
mappedItem.encryptToUserId = it.style === 'sent' ? bossInfo.encryptBossId: it.style === 'received' ? currentUserInfo.encryptUserId : ''
|
mappedItem.encryptToUserId = it.isSelf ? bossInfo.encryptBossId : currentUserInfo.encryptUserId
|
||||||
mappedItem.style = it.style
|
mappedItem.style = it.style
|
||||||
mappedItem.type = it.type
|
mappedItem.type = it.type
|
||||||
mappedItem.time = it.time ? new Date(it.time) : null
|
mappedItem.time = it.time ? new Date(it.time) : null
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { writeStorageFile } from '@geekgeekrun/geek-auto-start-chat-with-boss/ru
|
|||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import { pipeWriteRegardlessError } from '../utils/pipe'
|
import { pipeWriteRegardlessError } from '../utils/pipe'
|
||||||
import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
|
import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
|
||||||
|
import { messageForSaveFilter } from '../../../common/utils/chat-list'
|
||||||
|
|
||||||
const throttleIntervalMinutes =
|
const throttleIntervalMinutes =
|
||||||
readConfigFile('boss.json').autoReminder?.throttleIntervalMinutes ?? 10
|
readConfigFile('boss.json').autoReminder?.throttleIntervalMinutes ?? 10
|
||||||
@@ -31,7 +32,7 @@ async function saveCurrentChatRecord(page) {
|
|||||||
'document.querySelector(".main-wrap").__vue__.$store.state.userInfo'
|
'document.querySelector(".main-wrap").__vue__.$store.state.userInfo'
|
||||||
)
|
)
|
||||||
const bossInfo = await page.evaluate(
|
const bossInfo = await page.evaluate(
|
||||||
'document.querySelector(".chat-conversation").__vue__.bossInfo$'
|
'document.querySelector(".chat-conversation .chat-record")?.__vue__?.boss'
|
||||||
)
|
)
|
||||||
|
|
||||||
const ds = await dbInitPromise
|
const ds = await dbInitPromise
|
||||||
@@ -252,27 +253,25 @@ const mainLoop = async () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
await sleepWithRandomDelay(1500)
|
await sleepWithRandomDelay(1500)
|
||||||
const bossInfo = await pageMapByName.boss?.evaluate(() => {
|
const bossInfo = await pageMapByName.boss?.evaluate(
|
||||||
return document.querySelector('.chat-conversation')?.__vue__['bossInfo$']
|
'document.querySelector(".chat-conversation .chat-record")?.__vue__?.boss'
|
||||||
})
|
)
|
||||||
|
|
||||||
const historyMessageList =
|
const historyMessageList =
|
||||||
(
|
(
|
||||||
await pageMapByName.boss?.evaluate(() => {
|
await pageMapByName.boss?.evaluate(() => {
|
||||||
return (
|
return document.querySelector('.message-content .chat-record')?.__vue__?.list$ ?? []
|
||||||
document.querySelector('.main-wrap .chat-conversation .chat-record')?.__vue__
|
|
||||||
?.records$ ?? []
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
)?.filter((msg) => ['received', 'sent'].includes(msg.style)) ?? []
|
)?.filter(messageForSaveFilter) ?? []
|
||||||
|
|
||||||
const lastGeekMessageSendTime =
|
const lastGeekMessageSendTime = historyMessageList.findLast((it) => it.isSelf)?.time ?? 0
|
||||||
historyMessageList.findLast((it) => it.style === 'sent')?.time ?? 0
|
|
||||||
if (
|
if (
|
||||||
historyMessageList[historyMessageList.length - 1].style === 'sent' &&
|
historyMessageList[historyMessageList.length - 1].isSelf &&
|
||||||
historyMessageList[historyMessageList.length - 1].status === MsgStatus.HAS_READ &&
|
historyMessageList[historyMessageList.length - 1].status === MsgStatus.HAS_READ &&
|
||||||
(!bossInfo.bothTalked ||
|
((bossInfo && !bossInfo.bothTalked) ||
|
||||||
!historyMessageList.filter((it) => it.style === 'received').length) &&
|
!historyMessageList.filter(
|
||||||
|
(it) => !it.isSelf // not sent by me
|
||||||
|
).length) &&
|
||||||
// don't disturb too much
|
// don't disturb too much
|
||||||
Date.now() - lastGeekMessageSendTime >=
|
Date.now() - lastGeekMessageSendTime >=
|
||||||
(throttleIntervalMinutes + 4 * Math.random()) * 60 * 1000
|
(throttleIntervalMinutes + 4 * Math.random()) * 60 * 1000
|
||||||
|
|||||||
Reference in New Issue
Block a user