Compare commits
204 Commits
ui-v0.3.1
...
feature/st
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5225006cc | ||
|
|
fdf2c61620 | ||
|
|
1f140121fb | ||
|
|
57cf631b86 | ||
|
|
36aef1c16d | ||
|
|
d21972020e | ||
|
|
51ca5dd71d | ||
|
|
e7d5ef382e | ||
|
|
59a36dc7bd | ||
|
|
73b57e21e4 | ||
|
|
6f0d98653c | ||
|
|
3bf6d4c358 | ||
|
|
2c7ecafee2 | ||
|
|
f88a5a2889 | ||
|
|
ac19ae3832 | ||
|
|
a25b047f99 | ||
|
|
42fc66a0f4 | ||
|
|
203fbba9a0 | ||
|
|
b821bc500c | ||
|
|
0032a356e5 | ||
|
|
b9c4976291 | ||
|
|
558891ad9f | ||
|
|
d2da9f5a7d | ||
|
|
71068be21f | ||
|
|
2b0cf2a2fa | ||
|
|
ceaf68e4eb | ||
|
|
10cc248784 | ||
|
|
1d155e498a | ||
|
|
d3e086f321 | ||
|
|
5f97b3ccec | ||
|
|
7dd0c675d5 | ||
|
|
c1978417da | ||
|
|
e0670a9f30 | ||
|
|
b05031be8a | ||
|
|
7b10e97fa8 | ||
|
|
e867acb39d | ||
|
|
b31224a81c | ||
|
|
ddb0cb97d7 | ||
|
|
f338dcffc8 | ||
|
|
84a79c9bae | ||
|
|
44b0e44e2e | ||
|
|
08028f37dd | ||
|
|
a0b09ebae4 | ||
|
|
f078500c14 | ||
|
|
b89d6e264d | ||
|
|
78ddc949f4 | ||
|
|
a208ffe7d4 | ||
|
|
bc70031e2b | ||
|
|
cc821f46f5 | ||
|
|
f668b3e5f5 | ||
|
|
d1441b5761 | ||
|
|
e88b4da53a | ||
|
|
d218778690 | ||
|
|
f903ef9175 | ||
|
|
d114685116 | ||
|
|
bb30329d6c | ||
|
|
3683ead1d4 | ||
|
|
cac3e480e5 | ||
|
|
52163342c3 | ||
|
|
8efce15fd5 | ||
|
|
d5dcdb4bd1 | ||
|
|
98b99c5d14 | ||
|
|
d4fa72a28e | ||
|
|
b024c6b517 | ||
|
|
9b64f05cb6 | ||
|
|
eefb25a3da | ||
|
|
2dad39c8e4 | ||
|
|
699bdd2641 | ||
|
|
48f1232f7d | ||
|
|
2409699ccf | ||
|
|
64c007066e | ||
|
|
bd503eb268 | ||
|
|
8dc8ca825d | ||
|
|
8e8fb6d331 | ||
|
|
2f3a557fb5 | ||
|
|
780cd73e46 | ||
|
|
6c05128e89 | ||
|
|
e235ae099b | ||
|
|
d479687b8b | ||
|
|
4627b4218e | ||
|
|
b64f411e4a | ||
|
|
12ff9dc4ba | ||
|
|
959c32eb63 | ||
|
|
ce38ecea55 | ||
|
|
340f8946b9 | ||
|
|
59002f73e9 | ||
|
|
5626cf6721 | ||
|
|
fe1c85b38d | ||
|
|
24018f63b5 | ||
|
|
5effcc27ab | ||
|
|
aee6340c6a | ||
|
|
03df5f8d5a | ||
|
|
7d3a0e80d4 | ||
|
|
10f1f150bf | ||
|
|
64249593b8 | ||
|
|
217b2bbf2a | ||
|
|
02667fe2f8 | ||
|
|
5539842392 | ||
|
|
b57e646147 | ||
|
|
6982f6028d | ||
|
|
f4cd4b884b | ||
|
|
61c28ae164 | ||
|
|
ece7fc61e3 | ||
|
|
97793adb0f | ||
|
|
b5c3116c01 | ||
|
|
10cd1cf11e | ||
|
|
7d2e60dfd0 | ||
|
|
6986fbdc3c | ||
|
|
5174da2c6c | ||
|
|
043d782a05 | ||
|
|
67e4b94f9e | ||
|
|
45d14e70fb | ||
|
|
44202b4685 | ||
|
|
00c699d1a6 | ||
|
|
a49124510b | ||
|
|
25e5253022 | ||
|
|
cd4a2e9694 | ||
|
|
cc6e7e9444 | ||
|
|
b650c7d86b | ||
|
|
e616b6668e | ||
|
|
1803b852db | ||
|
|
bde36317a1 | ||
|
|
28d2d34763 | ||
|
|
05702e773f | ||
|
|
6605c75ad7 | ||
|
|
1527a823c8 | ||
|
|
4dbc39008e | ||
|
|
1d604fc364 | ||
|
|
f6e1b799ce | ||
|
|
6f9533c2b7 | ||
|
|
7868f100ce | ||
|
|
a22ac20b3a | ||
|
|
e2c94ded13 | ||
|
|
84c30fc9a7 | ||
|
|
b88879a3bc | ||
|
|
33f6837147 | ||
|
|
9128865bbc | ||
|
|
8347fb0f77 | ||
|
|
7f21ea8c95 | ||
|
|
353fc60891 | ||
|
|
f770e7fe06 | ||
|
|
ccbc717a45 | ||
|
|
5dc7250634 | ||
|
|
5a1daf034f | ||
|
|
128ccfa93d | ||
|
|
582eae0900 | ||
|
|
d23b0475dc | ||
|
|
bbd670b674 | ||
|
|
3d148e8e01 | ||
|
|
954553d8d8 | ||
|
|
011c22e0fe | ||
|
|
4a82e9e345 | ||
|
|
f182ee2c5b | ||
|
|
3fc7662f7d | ||
|
|
e8d3313a7b | ||
|
|
e823590e6d | ||
|
|
04c02e148f | ||
|
|
dc293f4f91 | ||
|
|
f7fb551582 | ||
|
|
703b229bf4 | ||
|
|
64e9d3068c | ||
|
|
1d99cde602 | ||
|
|
7ffe89c41f | ||
|
|
bf0518036c | ||
|
|
f4634c5305 | ||
|
|
e838f48b89 | ||
|
|
94e237fee8 | ||
|
|
76339ebc5c | ||
|
|
6dc3948d12 | ||
|
|
764d278c23 | ||
|
|
73d03cb76a | ||
|
|
d42c651425 | ||
|
|
7b5ff9951b | ||
|
|
0e85942de5 | ||
|
|
462276cf6e | ||
|
|
1605103ee9 | ||
|
|
21c1f4284f | ||
|
|
4208996a83 | ||
|
|
3c951407ce | ||
|
|
438bc973a2 | ||
|
|
b7f149032a | ||
|
|
a8a1856527 | ||
|
|
1c616e5b90 | ||
|
|
e162bc4948 | ||
|
|
01ab679376 | ||
|
|
f91daf7cab | ||
|
|
f72a5c014b | ||
|
|
c5ac63b030 | ||
|
|
924febd5e0 | ||
|
|
17c5a40f8d | ||
|
|
09c5ce97a7 | ||
|
|
901c3a51a0 | ||
|
|
0714b187bd | ||
|
|
c40fbde5b2 | ||
|
|
27bc63f63f | ||
|
|
85e27dc6ef | ||
|
|
7458067708 | ||
|
|
5b78dc5d63 | ||
|
|
7ccf4303d3 | ||
|
|
7ee8baa311 | ||
|
|
acd8227740 | ||
|
|
482ea006be | ||
|
|
653173e1a3 | ||
|
|
639ea6ac76 |
1
.github/workflows/release-ui.yml
vendored
@@ -152,6 +152,7 @@ jobs:
|
||||
- name: Create release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
prerelease: true
|
||||
allowUpdates: true
|
||||
artifacts: geekgeekrun-ui@${{ github.sha }}/*
|
||||
tag: ${{ github.ref }}
|
||||
|
||||
191
README.md
@@ -4,12 +4,94 @@
|
||||
|
||||
与每一位牛人站在一起
|
||||
|
||||
- 使命:帮你找到让你满意的工作
|
||||
- 愿景:天下牛人都有满意的工作
|
||||
- 使命:用科技让复杂的求职过程变简单
|
||||
- 愿景:天下没有难找的工作,天下牛人都有满意的工作
|
||||
|
||||
# GUI 版本
|
||||
各行各业,无论你是小白还是大佬,都能通过几步简单的配置,快速开始求职!
|
||||
|
||||
## 程序有哪些功能?运行逻辑是什么?怎样使用?
|
||||
|
||||
### Boss炸弹
|
||||
扩列神器!按照你所设置的求职偏好,自动开聊推荐职位列表中的匹配的Boss。可以帮你开聊推荐列表中的职位、根据设置的求职期望推荐的职位以及根据你设置的关键词通过搜索找到的职位;可以通过拖拽的方式自定义搜索顺序哦~
|
||||
|
||||
<img width="1280" height="2474" alt="Snipaste_2025-07-15_13-05-35" src="https://github.com/user-attachments/assets/30308ec2-1e3b-4a8f-b3fe-7d205394578d" />
|
||||
|
||||
|
||||
#### 匹配步骤
|
||||
1. 选择职位来源、职位筛选条件
|
||||
<img width="1680" height="1050" alt="image" src="https://github.com/user-attachments/assets/cbdea071-ec28-49b0-af12-1018aa9579a9" />
|
||||
|
||||
2. 按照公司名称在列表中查找职位,查找到目标职位后,自动点击这个职位,右侧将会展示职位详情
|
||||
3. 对工作地、薪资、工作经验、职位名称、职位类型、职位描述、Boss活跃度进行匹配
|
||||
- 如果可以匹配,则自动点击开聊按钮
|
||||
- 不匹配则根据你设置的标记不合适的策略将职位标记为不合适
|
||||
- 首先查看是否命中策略为“在Boss直聘上标记不合适”的配置,如果命中则在Boss直聘上点击相关UI,标记不合适,一段时间内你将不会在Boss上看到这个职位,且将会推荐新职位置换这个职位(对于“推荐列表中的职位”、“通过搜索找到的职位”,此项会回落到“在本地数据库中标记不合适,且7天内再遇到这个职位时直接跳过”)
|
||||
- 然后查看是否命中策略为“在本地数据库中标记不合适,且7天内再遇到这个职位时直接跳过”的配置,如果命中则仅在本地数据库中记录,且本次运行将无视这个职位
|
||||
- 最后查看是否命中策略为了“仅在本次运行中记录不合适,且本次运行再遇到这个职位时直接跳过”的配置,如果命中则本次运行将无视这个职位,但下次运行可能还会查看这个职位
|
||||
|
||||
#### 异常情况
|
||||
- 当前页面筛选条件下,如果没有更多可投递职位,则自动切换筛选条件,以获取更多新职位;如果所有筛选条件搜索完没有更多可投递职位,则切换其它职位来源继续查找更多新职位;如果所有职位来源筛选完没有更多可投递职位,则等候一段时间后,会回到第一个职位来源的第一个筛选条件,从头开始查找职位
|
||||
- 如当天开聊次数用完,本程序会暂停运行60分钟,之后尝试继续重新运行;如重新运行时间已在第二天,则将会继续开聊
|
||||
|
||||
#### 运行效果
|
||||
|
||||
> Boss直聘界面已改版,如下是旧版Boss直聘界面
|
||||
|
||||
https://github.com/user-attachments/assets/672f1637-dd54-416c-922e-1ecf09b0874a
|
||||
|
||||
|
||||
### 已读不回提醒器
|
||||
Boss不明原因已读不回?简历就是投不出去?
|
||||
|
||||
已读不回提醒器,有事没事提醒一下已读不回的 Ta,助力把握每次机会
|
||||
|
||||
<img width="1024" alt="image" src="https://github.com/user-attachments/assets/51a43b0f-118d-4b0a-957c-40a5367e29e4" />
|
||||
|
||||
|
||||
#### 匹配逻辑
|
||||
1. 在聊天列表中查找对你消息已读不回的Boss,再发一条消息,多次复聊;同时:
|
||||
- 如果设置了“跟进时限”,那么在这个时间之前活跃的聊天将不会被检查
|
||||
- 如果设置了“跟进间隔”,且再次检查时发现Boss已读不回,且距离上次提醒时间间隔小于这个时间,那么聊天将暂时不会跟进,直到下次检查时距离上次提醒时间间隔大于这个时间
|
||||
|
||||
#### 发送内容
|
||||
以下二者之一:
|
||||
1. “[盼回复]”表情
|
||||
2. 由大语言模型(根据简历及当前聊天上下文)生成的内容
|
||||
|
||||
## 辅助功能介绍
|
||||
### Boss 登录助手
|
||||
帮你用十分简单的方式,登录到 Boss 直聘,以进行自动开聊、已读不回提醒,避免和乱七八糟的技术名词(类似:Cookie、登录凭证、JSON……)打交道
|
||||
|
||||
<img width="1680" alt="image" src="https://github.com/user-attachments/assets/b5d02385-f1c0-4045-b01a-66c5f747fec5" />
|
||||
|
||||
|
||||
### 大语言模型设置
|
||||
设置本程序运行过程中可能会使用的大模型,有大语言模型加持,让求职更智能。支持配置多个备用模型,确保生成内容更随机,同时确保当某个模型不可用时也能继续让其他模型继续为你服务
|
||||
|
||||
<img width="576" alt="image" src="https://github.com/user-attachments/assets/ef91642f-b0b0-438f-8c66-e650f0de139b" />
|
||||
|
||||
|
||||
### 已读不回提醒器提示词模板编辑
|
||||
对生成的提醒消息不够满意?您不妨可以自己进行编辑提示词,来获得您期望的结果
|
||||
|
||||
<img width="1139" alt="image" src="https://github.com/user-attachments/assets/db956573-61c0-44d4-b588-5c04fe941f84" />
|
||||
|
||||
|
||||
### 已读不回提醒器提醒过程模拟
|
||||
想要测试配置的某一款模型可不可用?想测试使用当前配置生成的内容效果如何?那就来这里试试吧
|
||||
|
||||
<img width="600" alt="image" src="https://github.com/user-attachments/assets/3b2776bd-ae5b-48d1-a01c-0819509d96a1" />
|
||||
|
||||
|
||||
### 配置模板选项
|
||||
初次见面,不会配置本程序?当心配置出现问题?本程序为一些关键的功能配置(例如:Boss炸弹中的期望公司设置、职位详情筛选设置;大语言模型设置)加入了配置模板,让本程序更易用,助你轻松完成配置,开始求职。不妨来试试吧
|
||||
|
||||
<img width="576" alt="image" src="https://github.com/user-attachments/assets/2cccfece-17e7-4cc2-bf33-67f0ce500625" />
|
||||
|
||||
|
||||
<img width="1024" alt="image" src="https://github.com/user-attachments/assets/f0c7453d-454e-494a-8c03-246107b1384f" />
|
||||
|
||||
|
||||
## 系统要求
|
||||
- 操作系统及处理器
|
||||
- Windows(x86_64):最低 Windows 10 1507(如果你的电脑是2016年后出厂、默认安装 Window 10 的电脑,一般都可以使用)
|
||||
@@ -36,16 +118,95 @@
|
||||
xattr -cr /Applications/GeekGeekRun.app
|
||||
```
|
||||
1. 双击应用程序图标以启动程序;启动后,将引导你为初次使用进行一些配置
|
||||
<!--
|
||||
# CLI 版本
|
||||
## 使用方式
|
||||
1. 确保你已经安装 Node.js 18+、pnpm 8.15.9
|
||||
1. `pnpm i` 安装依赖
|
||||
1. 打开 Chrome / Edge,安装 EditThisCookie 扩展程序
|
||||
1. 打开 [Boss直聘](https://www.zhipin.com) 网站,在浏览器右上角找到 EditThisCookie 扩展程序图标,并点击
|
||||
1. 按下 EditThisCookie 扩展程序弹出气泡中的“导出Cookie”按钮(左数第三个按钮),此时将会把你在 Boss直聘 网站下所有Cookie复制到剪切板上
|
||||
1. 打开 `~/.geekgeekrun/storage/boss-cookies.json` 文件(如果没有相关路径请自行创建),把文件清空,并粘贴刚刚复制的 Cookie
|
||||
1. 执行`pnpm start`。开聊 Boss !
|
||||
-->
|
||||
|
||||
祝求职成功~
|
||||
## 关于软件不能正常启动、不能按预期运行的一些说明
|
||||
本程序一直都在不断地更新迭代中,包括新功能的增加以及Bug的修复。
|
||||
|
||||
然而作者本人只有 1台 macOS (Apple Silicon)设备、1台 Windows 设备,且只有作者1人自测(白天工作,晚上熬夜开发、测试),测试条件不是太好(人力不足、设备不足),测试时只要确保两台设备能够正常运行本程序主要流程以及新增逻辑时,即认为可以准出、发版。
|
||||
|
||||
所以不能确保任何设备一定能够正确运行本程序;因此期望朋友们使用过程中,可以帮忙**参与测试**并通过Issue区**反馈问题**。Issue区任何内容我都会看,问题也会尝试进行修复。
|
||||
|
||||
如果部分朋友超级喜欢写代码,或者本身工作就是写代码,可以帮忙下载 [Debugtron](https://github.com/pd4d10/debugtron/releases/tag/v1.0.0-alpha.0) 来调试本程序,查看反馈本程序的日志(如下图)。
|
||||
|
||||

|
||||
|
||||
在此先谢过了~
|
||||
|
||||
## 为什么要写这个程序?
|
||||
### 个人而言
|
||||
以我为例,我真的求职求累了
|
||||
|
||||
2023年初~2025年初,这段时间
|
||||
- 求职经历:离职求职5个月,在职求职3个月;曾面试66个岗位,各种面试(一面、二面、三面、HR面)加起来134次;Offer 寥寥无几
|
||||
- 被动失业经历:1 次裁员,1 次卡试用期
|
||||
- 目前状态:有工作(但愿明天也有工作)
|
||||
|
||||
如此多的经历,已经让我成为了一位资深Boss用户
|
||||
|
||||
2023年,处于Gap期时,一天差不多可以有8小时浪费在Boss上挑选工作、开聊Boss上,这让我内心经常会很心累,时常陷入内耗,有种被全世界放弃的感觉
|
||||
|
||||
当时就有了想法,要让求职自动化。虽然后续也有新工作,但同工不同酬、卡试用期等情况,我还是有一些感受的。由此,便有了这个项目
|
||||
|
||||
我把之前的求职经验,通过这个程序表现了出来,假设你也在看机会,或许我的求职经验可以帮到你,让你少走弯路、减少内耗,愿你也能找到一份更好的工作
|
||||
|
||||
本程序完全公益、免费、开源。如需使用大模型功能,请自行到你喜欢的平台(例如:DeepSeek、阿里云、火山引擎、OpenAI)开通、充值,并在本程序中配置
|
||||
|
||||
### 大环境而言
|
||||
个人感受,大环境真的差,对于求职者相当不友好
|
||||
|
||||
一个岗位可以收到一堆简历投递,大部分简历最终的归宿都是人才库或者垃圾场
|
||||
|
||||
当然,如果运气好:
|
||||
- 好不容易过了 HR 面,到了 Offer 阶段,HR / 用人部门 几乎都在极限压缩用人成本,经常能被恶心到,但你又没有其它更好 Offer ,不敢贸然放弃这个不满意的 Offer
|
||||
- 终于你自我催眠(类似:“领导看我薪资低,所以一定会争取给我涨薪”、“领导看我薪资低,所以假设我加倍努力工作绩效一定会向我倾斜”、“领导画的饼很好,吃了一定能有好结果”),接了不满意的 Offer 入了职,然而经过一段时间的接触,最终结果完全不符合期望(诸如:“团队很难融入”、“协作方经常踢皮球”、“你需要做很多脏活累活,而且要帮前人擦屁股”、“领导希望用最小成本把你招来,这样裁员时可以最小成本把你打发走”、“团队需要新人来背C/M-/3.25/裁员指标”、“领导分配的工作和领导入职时画的诱人的饼完全不一致”)
|
||||
|
||||
为了避免这种情况的发生,找工作时还是需要尽可能多的面试,多个选择。如果真的不慎遭遇了这些情况,让你认为在当前岗位继续做下去的收益不如离职换工作的收益,那就做好走的准备吧
|
||||
|
||||
因此,我编写了Boss炸弹,可以帮你尽可能多地将当日开聊机会用完;也编写了已读不回提醒器,帮你戳一戳列表里读了消息但无回应的 Boss
|
||||
|
||||
### 求职平台(Boss直聘)而言
|
||||
根据日常使用经验,Boss直聘在已经开聊很多职位的情况下,经常会推荐:
|
||||
1. 一些长时间不活跃的“僵尸”职位 - 活跃信息默认隐藏,需要点开职位详情才能看到
|
||||
2. 牛头不对马嘴,不符合求职期望的职位
|
||||
|
||||
人工筛选这些职位会有很大的心智负担,真的会吐……
|
||||
|
||||
因此,我在Boss炸弹代码中,加入了清理机制,将通过标记不合适的方式,尝试让这些不活跃职位、不合适职位消失;保证只开聊符合你口味的职位。
|
||||
|
||||
## 使用必读及免责声明
|
||||
如下是使用必读及免责声明,请您务必逐条阅读;本程序首次启动时,您还会再看到一次;若您不接受如下提到的任何内容,请不要使用本程序。
|
||||
- 本程序从某种程度上说属于辅助工具,与《<a href="https://about.zhipin.com/agreement/?id=registerprotocol_30" rel="noreferer noopener" target="blank">Boss直聘用户协议</a>》(2023年3月版)相关条款相违背,您在注册Boss直聘时已签署过这一条款;根据该条款`七、用户的平台使用义务`、`八、违约责任` 章节,如果一些非正常用户行为被风控监测到,您需要承受包括不仅限于**账号被强制退出登录**、**账号被限制使用**、**账号被封禁**等对您不利的风险;因此使用本程序即意味着**您愿意接受以上风险**,且如果相关风险发生,您需要自行承担相关后果,**本程序概不负责** 。
|
||||
- 本程序需要存储您的登录凭据,即Cookie,来模拟您在Boss直聘上开聊Boss的行为;本程序仅会把您的Cookie存储在本地,并在您访问Boss直聘时将其传输到Boss直聘,**不会泄露给第三方**,也不会进行除自动开聊Boss以外的行为;**请勿向他人泄漏您的Cookie**。
|
||||
- 本程序会通过尽可能模仿用户行为来规避相关风险,但并不能保证可以完全规避。建议您使用本程序时**注意节制**,建议当天开聊次数用尽后,隔几天再使用。建议您**注册一个本程序专用的新的Boss直聘账号**进行求职。
|
||||
- 本程序原理是模拟用户在Boss直聘网页上,寻找关键元素并进行点击操作;Boss直聘网站经常**发生改版**,且有可能**包含A/B实验**,这将导致本程序相关脚本失效(典型表现为本程序运行到某一步骤后,浏览器重复“闪退、重新启动”)。如果您在使用过程中遇上程序未按照预期执行的情况,请[点击这里](https://github.com/geekgeekrun/geekgeekrun/issues/new)进行反馈。
|
||||
- 您所在公司可能会对您的计算机终端或网络进行**监控**,从而**审计**、**跟踪**您的行为;上级/HRBP团队可能会从 IT 团队处获取到监控数据,从而了解团队成员离职倾向。如果您不希望上级/HRBP团队了解到您正在求职,建议您**不要在您所在公司提供的计算机终端或网络上使用本程序**。
|
||||
- 本程序尊重您的隐私,**不会参与任何钓鱼活动**、**不会上报能够识别出您身份的信息**、**不会向您所在公司及上级/HRBP报告您的求职行为**、**不会向任何猎头公司泄露您的个人信息**。
|
||||
- 本程序**没有内置任何付费功能**,**下载**、**使用**是**免费**的,任何人可以**免费获得**、**免费使用**。**作者没有利用本程序赚到过任何收入**。如果您是从GitHub以外的地方付费后“购买”的本程序,或您被提示“必须付费后才能使用本程序”,那**您大概率被骗了**,或者**您下载到了本程序修改版**。**本程序对此概不负责,请勿找作者商讨退款、售后事宜,相关事宜请咨询卖方**。
|
||||
- 本程序**不对您的求职过程与结果负责**,为您开聊的职位均在Boss直聘上发布,职位信息真实性由Boss直聘负责;请**自行甄别为您开聊的公司**、**认真决定是否参加面试**、**慎重选择Offer**。
|
||||
- 请在Boss直聘上自行**屏蔽您不期望投递的公司**;如果您不希望您当前公司其它具有招聘账号的员工看到您在Boss直聘上活跃,请**在Boss直聘上屏蔽当前公司及与之关联的公司**。
|
||||
- 本程序经历过了多次测试,理论上来说大部分情况下可以正常运行,但可能也会出现测试用例覆盖不到位,导致程序不按预期运行的情况;如果您有顾虑,建议通过VMware Workstation/Fusion、Oracle VirtualBox、Microsoft Hyper-V等虚拟化技术运行本程序。如果您在使用过程中遇上程序未按照预期执行的情况,请[点击这里](https://github.com/geekgeekrun/geekgeekrun/issues/new)进行反馈。
|
||||
|
||||
## 想联系作者?想反馈使用体验上的问题?想找求职搭子?
|
||||
|
||||
<img width="360" alt="QQ Group QRCode" src="https://github.com/user-attachments/assets/67560948-467b-44f5-a3e3-c8713255d8b7" />
|
||||
|
||||
|
||||
欢迎进群聊天(刚建的群,人有点少,大胆聊就好)
|
||||
|
||||
--------
|
||||
|
||||
以上
|
||||
|
||||
更多功能还在开发中~
|
||||
|
||||
祝你求职成功,事业顺利,事事顺心
|
||||
|
||||
## Star
|
||||
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=geekgeekrun/geekgeekrun&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=geekgeekrun/geekgeekrun&type=Date" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=geekgeekrun/geekgeekrun&type=Date" />
|
||||
</picture>
|
||||
|
||||
感谢支持
|
||||
|
||||
@@ -90,7 +90,7 @@ export function* combineFiltersWithConstraintsGenerator(selectedFilters) {
|
||||
//#region get count of combinations
|
||||
|
||||
// 计算符合限制条件的组合数量
|
||||
export function calculateTotalCombinations(selectedFilters) {
|
||||
export function calculateTotalCombinations(selectedFilters, includeEmptyCondition) {
|
||||
const {
|
||||
salaryList = [],
|
||||
experienceList = [],
|
||||
@@ -106,8 +106,53 @@ export function calculateTotalCombinations(selectedFilters) {
|
||||
const scaleComb = combineWithZero(scaleList, 0, scaleList.length) // Scale: 0 个或更多
|
||||
const industryComb = combineWithZero(industryList, 0, 3) // Industry: 0-3 个
|
||||
|
||||
return [salaryComb, experienceComb, degreeComb, scaleComb, industryComb].reduce((accu, cur) => {
|
||||
let result = [salaryComb, experienceComb, degreeComb, scaleComb, industryComb].reduce((accu, cur) => {
|
||||
return accu * cur.length
|
||||
}, 1)
|
||||
if (!includeEmptyCondition) {
|
||||
result -= 1
|
||||
}
|
||||
return result
|
||||
}
|
||||
//#endregion
|
||||
|
||||
export function checkAnyCombineBossRecommendFilterHasCondition(value) {
|
||||
if (!Object.keys(value ?? {}).length) {
|
||||
return false
|
||||
}
|
||||
return Object.keys(value).some((k) => {
|
||||
return !!value[k]?.length
|
||||
})
|
||||
}
|
||||
|
||||
export function getStaticCombineFilterKey(condition) {
|
||||
const kAsO = {}
|
||||
for (const key of Object.keys(condition ?? []).sort()) {
|
||||
if (condition[key] === null || condition[key] === undefined) {
|
||||
continue
|
||||
}
|
||||
kAsO[key] = condition[key]
|
||||
}
|
||||
return JSON.stringify(kAsO)
|
||||
}
|
||||
|
||||
export function formatStaticCombineFilters(rawStaticCombineRecommendJobFilterConditions) {
|
||||
rawStaticCombineRecommendJobFilterConditions = JSON.parse(JSON.stringify(rawStaticCombineRecommendJobFilterConditions))
|
||||
const map = new Map()
|
||||
for (const condition of rawStaticCombineRecommendJobFilterConditions ?? []) {
|
||||
const key = getStaticCombineFilterKey(condition)
|
||||
map.set(key, condition)
|
||||
}
|
||||
const conditions = Array.from(map.values())
|
||||
const result = conditions.map((condition) => {
|
||||
return {
|
||||
salaryList: condition.salary ? [condition.salary] : [],
|
||||
experienceList: condition.experience ? [condition.experience] : [],
|
||||
degreeList: condition.degree ? [condition.degree] : [],
|
||||
scaleList: condition.scale ? [condition.scale] : [],
|
||||
industryList: condition.industry ? [condition.industry] : []
|
||||
}
|
||||
})
|
||||
result.unshift(null)
|
||||
return result
|
||||
}
|
||||
|
||||
7
packages/geek-auto-start-chat-with-boss/constant.mjs
Normal file
@@ -0,0 +1,7 @@
|
||||
export const activeDescList = [
|
||||
'', "半年前活跃","近半年活跃","5月内活跃","4月内活跃","3月内活跃","2月内活跃","本月活跃","2周内活跃","本周活跃","3日内活跃","昨日活跃","今日活跃","刚刚活跃"
|
||||
]
|
||||
|
||||
export const RECOMMEND_JOB_ENTRY_SELECTOR = `.c-expect-select a[ka="jobs_recommend_tab_click"]`
|
||||
export const USER_SET_EXPECT_JOB_ENTRIES_SELECTOR = `.c-expect-select .expect-list .expect-item`
|
||||
export const SEARCH_BOX_SELECTOR = `.c-search-input .search-input-box`
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"combineRecommendJobFilterType": 1,
|
||||
"anyCombineRecommendJobFilter": {
|
||||
"salaryList": [],
|
||||
"experienceList": [],
|
||||
@@ -6,9 +7,29 @@
|
||||
"scaleList": [],
|
||||
"industryList": []
|
||||
},
|
||||
"staticCombineRecommendJobFilterConditions": [],
|
||||
"isSkipEmptyConditionForCombineRecommendJobFilter": false,
|
||||
"expectJobRegExpStr": "",
|
||||
"jobNotMatchStrategy": 1,
|
||||
"jobNotActiveStrategy": 1,
|
||||
"markAsNotActiveSelectedTimeRange": 7,
|
||||
"expectCityList": [],
|
||||
"expectCityNotMatchStrategy": 3,
|
||||
"strategyScopeOptionWhenMarkJobCityNotMatch": 2,
|
||||
"jobDetailRegExpMatchLogic": 1,
|
||||
"autoReminder": {
|
||||
"throttleIntervalMinutes": 10,
|
||||
"rechatLimitDay": 21
|
||||
}
|
||||
"rechatLimitDay": 21,
|
||||
"geminiApiKey": "",
|
||||
"rechatContentSource": 1,
|
||||
"recentMessageQuantityForLlm": 8,
|
||||
"rechatLlmFallback": 1,
|
||||
"onlyRemindBossWithExpectJobType": true
|
||||
},
|
||||
"jobSourceList": [
|
||||
{
|
||||
"type": "expect",
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
[{
|
||||
"providerCompleteApiUrl": "",
|
||||
"providerApiSecret": "",
|
||||
"model": "",
|
||||
"enabled": true,
|
||||
"serveWeight": 100,
|
||||
"_extra": {}
|
||||
}]
|
||||
@@ -1,4 +1,4 @@
|
||||
[
|
||||
"青钱","软通动力","南天","睿服","中电金信","佰钧成","云链","博彦","汉克时代","柯莱特","拓保","亿达信息","纬创","微创","微澜","诚迈科技","法本","兆尹","诚迈","联合永道","新致软件","宇信科技",
|
||||
"抖音","字节","字跳","有竹居","脸萌","头条","懂车帝","滴滴","嘀嘀","小桔","网易","有道","腾讯","酷狗","酷我","阅文","搜狗","京东","沃东天骏","达达","百度","度小满","爱奇艺","携程","趣拿","去哪儿","集度","理想","蔚来","顺丰","讯飞","同程","艺龙","马蜂窝","贝壳","自如","链家","我爱我家","相寓","多点","金山","小米","猎豹","新浪","微博","阿里","蚂蚁","飞猪","高德","乌鸫","饿了么","美团","三快","猫眼","快手","映客","小红书","行吟","奇虎","360","三六零","鸿盈","奇富","奇元","亚信","启明星辰","奇安信","深信服","长亭","绿盟","天融信","商汤","SenseTime","大华","海康威视","hikvision","汽车之家","车好多","瓜子","易车","昆仑万维","昆仑天工","闲徕","趣加","FunPlus","完美","马上消费","轻松","水滴","白龙马","58","车欢欢","五八","红布林","致美","快狗","天鹅到家","转转","美餐","知乎","智者四海","易点云","搜狐","用友","畅捷通","猿辅导","小猿","猿力","好未来","学而思","希望学","新东方","东方甄选","东方优选","作业帮","高途","跟谁学","学科网","天学网","一起教育","一起作业","美术宝","火花思维","粉笔","老虎国际","一心向上","向上一意","联想","拉勾","乐视","欢聚","竞技世界","拼多多","寻梦","得物","Moka","希瑞亚斯","北森","OPPO","欧珀","vivo","维沃","小天才","步步高","读书郎","货拉拉","陌陌","探探","Shopee","首汽租车","神州租车","天眼查","旷视","小冰","美图","智谱华章","MiniMax","石头科技"
|
||||
"青钱","软通动力","南天","睿服","中电金信","佰钧成","云链","博彦","汉克时代","柯莱特","拓保","亿达信息","纬创","微创","微澜","诚迈科技","法本","兆尹","诚迈","联合永道","新致软件","宇信科技","华为","德科","FESCO","科锐","科之锐",
|
||||
"抖音","字节","字跳","有竹居","脸萌","头条","懂车帝","滴滴","嘀嘀","巨量引擎","小桔","网易","有道","腾讯","酷狗","酷我","阅文","搜狗","小鹅通","富途","京东","沃东天骏","达达","达冠","百度","昆仑芯","小度","度小满","爱奇艺","携程","趣拿","去哪儿","集度","智图","长地万方","瑞图万方","道道通","小熊博望","理想","蔚来","顺丰","丰巢","中通","圆通","申通","跨越","讯飞","同程","艺龙","马蜂窝","贝壳","自如","链家","我爱我家","相寓","多点","金山","小米","猎豹","新浪","微博","阿里","淘宝","淘麦郎","天猫","盒马","口碑","优视","夸克","UC","蚂蚁","高德","LAZADA","来赞达","飞猪","菜鸟","哈啰","钉钉","乌鸫","饿了么","美团","三快","猫眼","快手","映客","小红书","行吟","奇虎","360","三六零","鸿盈","奇富","奇元","亚信","启明星辰","奇安信","深信服","长亭","绿盟","天融信","商汤","SenseTime","大华","海康威视","hikvision","汽车之家","车好多","瓜子","易车","昆仑万维","昆仑天工","闲徕","趣加","FunPlus","完美","马上消费","轻松","水滴","白龙马","58","车欢欢","五八","红布林","致美","快狗","天鹅到家","转转","美餐","知乎","智者四海","易点云","搜狐","用友","畅捷通","猿辅导","小猿","猿力","好未来","学而思","希望学","新东方","东方甄选","东方优选","作业帮","高途","跟谁学","学科网","天学网","一起教育","一起作业","美术宝","火花思维","粉笔","51talk","爱学习","高思","老虎国际","一心向上","向上一意","联想","拉勾","乐视","欢聚","竞技世界","拼多多","寻梦","从鲸","TEMU","得物","有赞","Moka","希瑞亚斯","北森","OPPO","欧珀","vivo","维沃","小天才","步步高","读书郎","货拉拉","陌陌","探探","Shopee","虾皮","首汽租车","GoFun","神州租车","天眼查","旷视","小冰","美图","智谱华章","MiniMax","石头科技","迅雷","TP","锐捷","Tenda","腾达","斐讯","希音","SHEIN","稀宇","深言","百川智能","与爱为舞","牵手","Grab","爱回收","洋钱罐","瓴岳","得到","思维造物","地平线","咪咕","翼支付","电信","天翼","联通","蓝湖","墨刀","海尔","美的","米哈游","传音","同花顺","国美","TCL"
|
||||
]
|
||||
@@ -6,16 +6,18 @@ import os from 'node:os'
|
||||
import defaultDingtalkConf from './default-config-file/dingtalk.json' assert {type: 'json'}
|
||||
import defaultBossConf from './default-config-file/boss.json' assert {type: 'json'}
|
||||
import defaultTargetCompanyListConf from './default-config-file/target-company-list.json' assert {type: 'json'}
|
||||
import defaultLlmConf from './default-config-file/llm.json' assert { type: 'json' }
|
||||
|
||||
import defaultBossCookieStorage from './default-storage-file/boss-cookies.json' assert { type: 'json' }
|
||||
import defaultBossLocalStorageStorage from './default-storage-file/boss-local-storage.json' assert { type: 'json' }
|
||||
import defaultJobNotSuitReasonCodeToTextCacheStorage from './default-storage-file/job-not-suit-reason-code-to-text-cache.json' assert { type: 'json' }
|
||||
export const configFileNameList = ['boss.json', 'dingtalk.json', 'target-company-list.json']
|
||||
export const configFileNameList = ['boss.json', 'dingtalk.json', 'target-company-list.json', 'llm.json']
|
||||
|
||||
const defaultConfigFileContentMap = {
|
||||
'boss.json': JSON.stringify(defaultBossConf),
|
||||
'dingtalk.json': JSON.stringify(defaultDingtalkConf),
|
||||
'target-company-list.json': JSON.stringify(defaultTargetCompanyListConf)
|
||||
'target-company-list.json': JSON.stringify(defaultTargetCompanyListConf),
|
||||
'llm.json': JSON.stringify(defaultLlmConf)
|
||||
}
|
||||
|
||||
const runtimeFolderPath = path.join(os.homedir(), '.geekgeekrun')
|
||||
@@ -69,8 +71,12 @@ export const readConfigFile = (fileName) => {
|
||||
)
|
||||
} catch {
|
||||
fs.existsSync(joinedPath) && fs.unlinkSync(joinedPath)
|
||||
ensureConfigFileExist()
|
||||
o = JSON.parse(defaultConfigFileContentMap[fileName])
|
||||
if (defaultConfigFileContentMap[fileName]) {
|
||||
ensureConfigFileExist()
|
||||
o = JSON.parse(defaultConfigFileContentMap[fileName])
|
||||
} else {
|
||||
o = null
|
||||
}
|
||||
}
|
||||
|
||||
return o
|
||||
@@ -112,7 +118,8 @@ export const ensureStorageFileExist = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export const readStorageFile = (fileName) => {
|
||||
export const readStorageFile = (fileName, { isJson } = {}) => {
|
||||
isJson = isJson ?? true
|
||||
const joinedPath = path.join(storageFilePath, fileName)
|
||||
|
||||
if (!fs.existsSync(
|
||||
@@ -123,21 +130,36 @@ export const readStorageFile = (fileName) => {
|
||||
|
||||
let o
|
||||
try {
|
||||
o = JSON.parse(
|
||||
fs.readFileSync(joinedPath)
|
||||
)
|
||||
const content = fs.readFileSync(joinedPath)
|
||||
if (isJson) {
|
||||
o = JSON.parse(content)
|
||||
}
|
||||
else {
|
||||
o = content.toString()
|
||||
}
|
||||
} catch {
|
||||
fs.existsSync(joinedPath) && fs.unlinkSync(joinedPath)
|
||||
ensureStorageFileExist()
|
||||
o = JSON.parse(defaultStorageFileContentMap[fileName])
|
||||
if (isJson) {
|
||||
o = JSON.parse(defaultStorageFileContentMap[fileName] ?? 'null')
|
||||
}
|
||||
else {
|
||||
o = defaultStorageFileContentMap[fileName] ?? null
|
||||
}
|
||||
}
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
export const writeStorageFile = async (fileName, content) => {
|
||||
export const writeStorageFile = async (fileName, content, { isJson } = {}) => {
|
||||
isJson = isJson ?? true
|
||||
const filePath = path.join(storageFilePath, fileName)
|
||||
const fileContent = JSON.stringify(content)
|
||||
let fileContent
|
||||
if (isJson) {
|
||||
fileContent = JSON.stringify(content)
|
||||
} else {
|
||||
fileContent = content
|
||||
}
|
||||
return fsPromise.writeFile(
|
||||
filePath,
|
||||
fileContent
|
||||
|
||||
@@ -6,68 +6,27 @@ import {
|
||||
sleep,
|
||||
sleepWithRandomDelay
|
||||
} from '@geekgeekrun/utils/sleep.mjs'
|
||||
import extractZip from 'extract-zip'
|
||||
import { blockNavigation } from '@geekgeekrun/utils/puppeteer/block-navigation.mjs'
|
||||
import {
|
||||
writeStorageFile
|
||||
} from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path';
|
||||
import JSON5 from 'json5'
|
||||
import url from 'url';
|
||||
import packageJson from './package.json' assert {type: 'json'}
|
||||
import {
|
||||
runtimeFolderPath,
|
||||
ensureEditThisCookie,
|
||||
editThisCookieExtensionPath,
|
||||
} from './utils.mjs'
|
||||
|
||||
import { EventEmitter } from 'node:events'
|
||||
|
||||
export const loginEventBus = new EventEmitter()
|
||||
|
||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||
const isRunFromUi = Boolean(process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE)
|
||||
const isUiDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
const runtimeFolderPath = path.join(os.homedir(), '.geekgeekrun')
|
||||
const extensionDir = path.join(
|
||||
runtimeFolderPath,
|
||||
'chrome-extensions'
|
||||
)
|
||||
if (!fs.existsSync(
|
||||
runtimeFolderPath
|
||||
)) {
|
||||
fs.mkdirSync(runtimeFolderPath)
|
||||
}
|
||||
if (!fs.existsSync(extensionDir)) {
|
||||
fs.mkdirSync(extensionDir)
|
||||
}
|
||||
const editThisCookieExtensionPath = path.join(extensionDir, 'EditThisCookie')
|
||||
|
||||
let editThisCookieZipPath
|
||||
async function getEditThisCookieZipPath () {
|
||||
if (editThisCookieZipPath) {
|
||||
return editThisCookieZipPath
|
||||
}
|
||||
if (isRunFromUi) {
|
||||
const { app } = await import('electron')
|
||||
editThisCookieZipPath = path.join(app.getAppPath(), './node_modules', packageJson.name, 'extensions', 'EditThisCookie.zip')
|
||||
} else {
|
||||
editThisCookieZipPath = path.join(__dirname, 'extensions', 'EditThisCookie.zip')
|
||||
}
|
||||
return editThisCookieZipPath
|
||||
}
|
||||
|
||||
export async function main() {
|
||||
if (!fs.existsSync(
|
||||
path.join(editThisCookieExtensionPath, 'manifest.json')
|
||||
)) {
|
||||
await extractZip(
|
||||
await getEditThisCookieZipPath(),
|
||||
{
|
||||
dir: extensionDir
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
await ensureEditThisCookie()
|
||||
const { puppeteer } = await initPuppeteer()
|
||||
const browser = await puppeteer.launch({
|
||||
headless: false,
|
||||
@@ -96,10 +55,8 @@ export async function main() {
|
||||
|
||||
page.once('close', async () => {
|
||||
browser.close()
|
||||
if (isRunFromUi) {
|
||||
const electron = await import('electron')
|
||||
electron.app.quit()
|
||||
}
|
||||
const electron = await import('electron')
|
||||
electron.app.quit()
|
||||
})
|
||||
|
||||
const { dispose: disposeNavigationLock } = await blockNavigation(page, (req) => !req.url().startsWith('https://www.zhipin.com'))
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import extractZip from 'extract-zip'
|
||||
import packageJson from './package.json' assert {type: 'json'}
|
||||
|
||||
const isUiDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
export const runtimeFolderPath = path.join(os.homedir(), '.geekgeekrun')
|
||||
|
||||
const extensionDir = path.join(
|
||||
runtimeFolderPath,
|
||||
'chrome-extensions'
|
||||
)
|
||||
if (!fs.existsSync(
|
||||
runtimeFolderPath
|
||||
)) {
|
||||
fs.mkdirSync(runtimeFolderPath)
|
||||
}
|
||||
if (!fs.existsSync(extensionDir)) {
|
||||
fs.mkdirSync(extensionDir)
|
||||
}
|
||||
export const editThisCookieExtensionPath = path.join(extensionDir, 'EditThisCookie')
|
||||
|
||||
let editThisCookieZipPath
|
||||
async function getEditThisCookieZipPath () {
|
||||
if (editThisCookieZipPath) {
|
||||
return editThisCookieZipPath
|
||||
}
|
||||
const { app } = await import('electron')
|
||||
editThisCookieZipPath = path.join(app.getAppPath(), './node_modules', packageJson.name, 'extensions', 'EditThisCookie.zip')
|
||||
return editThisCookieZipPath
|
||||
}
|
||||
|
||||
export async function ensureEditThisCookie () {
|
||||
let isNeedExtractEditThisCookie = false
|
||||
const manifestFilePath = path.join(editThisCookieExtensionPath, 'manifest.json')
|
||||
if (!fs.existsSync(
|
||||
manifestFilePath
|
||||
)) {
|
||||
isNeedExtractEditThisCookie = true
|
||||
} else {
|
||||
let manifest
|
||||
try {
|
||||
manifest = JSON.parse(fs.readFileSync(manifestFilePath, { encoding: 'utf-8' }))
|
||||
if (!manifest.manifest_version || manifest.manifest_version <= 2) {
|
||||
isNeedExtractEditThisCookie = true
|
||||
}
|
||||
}
|
||||
catch {
|
||||
console.log(`未能获取到文件内容`)
|
||||
isNeedExtractEditThisCookie = true
|
||||
}
|
||||
}
|
||||
|
||||
if (isNeedExtractEditThisCookie) {
|
||||
if (
|
||||
fs.existsSync(
|
||||
editThisCookieExtensionPath
|
||||
)
|
||||
) {
|
||||
fs.rmSync(
|
||||
editThisCookieExtensionPath,
|
||||
{
|
||||
recursive: true,
|
||||
force: true
|
||||
}
|
||||
)
|
||||
}
|
||||
await extractZip(
|
||||
await getEditThisCookieZipPath(),
|
||||
{
|
||||
dir: extensionDir
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -51,11 +51,13 @@ const main = async () => {
|
||||
pageLoaded: new SyncHook(),
|
||||
cookieWillSet: new SyncHook(['cookies']),
|
||||
userInfoResponse: new AsyncSeriesHook(['userInfo']),
|
||||
mainFlowWillLaunch: new AsyncSeriesHook(['args']),
|
||||
newChatWillStartup: new AsyncSeriesHook(['positionInfoDetail']),
|
||||
newChatStartup: new AsyncSeriesHook(['positionInfoDetail', 'chatRunningContext']),
|
||||
noPositionFoundForCurrentJob: new SyncHook(),
|
||||
noPositionFoundAfterTraverseAllJob: new SyncHook(),
|
||||
errorEncounter: new SyncHook(['errorInfo'])
|
||||
errorEncounter: new SyncHook(['errorInfo']),
|
||||
encounterEmptyRecommendJobList: new AsyncSeriesHook(['args'])
|
||||
}
|
||||
initPlugins(hooks)
|
||||
await hooks.daemonInitialized.callAsync()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@geekgeekrun/sqlite-plugin",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"dependencies": {
|
||||
|
||||
@@ -25,7 +25,7 @@ export class ChatMessageRecord {
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
style?: 'sent' | 'receive';
|
||||
style?: 'sent' | 'received';
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { JobSource } from "../enums";
|
||||
import { requireTypeorm } from "../utils/module-loader";
|
||||
const { Entity, Column, PrimaryGeneratedColumn } = requireTypeorm()
|
||||
|
||||
@@ -29,4 +30,9 @@ export class ChatStartupLog {
|
||||
nullable: true
|
||||
})
|
||||
autoStartupChatRecordId?: number;
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
jobSource?: JobSource;
|
||||
}
|
||||
|
||||
64
packages/sqlite-plugin/src/entity/LlmModelUsageRecord.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { requireTypeorm } from "../utils/module-loader";
|
||||
const { Entity, PrimaryGeneratedColumn, Column, Index } = requireTypeorm()
|
||||
|
||||
@Entity()
|
||||
@Index(["providerCompleteApiUrl", "model", "providerApiSecret"])
|
||||
export class LlmModelUsageRecord {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
providerCompleteApiUrl: string
|
||||
|
||||
@Column()
|
||||
model: string
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
providerApiSecret: string
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
completionTokens?: number;
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
promptTokens?: number;
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
promptCacheHitTokens?: number
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
promptCacheMissTokens?: number
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
totalTokens?: number;
|
||||
|
||||
@Column()
|
||||
requestStartTime: Date
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
requestEndTime?: Date
|
||||
|
||||
@Column()
|
||||
hasError: boolean
|
||||
|
||||
@Column()
|
||||
errorMessage: string
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
requestScene?: number
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MarkAsNotSuitReason } from "../enums";
|
||||
import { JobSource, MarkAsNotSuitOp, MarkAsNotSuitReason } from "../enums";
|
||||
import { requireTypeorm } from "../utils/module-loader";
|
||||
import { ChatStartupFrom } from "./ChatStartupLog";
|
||||
const { Entity, Column, PrimaryGeneratedColumn } = requireTypeorm()
|
||||
@@ -27,6 +27,11 @@ export class MarkAsNotSuitLog {
|
||||
})
|
||||
markReason?: MarkAsNotSuitReason
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
markOp?: MarkAsNotSuitOp
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
@@ -36,4 +41,9 @@ export class MarkAsNotSuitLog {
|
||||
nullable: true
|
||||
})
|
||||
autoStartupChatRecordId?: number;
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
jobSource?: JobSource;
|
||||
}
|
||||
|
||||
@@ -3,4 +3,39 @@ export enum MarkAsNotSuitReason {
|
||||
BOSS_INACTIVE = 1,
|
||||
USER_MANUAL_OPERATION_WITH_UNKNOWN_REASON = 2,
|
||||
JOB_NOT_SUIT = 3,
|
||||
JOB_CITY_NOT_SUIT = 4,
|
||||
JOB_WORK_EXP_NOT_SUIT = 5,
|
||||
JOB_SALARY_NOT_SUIT = 6,
|
||||
}
|
||||
|
||||
export enum MarkAsNotSuitOp {
|
||||
MARK_AS_NOT_SUIT_ON_BOSS = 1,
|
||||
MARK_AS_NOT_SUIT_ON_LOCAL = 2,
|
||||
NO_OP = 3
|
||||
}
|
||||
|
||||
export enum StrategyScopeOptionWhenMarkJobNotMatch {
|
||||
ALL_JOB = 1,
|
||||
ONLY_COMPANY_MATCHED_JOB = 2
|
||||
}
|
||||
|
||||
export enum SalaryCalculateWay {
|
||||
MONTH_SALARY = 1,
|
||||
ANNUAL_PACKAGE = 2,
|
||||
}
|
||||
|
||||
export enum JobDetailRegExpMatchLogic {
|
||||
EVERY = 1,
|
||||
SOME = 2,
|
||||
}
|
||||
|
||||
export enum JobSource {
|
||||
expect = 1,
|
||||
recommend = 2,
|
||||
search = 3,
|
||||
}
|
||||
|
||||
export enum CombineRecommendJobFilterType {
|
||||
ANY_COMBINE = 1,
|
||||
STATIC_COMBINE = 2,
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DataSource } from "typeorm";
|
||||
import { DataSource, Raw } from "typeorm";
|
||||
import { BossActiveStatusRecord } from "./entity/BossActiveStatusRecord";
|
||||
import { BossInfo } from "./entity/BossInfo";
|
||||
import { CompanyInfo } from "./entity/CompanyInfo";
|
||||
@@ -10,6 +10,7 @@ import { CompanyInfoChangeLog } from "./entity/CompanyInfoChangeLog";
|
||||
import { JobInfoChangeLog } from "./entity/JobInfoChangeLog";
|
||||
import { MarkAsNotSuitLog } from "./entity/MarkAsNotSuitLog";
|
||||
import { ChatMessageRecord } from "./entity/ChatMessageRecord";
|
||||
import { LlmModelUsageRecord } from "./entity/LlmModelUsageRecord";
|
||||
|
||||
function getBossInfoIfIsEqual (savedOne, currentOne) {
|
||||
if (savedOne === currentOne) {
|
||||
@@ -244,7 +245,7 @@ export async function saveChatStartupRecord(
|
||||
ds: DataSource,
|
||||
_jobInfo,
|
||||
{ encryptUserId },
|
||||
{ autoStartupChatRecordId = undefined, chatStartupFrom = undefined } = {}
|
||||
{ autoStartupChatRecordId = undefined, chatStartupFrom = undefined, jobSource = undefined } = {}
|
||||
) {
|
||||
const { jobInfo } = _jobInfo;
|
||||
|
||||
@@ -255,7 +256,8 @@ export async function saveChatStartupRecord(
|
||||
encryptCurrentUserId: encryptUserId,
|
||||
encryptJobId: jobInfo.encryptId,
|
||||
autoStartupChatRecordId,
|
||||
chatStartupFrom
|
||||
chatStartupFrom,
|
||||
jobSource,
|
||||
}
|
||||
Object.assign(chatStartupLog, chatStartupLogPayload)
|
||||
|
||||
@@ -269,7 +271,7 @@ export async function saveMarkAsNotSuitRecord(
|
||||
ds: DataSource,
|
||||
_jobInfo,
|
||||
{ encryptUserId },
|
||||
{ autoStartupChatRecordId = undefined, markFrom = undefined, extInfo = undefined, markReason = undefined } = {}
|
||||
{ autoStartupChatRecordId = undefined, markFrom = undefined, extInfo = undefined, markReason = undefined, markOp = undefined, jobSource = undefined } = {}
|
||||
) {
|
||||
const { jobInfo } = _jobInfo;
|
||||
|
||||
@@ -282,7 +284,9 @@ export async function saveMarkAsNotSuitRecord(
|
||||
autoStartupChatRecordId,
|
||||
markFrom,
|
||||
markReason,
|
||||
extInfo: extInfo ? JSON.stringify(extInfo) : undefined
|
||||
extInfo: extInfo ? JSON.stringify(extInfo) : undefined,
|
||||
markOp,
|
||||
jobSource,
|
||||
}
|
||||
Object.assign(markAsNotSuitLog, markAsNotSuitLogPayload)
|
||||
|
||||
@@ -307,3 +311,57 @@ export async function saveChatMessageRecord(
|
||||
//#endregion
|
||||
return
|
||||
}
|
||||
|
||||
export async function saveGptCompletionRequestRecord(
|
||||
ds: DataSource,
|
||||
records: LlmModelUsageRecord[]
|
||||
) {
|
||||
//#region mark-as-not-suit-log
|
||||
const list = records.map(it => {
|
||||
const o = new LlmModelUsageRecord()
|
||||
for (const k of Object.keys(it)) {
|
||||
o[k] = it[k]
|
||||
}
|
||||
return o
|
||||
})
|
||||
const chatMessageRecordRepository = ds.getRepository(LlmModelUsageRecord);
|
||||
await chatMessageRecordRepository.save(list);
|
||||
//#endregion
|
||||
return
|
||||
}
|
||||
|
||||
export async function getNotSuitMarkRecordsInLastSomeDays (ds: DataSource, days = 0) {
|
||||
const repo = ds.getRepository(MarkAsNotSuitLog)
|
||||
const result = await repo.findBy({
|
||||
date: Raw(alias => `DATE(${alias}) >= DATE('${
|
||||
new Date(
|
||||
Number(new Date()) - days * 24 * 60 * 60 * 1000
|
||||
).toISOString()
|
||||
}')`)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
export async function getChatStartupRecordsInLastSomeDays (ds: DataSource, days = 0) {
|
||||
const repo = ds.getRepository(ChatStartupLog)
|
||||
const result = await repo.findBy({
|
||||
date: Raw(alias => `DATE(${alias}) >= DATE('${
|
||||
new Date(
|
||||
Number(new Date()) - days * 24 * 60 * 60 * 1000
|
||||
).toISOString()
|
||||
}')`)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
export async function getBossIdsByJobIds (ds: DataSource, jobIds: string[] = []) {
|
||||
const repo = ds.getRepository(JobInfo)
|
||||
const result = await repo.find({
|
||||
where: jobIds.map(
|
||||
id => ({
|
||||
encryptJobId: id
|
||||
})
|
||||
)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -19,18 +19,31 @@ import { VJobLibrary } from "./entity/VJobLibrary";
|
||||
import { VCompanyLibrary } from "./entity/VCompanyLibrary"
|
||||
import { VMarkAsNotSuitLog } from "./entity/VMarkAsNotSuitLog"
|
||||
import { ChatMessageRecord } from './entity/ChatMessageRecord'
|
||||
import { LlmModelUsageRecord } from './entity/LlmModelUsageRecord'
|
||||
|
||||
import sqlite3 from 'sqlite3';
|
||||
import { saveChatStartupRecord, saveJobInfoFromRecommendPage, saveMarkAsNotSuitRecord } from "./handlers";
|
||||
import {
|
||||
saveChatStartupRecord,
|
||||
saveJobInfoFromRecommendPage,
|
||||
saveMarkAsNotSuitRecord,
|
||||
getNotSuitMarkRecordsInLastSomeDays,
|
||||
getChatStartupRecordsInLastSomeDays,
|
||||
getBossIdsByJobIds
|
||||
} from "./handlers";
|
||||
import { UpdateChatStartupLogTable1729182577167 } from "./migrations/1729182577167-UpdateChatStartupLogTable";
|
||||
import minimist from 'minimist'
|
||||
import { UpdateBossInfoTable1732032381304 } from "./migrations/1732032381304-UpdateBossInfoTable";
|
||||
import { MarkAsNotSuitOp, MarkAsNotSuitReason } from "./enums";
|
||||
import { AddColumnForMarkAsNotSuitLog1746092370665 } from "./migrations/1746092370665-AddColumnForMarkAsNotSuitLog";
|
||||
import { Init1000000000000 } from "./migrations/1000000000000-Init";
|
||||
import { AddJobSourceColumnForChatStartupLogAndMarkAsNotSuitLog1752380078526 } from "./migrations/1752380078526-AddJobSourceColumnForChatStartupLogAndMarkAsNotSuitLog";
|
||||
const lodashImportPromise = import('lodash-es')
|
||||
|
||||
export function initDb(dbFilePath) {
|
||||
const { DataSource } = requireTypeorm()
|
||||
const appDataSource = new DataSource({
|
||||
type: "sqlite",
|
||||
synchronize: true,
|
||||
synchronize: false,
|
||||
logging: true,
|
||||
logger: "simple-console",
|
||||
database: dbFilePath,
|
||||
@@ -53,10 +66,14 @@ export function initDb(dbFilePath) {
|
||||
MarkAsNotSuitLog,
|
||||
VMarkAsNotSuitLog,
|
||||
ChatMessageRecord,
|
||||
LlmModelUsageRecord,
|
||||
],
|
||||
migrations: [
|
||||
Init1000000000000,
|
||||
UpdateChatStartupLogTable1729182577167,
|
||||
UpdateBossInfoTable1732032381304
|
||||
UpdateBossInfoTable1732032381304,
|
||||
AddColumnForMarkAsNotSuitLog1746092370665,
|
||||
AddJobSourceColumnForChatStartupLogAndMarkAsNotSuitLog1752380078526
|
||||
],
|
||||
migrationsRun: true
|
||||
});
|
||||
@@ -95,27 +112,109 @@ export default class SqlitePlugin {
|
||||
return await userInfoRepository.save(user);
|
||||
}
|
||||
);
|
||||
hooks.mainFlowWillLaunch.tapPromise(
|
||||
"SqlitePlugin",
|
||||
async ({
|
||||
jobNotMatchStrategy,
|
||||
jobNotActiveStrategy,
|
||||
expectCityNotMatchStrategy,
|
||||
blockJobNotSuit,
|
||||
blockBossNotActive,
|
||||
blockBossNotNewChat
|
||||
}) => {
|
||||
if (
|
||||
jobNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL ||
|
||||
jobNotActiveStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL ||
|
||||
expectCityNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL
|
||||
) {
|
||||
const ds = await this.initPromise;
|
||||
const last7DayMarkRecords = (await getNotSuitMarkRecordsInLastSomeDays(ds, 7)) ?? [];
|
||||
if (
|
||||
jobNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL ||
|
||||
jobNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS
|
||||
) {
|
||||
last7DayMarkRecords
|
||||
.filter(it =>
|
||||
[
|
||||
MarkAsNotSuitReason.JOB_NOT_SUIT,
|
||||
MarkAsNotSuitReason.USER_MANUAL_OPERATION_WITH_UNKNOWN_REASON
|
||||
].includes(it.markReason)
|
||||
)
|
||||
.map(
|
||||
it => it.encryptJobId
|
||||
)
|
||||
.forEach(
|
||||
id => blockJobNotSuit.add(id)
|
||||
)
|
||||
}
|
||||
if (
|
||||
jobNotActiveStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL ||
|
||||
jobNotActiveStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS
|
||||
) {
|
||||
last7DayMarkRecords
|
||||
.filter(it => it.markReason === MarkAsNotSuitReason.BOSS_INACTIVE)
|
||||
.map(
|
||||
it => it.encryptJobId
|
||||
)
|
||||
.forEach(
|
||||
id => blockJobNotSuit.add(id)
|
||||
)
|
||||
}
|
||||
if (
|
||||
expectCityNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_LOCAL ||
|
||||
expectCityNotMatchStrategy === MarkAsNotSuitOp.MARK_AS_NOT_SUIT_ON_BOSS
|
||||
) {
|
||||
last7DayMarkRecords
|
||||
.filter(it => it.markReason === MarkAsNotSuitReason.JOB_CITY_NOT_SUIT)
|
||||
.map(
|
||||
it => it.encryptJobId
|
||||
)
|
||||
.forEach(
|
||||
id => blockJobNotSuit.add(id)
|
||||
)
|
||||
}
|
||||
const last30DayChatStartupRecords = (await getChatStartupRecordsInLastSomeDays(ds, 30)) ?? [];
|
||||
const chattedJobIds = last30DayChatStartupRecords.map(it => it.encryptJobId)
|
||||
if (chattedJobIds.length === 0) {
|
||||
return
|
||||
}
|
||||
const { chunk } = await lodashImportPromise
|
||||
const chattedJobIdChunks = chunk(chattedJobIds, 200)
|
||||
const chattedBossIds = [];
|
||||
for (const chattedJobIdChunk of chattedJobIdChunks) {
|
||||
const chattedBossIdChunk = ((await getBossIdsByJobIds(ds, chattedJobIdChunk)) ?? []).map(it => it.encryptBossId)
|
||||
chattedBossIds.push(...chattedBossIdChunk)
|
||||
}
|
||||
for (const id of chattedBossIds) {
|
||||
blockBossNotNewChat.add(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
hooks.jobDetailIsGetFromRecommendList.tapPromise("SqlitePlugin", async (_jobInfo) => {
|
||||
const ds = await this.initPromise;
|
||||
await saveJobInfoFromRecommendPage(ds, _jobInfo);
|
||||
});
|
||||
|
||||
hooks.newChatStartup.tapPromise("SqlitePlugin", async (_jobInfo, { chatStartupFrom = ChatStartupFrom.AutoFromRecommendList } = {}) => {
|
||||
hooks.newChatStartup.tapPromise("SqlitePlugin", async (_jobInfo, { chatStartupFrom = ChatStartupFrom.AutoFromRecommendList, jobSource = undefined } = {}) => {
|
||||
const ds = await this.initPromise;
|
||||
return await saveChatStartupRecord(ds, _jobInfo, this.userInfo, {
|
||||
autoStartupChatRecordId: this.runRecordId,
|
||||
chatStartupFrom
|
||||
chatStartupFrom,
|
||||
jobSource
|
||||
});
|
||||
});
|
||||
|
||||
hooks.jobMarkedAsNotSuit.tapPromise("SqlitePlugin", async (_jobInfo, { markFrom = ChatStartupFrom.AutoFromRecommendList, markReason = undefined, extInfo = undefined } = {}) => {
|
||||
hooks.jobMarkedAsNotSuit.tapPromise("SqlitePlugin", async (_jobInfo, { markFrom = ChatStartupFrom.AutoFromRecommendList, markReason = undefined, extInfo = undefined, markOp = undefined, jobSource = undefined } = {}) => {
|
||||
const ds = await this.initPromise;
|
||||
return await saveMarkAsNotSuitRecord(ds, _jobInfo, this.userInfo, {
|
||||
autoStartupChatRecordId: this.runRecordId,
|
||||
markFrom,
|
||||
markReason,
|
||||
extInfo
|
||||
extInfo,
|
||||
markOp,
|
||||
jobSource
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
24
packages/sqlite-plugin/src/migrations/1000000000000-Init.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { DataSource, MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
export class Init1000000000000 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const tableSchemaStatements = `CREATE TABLE IF NOT EXISTS "boss_info" ("encryptBossId" varchar PRIMARY KEY NOT NULL, "encryptCompanyId" varchar, "name" varchar NOT NULL, "date" datetime NOT NULL, "title" varchar NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "boss_info_change_log" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "encryptBossId" varchar NOT NULL, "updateTime" datetime NOT NULL, "dataAsJson" varchar NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "chat_startup_log" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "encryptJobId" varchar NOT NULL, "encryptCurrentUserId" varchar NOT NULL, "date" datetime NOT NULL, "chatStartupFrom" integer, "autoStartupChatRecordId" integer);
|
||||
CREATE TABLE IF NOT EXISTS "company_info_change_log" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "encryptCompanyId" varchar NOT NULL, "updateTime" datetime NOT NULL, "dataAsJson" varchar NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "company_info" ("encryptCompanyId" varchar PRIMARY KEY NOT NULL, "name" varchar NOT NULL, "brandName" varchar NOT NULL, "scaleLow" integer, "scaleHigh" integer, "stageName" varchar, "industryName" varchar);
|
||||
CREATE TABLE IF NOT EXISTS "job_info" ("encryptJobId" varchar PRIMARY KEY NOT NULL, "jobName" varchar NOT NULL, "positionName" varchar NOT NULL, "salaryLow" integer, "salaryHigh" integer, "salaryMonth" integer, "experienceName" varchar NOT NULL, "publishDate" datetime, "degreeName" varchar, "address" varchar, "description" varchar NOT NULL, "encryptBossId" varchar NOT NULL, "encryptCompanyId" varchar NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "job_info_change_log" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "encryptJobId" varchar NOT NULL, "updateTime" datetime NOT NULL, "dataAsJson" varchar NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "boss_active_status_record" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "encryptBossId" varchar NOT NULL, "lastActiveStatus" varchar, "updateTime" datetime NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "user_info" ("encryptUserId" varchar PRIMARY KEY NOT NULL, "name" varchar NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "auto_start_chat_run_record" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "date" datetime NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "mark_as_not_suit_log" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "encryptJobId" varchar NOT NULL, "encryptCurrentUserId" varchar NOT NULL, "date" datetime NOT NULL, "markFrom" integer, "markReason" integer, "extInfo" varchar, "autoStartupChatRecordId" integer);
|
||||
CREATE TABLE IF NOT EXISTS "chat_message_record" ("mid" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "encryptFromUserId" varchar NOT NULL, "encryptToUserId" varchar NOT NULL, "time" datetime, "type" varchar, "style" varchar, "text" varchar, "imageUrl" varchar, "imageWidth" integer, "imageHeight" integer);
|
||||
CREATE TABLE IF NOT EXISTS "llm_model_usage_record" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "providerCompleteApiUrl" varchar NOT NULL, "model" varchar NOT NULL, "providerApiSecret" varchar, "completionTokens" integer, "promptTokens" integer, "promptCacheHitTokens" integer, "promptCacheMissTokens" integer, "totalTokens" integer, "requestStartTime" datetime NOT NULL, "requestEndTime" datetime, "hasError" boolean NOT NULL, "errorMessage" varchar NOT NULL, "requestScene" integer);`.split('\n')
|
||||
for(const statement of tableSchemaStatements) {
|
||||
await queryRunner.query(statement);
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,24 @@
|
||||
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
import { DataSource, MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
import { VBossLibrary } from "../entity/VBossLibrary";
|
||||
import { VChatStartupLog } from "../entity/VChatStartupLog";
|
||||
import { VCompanyLibrary } from "../entity/VCompanyLibrary";
|
||||
import { VJobLibrary } from "../entity/VJobLibrary";
|
||||
import { VMarkAsNotSuitLog } from "../entity/VMarkAsNotSuitLog";
|
||||
|
||||
const viewNames = [
|
||||
"v_boss_library",
|
||||
"v_chat_startup_log",
|
||||
"v_company_library",
|
||||
"v_job_library",
|
||||
"v_mark_as_not_suit_log"
|
||||
];
|
||||
const ViewEntities = [
|
||||
VBossLibrary,
|
||||
VChatStartupLog,
|
||||
VCompanyLibrary,
|
||||
VJobLibrary,
|
||||
VMarkAsNotSuitLog,
|
||||
]
|
||||
|
||||
export class UpdateChatStartupLogTable1729182577167
|
||||
implements MigrationInterface
|
||||
{
|
||||
export class UpdateChatStartupLogTable1729182577167 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
for (const viewName of viewNames) {
|
||||
await queryRunner.query(`DROP VIEW IF EXISTS "${viewName}"`);
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
await queryRunner.query(`DROP VIEW IF EXISTS "${viewMetadata.tableName}"`);
|
||||
}
|
||||
if (await queryRunner.hasTable("boss_active_status_record")) {
|
||||
if (await queryRunner.hasColumn("boss_active_status_record", "updateDate")) {
|
||||
@@ -40,14 +45,17 @@ export class UpdateChatStartupLogTable1729182577167
|
||||
})
|
||||
)
|
||||
}
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
let expression = viewMetadata.expression;
|
||||
if (typeof expression === 'function') {
|
||||
expression = expression(dataSource).getQuery();
|
||||
}
|
||||
await queryRunner.query(`CREATE VIEW "${viewMetadata.tableName}" AS ${expression}`);
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
for (const viewName of viewNames) {
|
||||
await queryRunner.query(`DROP VIEW IF EXISTS "${viewName}"`);
|
||||
}
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE boss_active_status_record RENAME COLUMN updateTime TO updateDate`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,48 @@
|
||||
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
import { DataSource, MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
import { VBossLibrary } from "../entity/VBossLibrary";
|
||||
import { VChatStartupLog } from "../entity/VChatStartupLog";
|
||||
import { VCompanyLibrary } from "../entity/VCompanyLibrary";
|
||||
import { VJobLibrary } from "../entity/VJobLibrary";
|
||||
import { VMarkAsNotSuitLog } from "../entity/VMarkAsNotSuitLog";
|
||||
|
||||
const viewNames = [
|
||||
"v_boss_library",
|
||||
"v_chat_startup_log",
|
||||
"v_company_library",
|
||||
"v_job_library",
|
||||
"v_mark_as_not_suit_log"
|
||||
];
|
||||
const ViewEntities = [
|
||||
VBossLibrary,
|
||||
VChatStartupLog,
|
||||
VCompanyLibrary,
|
||||
VJobLibrary,
|
||||
VMarkAsNotSuitLog,
|
||||
]
|
||||
|
||||
export class UpdateBossInfoTable1732032381304 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
for (const viewName of viewNames) {
|
||||
await queryRunner.query(`DROP VIEW IF EXISTS "${viewName}"`);
|
||||
}
|
||||
if (await queryRunner.hasTable("boss_info")) {
|
||||
if (await queryRunner.hasColumn("boss_info", "encryptCompanyId")) {
|
||||
await queryRunner.changeColumn(
|
||||
'boss_info',
|
||||
'encryptCompanyId',
|
||||
new TableColumn({
|
||||
name: 'encryptCompanyId',
|
||||
type: 'varchar',
|
||||
isNullable: true
|
||||
})
|
||||
)
|
||||
debugger
|
||||
}
|
||||
}
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
await queryRunner.query(`DROP VIEW IF EXISTS "${viewMetadata.tableName}"`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
if (await queryRunner.hasTable("boss_info")) {
|
||||
if (await queryRunner.hasColumn("boss_info", "encryptCompanyId")) {
|
||||
await queryRunner.changeColumn(
|
||||
"boss_info",
|
||||
"encryptCompanyId",
|
||||
new TableColumn({
|
||||
name: "encryptCompanyId",
|
||||
type: "varchar",
|
||||
isNullable: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
let expression = viewMetadata.expression;
|
||||
if (typeof expression === 'function') {
|
||||
expression = expression(dataSource).getQuery();
|
||||
}
|
||||
await queryRunner.query(`CREATE VIEW "${viewMetadata.tableName}" AS ${expression}`);
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { DataSource, MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||
import { VBossLibrary } from "../entity/VBossLibrary";
|
||||
import { VChatStartupLog } from "../entity/VChatStartupLog";
|
||||
import { VCompanyLibrary } from "../entity/VCompanyLibrary";
|
||||
import { VJobLibrary } from "../entity/VJobLibrary";
|
||||
import { VMarkAsNotSuitLog } from "../entity/VMarkAsNotSuitLog";
|
||||
|
||||
const ViewEntities = [
|
||||
VBossLibrary,
|
||||
VChatStartupLog,
|
||||
VCompanyLibrary,
|
||||
VJobLibrary,
|
||||
VMarkAsNotSuitLog,
|
||||
]
|
||||
|
||||
export class AddColumnForMarkAsNotSuitLog1746092370665 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
await queryRunner.query(`DROP VIEW IF EXISTS "${viewMetadata.tableName}"`);
|
||||
}
|
||||
if (await queryRunner.hasTable("mark_as_not_suit_log")) {
|
||||
if (!await queryRunner.hasColumn("mark_as_not_suit_log", "markOp")) {
|
||||
await queryRunner.addColumn(
|
||||
"mark_as_not_suit_log",
|
||||
new TableColumn({
|
||||
name: "markOp",
|
||||
type: "number",
|
||||
isNullable: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
let expression = viewMetadata.expression;
|
||||
if (typeof expression === 'function') {
|
||||
expression = expression(dataSource).getQuery();
|
||||
}
|
||||
await queryRunner.query(`CREATE VIEW "${viewMetadata.tableName}" AS ${expression}`);
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { DataSource, MigrationInterface, QueryRunner, TableColumn } from "typeorm"
|
||||
import { VBossLibrary } from "../entity/VBossLibrary";
|
||||
import { VChatStartupLog } from "../entity/VChatStartupLog";
|
||||
import { VCompanyLibrary } from "../entity/VCompanyLibrary";
|
||||
import { VJobLibrary } from "../entity/VJobLibrary";
|
||||
import { VMarkAsNotSuitLog } from "../entity/VMarkAsNotSuitLog";
|
||||
import { JobSource } from "../enums";
|
||||
|
||||
const ViewEntities = [
|
||||
VBossLibrary,
|
||||
VChatStartupLog,
|
||||
VCompanyLibrary,
|
||||
VJobLibrary,
|
||||
VMarkAsNotSuitLog,
|
||||
]
|
||||
export class AddJobSourceColumnForChatStartupLogAndMarkAsNotSuitLog1752380078526 implements MigrationInterface {
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
await queryRunner.query(`DROP VIEW IF EXISTS "${viewMetadata.tableName}"`);
|
||||
}
|
||||
if (await queryRunner.hasTable("mark_as_not_suit_log")) {
|
||||
if (!await queryRunner.hasColumn("mark_as_not_suit_log", "jobSource")) {
|
||||
await queryRunner.addColumn(
|
||||
"mark_as_not_suit_log",
|
||||
new TableColumn({
|
||||
name: "jobSource",
|
||||
type: "number",
|
||||
isNullable: true,
|
||||
})
|
||||
);
|
||||
await queryRunner.query(`UPDATE mark_as_not_suit_log SET jobSource=?`, [JobSource.expect]);
|
||||
}
|
||||
}
|
||||
if (await queryRunner.hasTable("chat_startup_log")) {
|
||||
if (!await queryRunner.hasColumn("chat_startup_log", "jobSource")) {
|
||||
await queryRunner.addColumn(
|
||||
"chat_startup_log",
|
||||
new TableColumn({
|
||||
name: "jobSource",
|
||||
type: "number",
|
||||
isNullable: true,
|
||||
})
|
||||
);
|
||||
await queryRunner.query(`UPDATE chat_startup_log SET jobSource=?`, [JobSource.expect]);
|
||||
}
|
||||
}
|
||||
for (const EntityDefinition of ViewEntities) {
|
||||
const dataSource = queryRunner.connection as DataSource;
|
||||
const viewMetadata = dataSource.getMetadata(EntityDefinition);
|
||||
let expression = viewMetadata.expression;
|
||||
if (typeof expression === 'function') {
|
||||
expression = expression(dataSource).getQuery();
|
||||
}
|
||||
await queryRunner.query(`CREATE VIEW "${viewMetadata.tableName}" AS ${expression}`);
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
import * as path from 'node:path';
|
||||
const isRunFromUi = Boolean(process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE)
|
||||
const isUiDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
export function requireTypeorm () {
|
||||
const importResult = require('typeorm')
|
||||
return importResult
|
||||
|
||||
@@ -3,7 +3,7 @@ import { defineConfig, externalizeDepsPlugin, loadEnv } from 'electron-vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import UnoCSS from 'unocss/vite'
|
||||
import { presetUno, presetAttributify, presetIcons } from 'unocss'
|
||||
import transformerDirective from "@unocss/transformer-directives";
|
||||
import transformerDirective from '@unocss/transformer-directives'
|
||||
import Replace from 'unplugin-replace/vite'
|
||||
|
||||
process.env = { ...process.env, ...loadEnv(process.env.NODE_ENV!, process.cwd()) }
|
||||
@@ -13,11 +13,17 @@ export default defineConfig({
|
||||
rollupOptions: {
|
||||
external: []
|
||||
},
|
||||
minify: 'terser'
|
||||
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
||||
},
|
||||
plugins: [
|
||||
externalizeDepsPlugin({
|
||||
exclude: ['@geekgeekrun/geek-auto-start-chat-with-boss', '@geekgeekrun/dingtalk-plugin', '@geekgeekrun/utils', 'find-chrome-bin', '@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension']
|
||||
exclude: [
|
||||
'@geekgeekrun/geek-auto-start-chat-with-boss',
|
||||
'@geekgeekrun/dingtalk-plugin',
|
||||
'@geekgeekrun/utils',
|
||||
'find-chrome-bin',
|
||||
'@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension'
|
||||
]
|
||||
}),
|
||||
Replace({
|
||||
delimiters: ['', ''],
|
||||
@@ -26,11 +32,11 @@ export default defineConfig({
|
||||
values: [
|
||||
{
|
||||
find: /<measurement_id>/g,
|
||||
replacement: process.env.VITE_APP_GTAG_MEASUREMENT_ID as string,
|
||||
replacement: process.env.VITE_APP_GTAG_MEASUREMENT_ID as string
|
||||
},
|
||||
{
|
||||
find: /<api_secret>/g,
|
||||
replacement: process.env.VITE_APP_GTAG_API_SECRET as string,
|
||||
replacement: process.env.VITE_APP_GTAG_API_SECRET as string
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -39,7 +45,7 @@ export default defineConfig({
|
||||
preload: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
build: {
|
||||
minify: 'terser'
|
||||
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
||||
}
|
||||
},
|
||||
renderer: {
|
||||
@@ -52,11 +58,11 @@ export default defineConfig({
|
||||
vue(),
|
||||
UnoCSS({
|
||||
presets: [presetUno(), presetAttributify(), presetIcons()],
|
||||
transformers: [transformerDirective()],
|
||||
transformers: [transformerDirective()]
|
||||
})
|
||||
],
|
||||
build: {
|
||||
minify: 'terser'
|
||||
minify: process.env.NODE_ENV === 'development' ? undefined : 'terser'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "geekgeekrun-ui",
|
||||
"version": "0.3.1",
|
||||
"version": "0.9.4",
|
||||
"description": "Boss 炸弹 - 自动开聊Boss,助力每位打工人求职!",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "geekgeekrun",
|
||||
@@ -38,10 +38,15 @@
|
||||
"JSONStream": "^1.3.5",
|
||||
"diff": "^7.0.0",
|
||||
"electron-updater": "^6.1.7",
|
||||
"lodash-es": "^4.17.21",
|
||||
"minimist": "^1.2.8",
|
||||
"mitt": "^3.0.1",
|
||||
"node-machine-id": "^1.1.12",
|
||||
"pinia": "^3.0.2",
|
||||
"puppeteer": "20.1.0",
|
||||
"puppeteer-extra-plugin-stealth": "2.11.2"
|
||||
"puppeteer-extra-plugin-stealth": "2.11.2",
|
||||
"uuid": "^11.1.0",
|
||||
"vuedraggable": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-toolkit/eslint-config": "^1.0.2",
|
||||
@@ -63,15 +68,15 @@
|
||||
"electron": "28.2.0",
|
||||
"electron-builder": "^24.9.1",
|
||||
"electron-vite": "^2.0.0",
|
||||
"element-plus": "^2.5.5",
|
||||
"element-plus": "^2.8.4",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-vue": "^9.20.1",
|
||||
"find-chrome-bin": "^2.0.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"normalize.css": "^8.0.1",
|
||||
"prettier": "^3.2.4",
|
||||
"sass": "^1.70.0",
|
||||
"spark-md5": "^3.0.2",
|
||||
"terser": "^5.37.0",
|
||||
"typescript": "^5.3.3",
|
||||
"unocss": "^0.58.5",
|
||||
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": "0.3.1",
|
||||
"buildVersion": 7,
|
||||
"buildTime": 1736688071781,
|
||||
"buildHash": "537208b855436d26e6f9f5e396b05360b57cb0b4",
|
||||
"version": "0.9.4",
|
||||
"buildVersion": 20,
|
||||
"buildTime": 1760377927509,
|
||||
"buildHash": "51ca5dd71d62de2965fb53cff9d03c0d3552eabb",
|
||||
"name": "geekgeekrun-ui"
|
||||
}
|
||||
1
packages/ui/src/common/constant.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const SINGLE_ITEM_DEFAULT_SERVE_WEIGHT = 1
|
||||
7492
packages/ui/src/common/constant/cityGroup.json
Normal file
@@ -8,3 +8,13 @@ export enum AUTO_CHAT_ERROR_EXIT_CODE {
|
||||
AUTO_START_CHAT_DAEMON_PROCESS_SUICIDE = 86,
|
||||
AUTO_START_CHAT_MAIN_PROCESS_SUICIDE = 87,
|
||||
}
|
||||
|
||||
export enum RECHAT_CONTENT_SOURCE {
|
||||
LOOK_FORWARD_EMOTION = 1,
|
||||
GEMINI_WITH_CHAT_CONTEXT = 2
|
||||
}
|
||||
|
||||
export enum RECHAT_LLM_FALLBACK {
|
||||
SEND_LOOK_FORWARD_EMOTION = 1,
|
||||
EXIT_REMINDER_PROGRAM = 2
|
||||
}
|
||||
|
||||
7
packages/ui/src/common/types/update.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export interface NewReleaseInfo {
|
||||
releaseVersion: string
|
||||
releasePageUrl: string
|
||||
assetUrl: string
|
||||
assetName: string
|
||||
releaseNote: string
|
||||
}
|
||||
9
packages/ui/src/common/utils/chat-list.ts
Normal file
@@ -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
|
||||
)
|
||||
}
|
||||
91
packages/ui/src/common/utils/resume.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
export interface ResumeContent {
|
||||
name: string
|
||||
workYearDesc: string
|
||||
expectJob: string
|
||||
userDescription: string
|
||||
geekWorkExpList: Array<{
|
||||
company: string
|
||||
positionName: string
|
||||
startYearMon: string | null
|
||||
endYearMon: string | null
|
||||
performance: string
|
||||
workDescription: string
|
||||
}>
|
||||
geekProjExpList: Array<{
|
||||
name: string
|
||||
startYearMon: string
|
||||
endYearMon: string
|
||||
roleName: string
|
||||
projectDescription: string
|
||||
performance: string
|
||||
}>
|
||||
expectSalary: [string, string]
|
||||
}
|
||||
|
||||
export function formatResumeJsonToMarkdown(resume) {
|
||||
const basicInfoText = [
|
||||
['# 姓名', resume.content.name],
|
||||
['# 工作年限', resume.content.workYearDesc],
|
||||
['# 期望职位', resume.content.expectJob],
|
||||
['# 个人优势', resume.content.userDescription]
|
||||
]
|
||||
.filter((it) => {
|
||||
return Boolean(it[1]?.trim())
|
||||
})
|
||||
.map((it) => it.join('\n'))
|
||||
.join('\n\n')
|
||||
|
||||
let formattedWorkExpText = resume.content.geekWorkExpList
|
||||
.filter((it) => Boolean(it.company?.trim()))
|
||||
.map((it) => {
|
||||
const info = [
|
||||
[`职务`, it.positionName],
|
||||
[`任职时间`],
|
||||
[`工作描述`, it.workDescription],
|
||||
[`工作业绩`, it.performance]
|
||||
].filter((it) => {
|
||||
return Boolean(it[1]?.trim())
|
||||
})
|
||||
return [[`## ${it.company}`], ...info].map((it) => it.join('\n')).join('\n\n')
|
||||
})
|
||||
.join('\n')
|
||||
if (formattedWorkExpText?.trim()) {
|
||||
formattedWorkExpText = '# 工作经历\n' + formattedWorkExpText
|
||||
}
|
||||
|
||||
let formattedProjWorkExpText = resume.content.geekProjExpList
|
||||
.filter((it) => Boolean(it.name?.trim()))
|
||||
.map((it) => {
|
||||
const info = [
|
||||
[`## ${it.name}`],
|
||||
[`项目角色`, it.roleName],
|
||||
[`项目时间`],
|
||||
[`工作描述`, it.projectDescription],
|
||||
[`工作业绩`, it.performance]
|
||||
].filter((it) => {
|
||||
return Boolean(it[1]?.trim())
|
||||
})
|
||||
|
||||
return [[`## ${it.name}`], ...info].map((it) => it.join('\n')).join('\n\n')
|
||||
})
|
||||
.join('\n')
|
||||
if (formattedProjWorkExpText?.trim()) {
|
||||
formattedProjWorkExpText = '# 项目经历\n' + formattedProjWorkExpText
|
||||
}
|
||||
|
||||
const result = `${basicInfoText}\n\n${formattedWorkExpText}\n\n${formattedProjWorkExpText}`
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
export function checkIsResumeContentValid(resumeItem: { content: ResumeContent }) {
|
||||
return (
|
||||
!!resumeItem?.content &&
|
||||
resumeItem.content.geekProjExpList?.[0]?.name?.trim() &&
|
||||
resumeItem.content.geekWorkExpList?.[0]?.company?.trim()
|
||||
)
|
||||
}
|
||||
|
||||
export function resumeContentEnoughDetect(resumeItem: { content: ResumeContent }) {
|
||||
return resumeItem?.content && formatResumeJsonToMarkdown(resumeItem)?.length > 800
|
||||
}
|
||||
22
packages/ui/src/main/features/llm-request-log.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { saveGptCompletionRequestRecord } from '@geekgeekrun/sqlite-plugin/dist/handlers'
|
||||
|
||||
export enum RequestSceneEnum {
|
||||
testing = 1,
|
||||
readNoReplyAutoReminder = 2,
|
||||
geekAutoStartChatWithBoss = 3
|
||||
}
|
||||
|
||||
let dbInitPromise
|
||||
export const recordGptCompletionRequest = async (payload) => {
|
||||
const { getPublicDbFilePath } = await import(
|
||||
'@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||
)
|
||||
const { initDb } = await import('@geekgeekrun/sqlite-plugin')
|
||||
|
||||
if (!dbInitPromise) {
|
||||
dbInitPromise = initDb(getPublicDbFilePath())
|
||||
}
|
||||
const ds = await dbInitPromise
|
||||
const o = { ...payload }
|
||||
await saveGptCompletionRequestRecord(ds, [o])
|
||||
}
|
||||
103
packages/ui/src/main/features/updater.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import semver from 'semver'
|
||||
import packageJson from '../../../package.json'
|
||||
import os from 'node:os'
|
||||
import gtag from '../utils/gtag'
|
||||
import { NewReleaseInfo } from '../../common/types/update'
|
||||
|
||||
export const currentOsPlatform = os.platform()
|
||||
const RELEASE_LIST_URL = `https://api.github.com/repos/geekgeekrun/geekgeekrun/releases`
|
||||
|
||||
export interface GitHubReleaseItem {
|
||||
tag_name: string
|
||||
prerelease: boolean
|
||||
draft: boolean
|
||||
html_url: string
|
||||
body: string
|
||||
assets: Array<{
|
||||
browser_download_url: string
|
||||
name: string
|
||||
}>
|
||||
}
|
||||
|
||||
// find by arch, appendix
|
||||
function findTargetAsset(
|
||||
assets: GitHubReleaseItem['assets']
|
||||
): null | GitHubReleaseItem['assets'][number] {
|
||||
let assetsFilteredByPlatform: GitHubReleaseItem['assets'] = []
|
||||
switch (os.platform()) {
|
||||
case 'win32': {
|
||||
assetsFilteredByPlatform = assets.filter((it) => it.name.endsWith('.exe'))
|
||||
break
|
||||
}
|
||||
case 'darwin': {
|
||||
assetsFilteredByPlatform = assets.filter((it) => it.name.endsWith('.dmg'))
|
||||
break
|
||||
}
|
||||
case 'linux': {
|
||||
assetsFilteredByPlatform = assets.filter((it) => it.name.endsWith('.deb'))
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!assetsFilteredByPlatform?.length) {
|
||||
return null
|
||||
}
|
||||
if (assetsFilteredByPlatform.length === 1) {
|
||||
return assetsFilteredByPlatform[0]
|
||||
}
|
||||
let targetAsset
|
||||
if (os.platform() === 'darwin') {
|
||||
targetAsset = assetsFilteredByPlatform.find((it) => it.name.includes(`_${os.arch()}`))
|
||||
}
|
||||
return targetAsset
|
||||
}
|
||||
|
||||
export const checkUpdateForUi = async (): Promise<NewReleaseInfo | null> => {
|
||||
let releaseList: GitHubReleaseItem[] = []
|
||||
try {
|
||||
const headers = new Headers()
|
||||
headers.append('Accept', 'application/vnd.github+json')
|
||||
headers.append('X-GitHub-Api-Version', '2022-11-28')
|
||||
await fetch(RELEASE_LIST_URL, {
|
||||
method: 'GET',
|
||||
headers: headers,
|
||||
redirect: 'follow'
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (Array.isArray(res)) {
|
||||
releaseList = res
|
||||
} else {
|
||||
throw res
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
gtag('check_update_error', { err: JSON.stringify(err) })
|
||||
console.log(err)
|
||||
}
|
||||
console.log(releaseList)
|
||||
const availableRelease = releaseList.find((it) => !it.draft && !it.prerelease)
|
||||
if (!availableRelease) {
|
||||
return null
|
||||
}
|
||||
const availableReleaseVersion = availableRelease.tag_name.replace(/^(ui-v)/, '')
|
||||
if (!semver.gt(availableReleaseVersion, packageJson.version)) {
|
||||
return null
|
||||
}
|
||||
const { assets } = availableRelease
|
||||
const targetAsset = findTargetAsset(assets ?? [])
|
||||
if (targetAsset) {
|
||||
gtag('update_found', {
|
||||
currentVersion: packageJson.version,
|
||||
newVersion: availableReleaseVersion
|
||||
})
|
||||
console.log(targetAsset)
|
||||
return {
|
||||
releaseVersion: availableReleaseVersion,
|
||||
releasePageUrl: availableRelease.html_url,
|
||||
assetUrl: targetAsset.browser_download_url,
|
||||
assetName: targetAsset.name,
|
||||
releaseNote: availableRelease.body
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -33,6 +33,13 @@ export const getLastUsedAndAvailableBrowser = async (): Promise<BrowserInfo | nu
|
||||
await removeLastUsedAndAvailableBrowserPath()
|
||||
return null
|
||||
}
|
||||
|
||||
// blacklist browser
|
||||
if (path.includes(`Microsoft\\Edge\\Application\\msedge.exe`)) {
|
||||
await removeLastUsedAndAvailableBrowserPath()
|
||||
return null
|
||||
}
|
||||
|
||||
return {
|
||||
executablePath: path,
|
||||
browser
|
||||
|
||||
@@ -8,12 +8,10 @@ import {
|
||||
getLastUsedAndAvailableBrowser,
|
||||
removeLastUsedAndAvailableBrowserPath
|
||||
} from '../browser-history'
|
||||
import { getExecutableFileVersion } from '@geekgeekrun/utils/windows-only/file.mjs'
|
||||
import gtag from '../../../../utils/gtag'
|
||||
|
||||
const getPuppeteerManagerModule = async () => {
|
||||
let puppeteerManager
|
||||
puppeteerManager = await import('@puppeteer/browsers')
|
||||
const puppeteerManager = await import('@puppeteer/browsers')
|
||||
|
||||
return puppeteerManager
|
||||
}
|
||||
@@ -76,7 +74,8 @@ export const checkAndDownloadPuppeteerExecutable = async (
|
||||
browser: puppeteerManager.Browser.CHROME,
|
||||
cacheDir,
|
||||
buildId: EXPECT_CHROMIUM_BUILD_ID,
|
||||
downloadProgressCallback: options.downloadProgressCallback
|
||||
downloadProgressCallback: options.downloadProgressCallback,
|
||||
baseUrl: `https://registry.npmmirror.com/-/binary/chrome-for-testing`
|
||||
})
|
||||
} else {
|
||||
gtag('use_installed_browser')
|
||||
@@ -128,33 +127,8 @@ export const getAnyAvailablePuppeteerExecutable = async (): Promise<BrowserInfo
|
||||
|
||||
export async function findAndLocateUserInstalledChromiumExecutableSync(): Promise<BrowserInfo> {
|
||||
const exceptChromiumMainVersion = Number(EXPECT_CHROMIUM_BUILD_ID.split('.')[0])
|
||||
// For windows, try to find Edge(chromium)
|
||||
if (os.platform() === 'win32') {
|
||||
// TODO: handle windows
|
||||
const edgeExecutableLocation = path.join(
|
||||
process.env['ProgramFiles(x86)']!,
|
||||
'Microsoft/Edge/Application',
|
||||
'msedge.exe'
|
||||
)
|
||||
if (fs.existsSync(edgeExecutableLocation)) {
|
||||
try {
|
||||
const version = await getExecutableFileVersion(edgeExecutableLocation)
|
||||
const mainVersion = Number(version.split('.')[0])
|
||||
if (mainVersion >= exceptChromiumMainVersion) {
|
||||
return {
|
||||
executablePath: edgeExecutableLocation,
|
||||
browser: `Edge ${version}`
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For other, use findChrome
|
||||
let findChrome: typeof import('find-chrome-bin').findChrome
|
||||
findChrome = (await import('find-chrome-bin')).findChrome
|
||||
const findChrome: typeof import('find-chrome-bin').findChrome = (await import('find-chrome-bin'))
|
||||
.findChrome
|
||||
const targetBrowser = await findChrome({
|
||||
min: exceptChromiumMainVersion
|
||||
})
|
||||
|
||||
@@ -25,14 +25,10 @@ function runWithDaemon({ runRecordId, runMode, parentProcessPipe }) {
|
||||
const subProcessOfCore = childProcess.spawn(
|
||||
process.argv[0],
|
||||
isUiDev
|
||||
? [...process.argv.slice(1), `--run-record-id=${runRecordId}`]
|
||||
: [`--run-record-id=${runRecordId}`],
|
||||
? [process.argv[1], `--run-record-id=${runRecordId}`, `--mode=${runMode}`]
|
||||
: [`--run-record-id=${runRecordId}`, `--mode=${runMode}`],
|
||||
{
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'ipc'],
|
||||
env: {
|
||||
...process.env,
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: runMode
|
||||
}
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'ipc']
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -86,13 +86,15 @@ const runAutoChat = async () => {
|
||||
pageLoaded: new SyncHook(),
|
||||
cookieWillSet: new SyncHook(['cookies']),
|
||||
userInfoResponse: new AsyncSeriesHook(['userInfo']),
|
||||
mainFlowWillLaunch: new AsyncSeriesHook(['args']),
|
||||
jobDetailIsGetFromRecommendList: new AsyncSeriesHook(['userInfo']),
|
||||
newChatWillStartup: new AsyncSeriesHook(['positionInfoDetail']),
|
||||
newChatStartup: new AsyncSeriesHook(['positionInfoDetail', 'chatRunningContext']),
|
||||
jobMarkedAsNotSuit: new AsyncSeriesHook(['positionInfoDetail', 'markDetail']),
|
||||
noPositionFoundForCurrentJob: new SyncHook(),
|
||||
noPositionFoundAfterTraverseAllJob: new SyncHook(),
|
||||
errorEncounter: new SyncHook(['errorInfo'])
|
||||
errorEncounter: new SyncHook(['errorInfo']),
|
||||
encounterEmptyRecommendJobList: new AsyncSeriesHook(['args'])
|
||||
}
|
||||
initPlugins(hooks)
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { app } from 'electron'
|
||||
import { initPuppeteer } from '@geekgeekrun/geek-auto-start-chat-with-boss/index.mjs'
|
||||
import extractZip from 'extract-zip'
|
||||
import {
|
||||
readStorageFile,
|
||||
writeStorageFile
|
||||
} from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||
import {
|
||||
RECOMMEND_JOB_ENTRY_SELECTOR,
|
||||
USER_SET_EXPECT_JOB_ENTRIES_SELECTOR,
|
||||
} from '@geekgeekrun/geek-auto-start-chat-with-boss/constant.mjs'
|
||||
import { setDomainLocalStorage } from '@geekgeekrun/utils/puppeteer/local-storage.mjs'
|
||||
import {
|
||||
saveJobInfoFromRecommendPage,
|
||||
@@ -14,13 +17,9 @@ import {
|
||||
} from '@geekgeekrun/sqlite-plugin/dist/handlers'
|
||||
import { initDb } from '@geekgeekrun/sqlite-plugin'
|
||||
import { getPublicDbFilePath } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||
import { MarkAsNotSuitReason } from '@geekgeekrun/sqlite-plugin/dist/enums'
|
||||
import { MarkAsNotSuitReason, JobSource } from '@geekgeekrun/sqlite-plugin/dist/enums'
|
||||
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import url from 'url'
|
||||
import packageJson from '@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension/package.json' assert { type: 'json' }
|
||||
import { Target } from 'puppeteer'
|
||||
import { pipeWriteRegardlessError } from '../utils/pipe'
|
||||
import * as JSONStream from 'JSONStream'
|
||||
@@ -29,39 +28,13 @@ import gtag from '../../utils/gtag'
|
||||
import attachListenerForKillSelfOnParentExited from '../../utils/attachListenerForKillSelfOnParentExited'
|
||||
import { type ChatMessageRecord } from '@geekgeekrun/sqlite-plugin/src/entity/ChatMessageRecord'
|
||||
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 isRunFromUi = Boolean(process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE)
|
||||
import {
|
||||
ensureEditThisCookie,
|
||||
editThisCookieExtensionPath
|
||||
} from '@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension/utils.mjs'
|
||||
|
||||
const runtimeFolderPath = path.join(os.homedir(), '.geekgeekrun')
|
||||
const extensionDir = path.join(runtimeFolderPath, 'chrome-extensions')
|
||||
if (!fs.existsSync(runtimeFolderPath)) {
|
||||
fs.mkdirSync(runtimeFolderPath)
|
||||
}
|
||||
if (!fs.existsSync(extensionDir)) {
|
||||
fs.mkdirSync(extensionDir)
|
||||
}
|
||||
const editThisCookieExtensionPath = path.join(extensionDir, 'EditThisCookie')
|
||||
|
||||
let editThisCookieZipPath
|
||||
async function getEditThisCookieZipPath() {
|
||||
if (editThisCookieZipPath) {
|
||||
return editThisCookieZipPath
|
||||
}
|
||||
if (isRunFromUi) {
|
||||
const { app } = await import('electron')
|
||||
editThisCookieZipPath = path.join(
|
||||
app.getAppPath(),
|
||||
'./node_modules',
|
||||
packageJson.name,
|
||||
'extensions',
|
||||
'EditThisCookie.zip'
|
||||
)
|
||||
} else {
|
||||
editThisCookieZipPath = path.join(__dirname, 'extensions', 'EditThisCookie.zip')
|
||||
}
|
||||
return editThisCookieZipPath
|
||||
}
|
||||
const dbInitPromise = initDb(getPublicDbFilePath())
|
||||
|
||||
const attachRequestsListener = async (target: Target) => {
|
||||
@@ -69,6 +42,49 @@ const attachRequestsListener = async (target: Target) => {
|
||||
if (!page) {
|
||||
return
|
||||
}
|
||||
async function getCurrentJobSource() {
|
||||
const methodMap = {
|
||||
async recommend() {
|
||||
return await page.evaluate(
|
||||
({ RECOMMEND_JOB_ENTRY_SELECTOR }) => {
|
||||
return document.querySelector(RECOMMEND_JOB_ENTRY_SELECTOR).classList.contains('active')
|
||||
},
|
||||
{
|
||||
RECOMMEND_JOB_ENTRY_SELECTOR
|
||||
}
|
||||
)
|
||||
},
|
||||
async expect() {
|
||||
return await page.evaluate(
|
||||
({ USER_SET_EXPECT_JOB_ENTRIES_SELECTOR }) => {
|
||||
return [...document.querySelectorAll(USER_SET_EXPECT_JOB_ENTRIES_SELECTOR)].some((el) =>
|
||||
el.classList.contains('active')
|
||||
)
|
||||
},
|
||||
{
|
||||
USER_SET_EXPECT_JOB_ENTRIES_SELECTOR
|
||||
}
|
||||
)
|
||||
},
|
||||
async search() {
|
||||
const elHandle = await page.$(`.page-jobs-main`)
|
||||
const currentKeyWord = await elHandle?.evaluate((el) => {
|
||||
return el?.__vue__?.formData?.query
|
||||
})
|
||||
return !!currentKeyWord
|
||||
}
|
||||
}
|
||||
for (const [type, func] of Object.entries(methodMap)) {
|
||||
try {
|
||||
if (await func()) {
|
||||
return type
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('encounter error when get job source')
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
page.on('response', async (response) => {
|
||||
if (response.url().startsWith('https://www.zhipin.com/wapi/zpgeek/job/detail.json')) {
|
||||
@@ -90,7 +106,7 @@ const attachRequestsListener = async (target: Target) => {
|
||||
}
|
||||
await writeStorageFile('job-not-suit-reason-code-to-text-cache.json', reasonCodeToTextMap)
|
||||
} else if (
|
||||
page.url().startsWith('https://www.zhipin.com/web/geek/job-recommend') &&
|
||||
page.url().startsWith('https://www.zhipin.com/web/geek/jobs') &&
|
||||
response.url().startsWith('https://www.zhipin.com/wapi/zpgeek/negativefeedback/save.json')
|
||||
) {
|
||||
const currentJobData = await page.evaluate(
|
||||
@@ -112,7 +128,7 @@ const attachRequestsListener = async (target: Target) => {
|
||||
const reasonCodeToTextMap = await readStorageFile(
|
||||
'job-not-suit-reason-code-to-text-cache.json'
|
||||
)
|
||||
|
||||
const jobSource = await getCurrentJobSource()
|
||||
const markDetail = {
|
||||
markFrom: ChatStartupFrom.ManuallyFromRecommendList,
|
||||
extInfo: {
|
||||
@@ -121,9 +137,15 @@ const attachRequestsListener = async (target: Target) => {
|
||||
text: reasonCodeToTextMap[chosenCode]
|
||||
}
|
||||
},
|
||||
markReason: MarkAsNotSuitReason.USER_MANUAL_OPERATION_WITH_UNKNOWN_REASON
|
||||
markReason: MarkAsNotSuitReason.USER_MANUAL_OPERATION_WITH_UNKNOWN_REASON,
|
||||
jobSource: JobSource[jobSource]
|
||||
}
|
||||
gtag('job_marked_as_not_suit', { markFrom: markDetail.markFrom })
|
||||
gtag('job_marked_as_not_suit', {
|
||||
markFrom: markDetail.markFrom,
|
||||
bossActiveTimeDesc: currentJobData?.bossInfo?.activeTimeDesc,
|
||||
encryptJobId: currentJobData?.jobInfo?.encryptId,
|
||||
jobSource: JobSource[jobSource]
|
||||
})
|
||||
if (reasonCodeToTextMap[chosenCode]?.includes('活跃度低')) {
|
||||
markDetail.markReason = MarkAsNotSuitReason.BOSS_INACTIVE
|
||||
markDetail.extInfo.bossActiveTimeDesc = currentJobData?.bossInfo.activeTimeDesc
|
||||
@@ -137,7 +159,7 @@ const attachRequestsListener = async (target: Target) => {
|
||||
markDetail
|
||||
)
|
||||
} else if (
|
||||
page.url().startsWith('https://www.zhipin.com/web/geek/job-recommend') &&
|
||||
page.url().startsWith('https://www.zhipin.com/web/geek/jobs') &&
|
||||
response.url().startsWith('https://www.zhipin.com/wapi/zpgeek/friend/add.json')
|
||||
) {
|
||||
const request = response.request().url()
|
||||
@@ -158,7 +180,12 @@ const attachRequestsListener = async (target: Target) => {
|
||||
const currentUserInfo = await page.evaluate(
|
||||
'document.querySelector(".job-detail-box").__vue__.$store.state.userInfo'
|
||||
)
|
||||
gtag('new_chat_startup', { chatStartupFrom: ChatStartupFrom.ManuallyFromRecommendList })
|
||||
const jobSource = await getCurrentJobSource()
|
||||
gtag('new_chat_startup', {
|
||||
chatStartupFrom: ChatStartupFrom.ManuallyFromRecommendList,
|
||||
encryptJobId: currentJobData?.jobInfo?.encryptId,
|
||||
jobSource: JobSource[jobSource]
|
||||
})
|
||||
await saveChatStartupRecord(
|
||||
await dbInitPromise,
|
||||
currentJobData,
|
||||
@@ -166,7 +193,8 @@ const attachRequestsListener = async (target: Target) => {
|
||||
encryptUserId: currentUserInfo.encryptUserId
|
||||
},
|
||||
{
|
||||
chatStartupFrom: ChatStartupFrom.ManuallyFromRecommendList
|
||||
chatStartupFrom: ChatStartupFrom.ManuallyFromRecommendList,
|
||||
jobSource: JobSource[jobSource]
|
||||
}
|
||||
)
|
||||
} else if (
|
||||
@@ -181,9 +209,14 @@ const attachRequestsListener = async (target: Target) => {
|
||||
const url = new URL(request)
|
||||
const encryptBossIdInAddFriendUrl = url.searchParams.get('bossId')
|
||||
|
||||
const bossInfo: any = await page.evaluate(
|
||||
'document.querySelector(".chat-conversation").__vue__.bossInfo$'
|
||||
)
|
||||
const 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
|
||||
// save boss info
|
||||
const bossInfoRepository = ds.getRepository(BossInfo)
|
||||
@@ -206,16 +239,16 @@ const attachRequestsListener = async (target: Target) => {
|
||||
const rawChatRecordList =
|
||||
(
|
||||
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 mappedItem = {} as InstanceType<typeof ChatMessageRecord>
|
||||
mappedItem.mid = it.mid
|
||||
mappedItem.encryptFromUserId = it.style === 'sent' ? currentUserInfo.encryptUserId : it.style === 'received' ? bossInfo.encryptBossId : ''
|
||||
mappedItem.encryptToUserId = it.style === 'sent' ? bossInfo.encryptBossId: it.style === 'received' ? currentUserInfo.encryptUserId : ''
|
||||
mappedItem.style = it.style
|
||||
mappedItem.encryptFromUserId = it.isSelf ? currentUserInfo.encryptUserId : bossInfo.encryptBossId
|
||||
mappedItem.encryptToUserId = it.isSelf ? bossInfo.encryptBossId : currentUserInfo.encryptUserId
|
||||
mappedItem.style = it.isSelf ? 'sent' : 'received'
|
||||
mappedItem.type = it.type
|
||||
mappedItem.time = it.time ? new Date(it.time) : null
|
||||
mappedItem.text = it.text
|
||||
@@ -241,12 +274,7 @@ const attachRequestsListener = async (target: Target) => {
|
||||
|
||||
export async function launchBossSite() {
|
||||
app.dock?.hide()
|
||||
if (!fs.existsSync(path.join(editThisCookieExtensionPath, 'manifest.json'))) {
|
||||
await extractZip(await getEditThisCookieZipPath(), {
|
||||
dir: extensionDir
|
||||
})
|
||||
}
|
||||
|
||||
await ensureEditThisCookie()
|
||||
const bossCookies = readStorageFile('boss-cookies.json')
|
||||
const bossLocalStorage = readStorageFile('boss-local-storage.json')
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { createMainWindow } from '../../window/mainWindow'
|
||||
import './app-menu'
|
||||
import initIpc from './ipc'
|
||||
import gtag from '../../utils/gtag'
|
||||
import initPublicIpc from '../../utils/initPublicIpc'
|
||||
export function openSettingWindow() {
|
||||
// TODO: singleton lock; how can we check if there is another process should run as singleton with arguments?
|
||||
if (!app.requestSingleInstanceLock()) {
|
||||
@@ -31,6 +32,7 @@ export function openSettingWindow() {
|
||||
|
||||
// IPC test
|
||||
ipcMain.on('ping', () => console.log('pong'))
|
||||
initPublicIpc()
|
||||
initIpc()
|
||||
|
||||
app.on('activate', function () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ipcMain, shell, app } from 'electron'
|
||||
|
||||
import path from 'path'
|
||||
import * as childProcess from 'node:child_process'
|
||||
import {
|
||||
ensureConfigFileExist,
|
||||
@@ -8,7 +8,8 @@ import {
|
||||
readConfigFile,
|
||||
writeConfigFile,
|
||||
readStorageFile,
|
||||
writeStorageFile
|
||||
writeStorageFile,
|
||||
storageFilePath
|
||||
} from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||
import { ChildProcess } from 'child_process'
|
||||
import * as JSONStream from 'JSONStream'
|
||||
@@ -30,14 +31,29 @@ import { pipeWriteRegardlessError } from '../../utils/pipe'
|
||||
import { WriteStream } from 'node:fs'
|
||||
// eslint-disable-next-line vue/prefer-import-from-vue
|
||||
import { hasOwn } from '@vue/shared'
|
||||
import { createLlmConfigWindow, llmConfigWindow } from '../../../window/llmConfigWindow'
|
||||
import { createResumeEditorWindow, resumeEditorWindow } from '../../../window/resumeEditorWindow'
|
||||
import {
|
||||
getValidTemplate,
|
||||
requestNewMessageContent
|
||||
} from '../../READ_NO_REPLY_AUTO_REMINDER/boss-operation'
|
||||
import {
|
||||
autoReminderPromptTemplateFileName,
|
||||
writeDefaultAutoRemindPrompt
|
||||
} from '../../READ_NO_REPLY_AUTO_REMINDER/boss-operation'
|
||||
import {
|
||||
checkIsResumeContentValid,
|
||||
resumeContentEnoughDetect
|
||||
} from '../../../../common/utils/resume'
|
||||
import {
|
||||
createReadNoReplyReminderLlmMockWindow,
|
||||
readNoReplyReminderLlmMockWindow
|
||||
} from '../../../window/readNoReplyReminderLlmMockWindow'
|
||||
import { RequestSceneEnum } from '../../../features/llm-request-log'
|
||||
import { checkUpdateForUi } from '../../../features/updater'
|
||||
import gtag from '../../../utils/gtag'
|
||||
|
||||
export default function initIpc() {
|
||||
ipcMain.on('open-external-link', (_, link) => {
|
||||
shell.openExternal(link, {
|
||||
activate: true
|
||||
})
|
||||
})
|
||||
|
||||
ipcMain.handle('fetch-config-file-content', async () => {
|
||||
const configFileContentList = configFileNameList.map((fileName) => {
|
||||
return readConfigFile(fileName)
|
||||
@@ -69,12 +85,88 @@ export default function initIpc() {
|
||||
if (hasOwn(payload, 'anyCombineRecommendJobFilter')) {
|
||||
bossConfig.anyCombineRecommendJobFilter = payload.anyCombineRecommendJobFilter
|
||||
}
|
||||
if (hasOwn(payload, 'expectJobRegExpStr')) {
|
||||
bossConfig.expectJobRegExpStr = payload.expectJobRegExpStr
|
||||
delete bossConfig.expectJobRegExpStr
|
||||
if (hasOwn(payload, 'expectJobNameRegExpStr')) {
|
||||
bossConfig.expectJobNameRegExpStr = payload.expectJobNameRegExpStr
|
||||
}
|
||||
if (hasOwn(payload, 'expectJobTypeRegExpStr')) {
|
||||
bossConfig.expectJobTypeRegExpStr = payload.expectJobTypeRegExpStr
|
||||
}
|
||||
if (hasOwn(payload, 'expectJobDescRegExpStr')) {
|
||||
bossConfig.expectJobDescRegExpStr = payload.expectJobDescRegExpStr
|
||||
}
|
||||
if (hasOwn(payload, 'jobNotMatchStrategy')) {
|
||||
bossConfig.jobNotMatchStrategy = payload.jobNotMatchStrategy
|
||||
}
|
||||
if (hasOwn(payload, 'markAsNotActiveSelectedTimeRange')) {
|
||||
bossConfig.markAsNotActiveSelectedTimeRange = payload.markAsNotActiveSelectedTimeRange
|
||||
}
|
||||
if (hasOwn(payload, 'jobNotActiveStrategy')) {
|
||||
bossConfig.jobNotActiveStrategy = payload.jobNotActiveStrategy
|
||||
}
|
||||
if (hasOwn(payload, 'autoReminder')) {
|
||||
bossConfig.autoReminder = payload.autoReminder
|
||||
}
|
||||
|
||||
// city
|
||||
if (hasOwn(payload, 'expectCityList')) {
|
||||
bossConfig.expectCityList = payload.expectCityList
|
||||
}
|
||||
if (hasOwn(payload, 'expectCityNotMatchStrategy')) {
|
||||
bossConfig.expectCityNotMatchStrategy = payload.expectCityNotMatchStrategy
|
||||
}
|
||||
if (hasOwn(payload, 'strategyScopeOptionWhenMarkJobCityNotMatch')) {
|
||||
bossConfig.strategyScopeOptionWhenMarkJobCityNotMatch =
|
||||
payload.strategyScopeOptionWhenMarkJobCityNotMatch
|
||||
}
|
||||
|
||||
// salary
|
||||
if (hasOwn(payload, 'expectSalaryCalculateWay')) {
|
||||
bossConfig.expectSalaryCalculateWay = payload.expectSalaryCalculateWay
|
||||
}
|
||||
if (hasOwn(payload, 'expectSalaryNotMatchStrategy')) {
|
||||
bossConfig.expectSalaryNotMatchStrategy = payload.expectSalaryNotMatchStrategy
|
||||
}
|
||||
if (hasOwn(payload, 'strategyScopeOptionWhenMarkSalaryNotMatch')) {
|
||||
bossConfig.strategyScopeOptionWhenMarkSalaryNotMatch =
|
||||
payload.strategyScopeOptionWhenMarkSalaryNotMatch
|
||||
}
|
||||
if (hasOwn(payload, 'expectSalaryLow')) {
|
||||
bossConfig.expectSalaryLow = payload.expectSalaryLow
|
||||
}
|
||||
if (hasOwn(payload, 'expectSalaryHigh')) {
|
||||
bossConfig.expectSalaryHigh = payload.expectSalaryHigh
|
||||
}
|
||||
|
||||
// work exp
|
||||
if (hasOwn(payload, 'expectWorkExpList')) {
|
||||
bossConfig.expectWorkExpList = payload.expectWorkExpList
|
||||
}
|
||||
if (hasOwn(payload, 'expectWorkExpNotMatchStrategy')) {
|
||||
bossConfig.expectWorkExpNotMatchStrategy = payload.expectWorkExpNotMatchStrategy
|
||||
}
|
||||
if (hasOwn(payload, 'strategyScopeOptionWhenMarkJobWorkExpNotMatch')) {
|
||||
bossConfig.strategyScopeOptionWhenMarkJobWorkExpNotMatch =
|
||||
payload.strategyScopeOptionWhenMarkJobWorkExpNotMatch
|
||||
}
|
||||
if (hasOwn(payload, 'jobDetailRegExpMatchLogic')) {
|
||||
bossConfig.jobDetailRegExpMatchLogic = payload.jobDetailRegExpMatchLogic
|
||||
}
|
||||
if (hasOwn(payload, 'isSkipEmptyConditionForCombineRecommendJobFilter')) {
|
||||
bossConfig.isSkipEmptyConditionForCombineRecommendJobFilter =
|
||||
payload.isSkipEmptyConditionForCombineRecommendJobFilter
|
||||
}
|
||||
if (hasOwn(payload, 'jobSourceList')) {
|
||||
bossConfig.jobSourceList = payload.jobSourceList
|
||||
}
|
||||
if (hasOwn(payload, 'combineRecommendJobFilterType')) {
|
||||
bossConfig.combineRecommendJobFilterType = payload.combineRecommendJobFilterType
|
||||
}
|
||||
if (hasOwn(payload, 'staticCombineRecommendJobFilterConditions')) {
|
||||
bossConfig.staticCombineRecommendJobFilterConditions =
|
||||
payload.staticCombineRecommendJobFilterConditions
|
||||
}
|
||||
|
||||
promiseArr.push(writeConfigFile('boss.json', bossConfig))
|
||||
|
||||
if (hasOwn(payload, 'expectCompanies')) {
|
||||
@@ -119,12 +211,15 @@ export default function initIpc() {
|
||||
}
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'geekAutoStartWithBossDaemon',
|
||||
PUPPETEER_EXECUTABLE_PATH: puppeteerExecutable.executablePath
|
||||
}
|
||||
subProcessOfPuppeteer = childProcess.spawn(
|
||||
process.argv[0],
|
||||
[...process.argv.slice(1), '--mode-to-daemon=geekAutoStartWithBossMain'],
|
||||
[
|
||||
process.argv[1],
|
||||
`--mode=geekAutoStartWithBossDaemon`,
|
||||
`--mode-to-daemon=geekAutoStartWithBossMain`
|
||||
],
|
||||
{
|
||||
env: subProcessEnv,
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'ipc']
|
||||
@@ -173,13 +268,16 @@ export default function initIpc() {
|
||||
}
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'readNoReplyAutoReminder',
|
||||
PUPPETEER_EXECUTABLE_PATH: puppeteerExecutable.executablePath
|
||||
}
|
||||
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||
env: subProcessEnv,
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'ipc']
|
||||
})
|
||||
subProcessOfPuppeteer = childProcess.spawn(
|
||||
process.argv[0],
|
||||
[process.argv[1], `--mode=readNoReplyAutoReminder`],
|
||||
{
|
||||
env: subProcessEnv,
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'ipc']
|
||||
}
|
||||
)
|
||||
// console.log(subProcessOfPuppeteer)
|
||||
return new Promise((resolve, reject) => {
|
||||
subProcessOfPuppeteer!.stdio[3]!.pipe(JSONStream.parse()).on('data', async (raw) => {
|
||||
@@ -232,15 +330,10 @@ export default function initIpc() {
|
||||
if (subProcessOfCheckAndDownloadDependencies) {
|
||||
return
|
||||
}
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'checkAndDownloadDependenciesForInit'
|
||||
}
|
||||
subProcessOfCheckAndDownloadDependencies = childProcess.spawn(
|
||||
process.argv[0],
|
||||
process.argv.slice(1),
|
||||
[process.argv[1], `--mode=checkAndDownloadDependenciesForInit`],
|
||||
{
|
||||
env: subProcessEnv,
|
||||
stdio: [null, null, null, 'pipe', 'ipc']
|
||||
}
|
||||
)
|
||||
@@ -302,12 +395,11 @@ export default function initIpc() {
|
||||
}
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'launchBossZhipinLoginPageWithPreloadExtension',
|
||||
PUPPETEER_EXECUTABLE_PATH: (await getAnyAvailablePuppeteerExecutable())!.executablePath
|
||||
}
|
||||
subProcessOfBossZhipinLoginPageWithPreloadExtension = childProcess.spawn(
|
||||
process.argv[0],
|
||||
process.argv.slice(1),
|
||||
[process.argv[1], `--mode=launchBossZhipinLoginPageWithPreloadExtension`],
|
||||
{
|
||||
env: subProcessEnv,
|
||||
stdio: [null, null, null, 'pipe', 'ipc']
|
||||
@@ -383,13 +475,16 @@ export default function initIpc() {
|
||||
const puppeteerExecutable = await getAnyAvailablePuppeteerExecutable()
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'launchBossSite',
|
||||
PUPPETEER_EXECUTABLE_PATH: puppeteerExecutable!.executablePath
|
||||
}
|
||||
subProcessOfOpenBossSite = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||
env: subProcessEnv,
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe']
|
||||
})
|
||||
subProcessOfOpenBossSite = childProcess.spawn(
|
||||
process.argv[0],
|
||||
[process.argv[1], `--mode=launchBossSite`],
|
||||
{
|
||||
env: subProcessEnv,
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'pipe']
|
||||
}
|
||||
)
|
||||
subProcessOfOpenBossSite.once('exit', () => {
|
||||
subProcessOfOpenBossSiteDefer = null
|
||||
})
|
||||
@@ -435,6 +530,134 @@ export default function initIpc() {
|
||||
return await getJobHistoryByEncryptId(encryptJobId)
|
||||
})
|
||||
|
||||
ipcMain.handle('llm-config', async () => {
|
||||
createLlmConfigWindow({
|
||||
parent: mainWindow!,
|
||||
modal: true,
|
||||
show: true
|
||||
})
|
||||
const defer = Promise.withResolvers()
|
||||
async function saveLlmConfigHandler(_, configToSave) {
|
||||
await writeConfigFile('llm.json', configToSave)
|
||||
defer.resolve()
|
||||
ipcMain.removeHandler('save-llm-config')
|
||||
llmConfigWindow?.close()
|
||||
}
|
||||
ipcMain.handle('save-llm-config', saveLlmConfigHandler)
|
||||
llmConfigWindow?.once('closed', () => {
|
||||
ipcMain.removeHandler('save-llm-config')
|
||||
defer.reject(new Error('cancel'))
|
||||
})
|
||||
return defer.promise
|
||||
})
|
||||
ipcMain.on('close-llm-config', () => llmConfigWindow?.close())
|
||||
|
||||
ipcMain.handle('resume-edit', async () => {
|
||||
createResumeEditorWindow({
|
||||
parent: mainWindow!,
|
||||
modal: true,
|
||||
show: true
|
||||
})
|
||||
const defer = Promise.withResolvers()
|
||||
async function saveResumeHandler(_, resumeContent) {
|
||||
await writeConfigFile('resumes.json', [
|
||||
{
|
||||
name: '默认简历',
|
||||
updateTime: Number(new Date()),
|
||||
content: resumeContent
|
||||
}
|
||||
])
|
||||
defer.resolve()
|
||||
resumeEditorWindow?.close()
|
||||
}
|
||||
ipcMain.handle('save-resume-content', saveResumeHandler)
|
||||
resumeEditorWindow?.once('closed', () => {
|
||||
ipcMain.removeHandler('save-resume-content')
|
||||
defer.reject(new Error('cancel'))
|
||||
})
|
||||
|
||||
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) {
|
||||
await writeDefaultAutoRemindPrompt()
|
||||
}
|
||||
const filePath = path.join(storageFilePath, autoReminderPromptTemplateFileName)
|
||||
shell.openPath(filePath)
|
||||
})
|
||||
ipcMain.on('close-resume-editor', () => resumeEditorWindow?.close())
|
||||
ipcMain.handle('check-if-auto-remind-prompt-valid', async () => {
|
||||
await getValidTemplate()
|
||||
})
|
||||
ipcMain.handle('check-is-resume-content-valid', async () => {
|
||||
const res = (await readConfigFile('resumes.json'))?.[0]
|
||||
return checkIsResumeContentValid(res)
|
||||
})
|
||||
ipcMain.handle('resume-content-enough-detect', async () => {
|
||||
const res = (await readConfigFile('resumes.json'))?.[0]
|
||||
return resumeContentEnoughDetect(res)
|
||||
})
|
||||
ipcMain.handle('overwrite-auto-remind-prompt-with-default', async () => {
|
||||
await writeDefaultAutoRemindPrompt()
|
||||
})
|
||||
ipcMain.handle('check-if-llm-config-list-valid', async () => {
|
||||
const llmConfigList = await readConfigFile('llm.json')
|
||||
if (!Array.isArray(llmConfigList) || !llmConfigList?.length) {
|
||||
throw new Error('CANNOT_FIND_VALID_CONFIG')
|
||||
}
|
||||
if (llmConfigList.some((it) => !/^http(s)?:\/\//.test(it.providerCompleteApiUrl))) {
|
||||
throw new Error('CANNOT_FIND_VALID_CONFIG')
|
||||
}
|
||||
if (llmConfigList.length > 1) {
|
||||
const firstEnabledModel = llmConfigList.find((it) => it.enabled)
|
||||
if (!firstEnabledModel) {
|
||||
throw new Error('CANNOT_FIND_VALID_CONFIG')
|
||||
}
|
||||
}
|
||||
})
|
||||
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,
|
||||
llmConfigIdForPick: requestPayload.llmConfigIdForPick ?? null
|
||||
})
|
||||
}
|
||||
ipcMain.handle('request-llm-for-test', requestLlm)
|
||||
readNoReplyReminderLlmMockWindow?.once('closed', () => {
|
||||
ipcMain.removeHandler('request-llm-for-test')
|
||||
})
|
||||
async function getLlmConfigList() {
|
||||
return await readConfigFile('llm.json')
|
||||
}
|
||||
ipcMain.handle('get-llm-config-for-test', getLlmConfigList)
|
||||
readNoReplyReminderLlmMockWindow?.once('closed', () => {
|
||||
ipcMain.removeHandler('get-llm-config-for-test')
|
||||
})
|
||||
})
|
||||
ipcMain.on('close-read-no-reply-reminder-llm-mock-window', () => {
|
||||
readNoReplyReminderLlmMockWindow?.close()
|
||||
gtag('mock_chat_window_closed')
|
||||
})
|
||||
ipcMain.handle('check-update', async () => {
|
||||
const newRelease = await checkUpdateForUi()
|
||||
return newRelease
|
||||
})
|
||||
|
||||
ipcMain.handle('exit-app-immediately', () => {
|
||||
app.exit(0)
|
||||
})
|
||||
|
||||
@@ -47,7 +47,10 @@ const payloadHandler = {
|
||||
const [data, totalItemCount] = await measureExecutionTime(
|
||||
userRepository.findAndCount({
|
||||
skip: (pageNo - 1) * pageSize,
|
||||
take: pageSize
|
||||
take: pageSize,
|
||||
order: {
|
||||
date: 'DESC'
|
||||
}
|
||||
})
|
||||
)
|
||||
return {
|
||||
@@ -69,7 +72,10 @@ const payloadHandler = {
|
||||
const [data, totalItemCount] = await measureExecutionTime(
|
||||
recordRepository.findAndCount({
|
||||
skip: (pageNo - 1) * pageSize,
|
||||
take: pageSize
|
||||
take: pageSize,
|
||||
order: {
|
||||
date: 'DESC'
|
||||
}
|
||||
})
|
||||
)
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
import { Page } from 'puppeteer'
|
||||
import { sleepWithRandomDelay } from '@geekgeekrun/utils/sleep.mjs'
|
||||
import { sleepWithRandomDelay, sleep } from '@geekgeekrun/utils/sleep.mjs'
|
||||
import { completes } from '@geekgeekrun/utils/gpt-request.mjs'
|
||||
import { recordGptCompletionRequest, RequestSceneEnum } from '../../features/llm-request-log'
|
||||
import {
|
||||
readConfigFile,
|
||||
readStorageFile,
|
||||
writeStorageFile
|
||||
} from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||
import { formatResumeJsonToMarkdown } from '../../../common/utils/resume'
|
||||
import { SINGLE_ITEM_DEFAULT_SERVE_WEIGHT } from '../../../common/constant'
|
||||
import { LlmModelUsageRecord } from '@geekgeekrun/sqlite-plugin/dist/entity/LlmModelUsageRecord'
|
||||
import gtag from '../../utils/gtag'
|
||||
|
||||
export const sendLookForwardReplyEmotion = async (page: Page) => {
|
||||
const emotionEntryButtonProxy = await page.$('.chat-conversation .message-controls .btn-emotion')
|
||||
@@ -15,3 +26,241 @@ export const sendLookForwardReplyEmotion = async (page: Page) => {
|
||||
)
|
||||
await lookForwardReplyEmojiProxy!.click()
|
||||
}
|
||||
|
||||
const pickLlmConfigFromList = (llmConfigList, blockModelSet) => {
|
||||
if (llmConfigList.length === 1) {
|
||||
llmConfigList[0].enabled = true
|
||||
llmConfigList[0].serveWeight = SINGLE_ITEM_DEFAULT_SERVE_WEIGHT
|
||||
}
|
||||
llmConfigList = llmConfigList.filter((it) => it.enabled && !blockModelSet.has(it.id))
|
||||
if (!llmConfigList.length) {
|
||||
return null
|
||||
}
|
||||
llmConfigList.forEach((conf) => {
|
||||
if (!Number(conf.serveWeight) || conf.serveWeight < 1) {
|
||||
conf.serveWeight = 1
|
||||
}
|
||||
if (conf.serveWeight > 100) {
|
||||
conf.serveWeight = 100
|
||||
}
|
||||
})
|
||||
const pool: number[] = []
|
||||
for (let i = 0; i < llmConfigList.length; i++) {
|
||||
for (let j = 0; j < Math.floor(llmConfigList[i].serveWeight); j++) {
|
||||
pool.push(llmConfigList[i].id)
|
||||
}
|
||||
}
|
||||
if (!pool.length) {
|
||||
return null
|
||||
}
|
||||
const index = Math.floor(pool.length * Math.random())
|
||||
return llmConfigList.find((it) => it.id === pool[index]) ?? null
|
||||
}
|
||||
|
||||
// let _index = 0
|
||||
|
||||
const RESUME_PLACEHOLDER = `__REPLACE_REAL_RESUME_HERE__`
|
||||
const defaultPrompt = `**核心指令:**
|
||||
你是一个智能求职助手,需要根据用户简历生成30字左右的提醒消息,满足以下要求:
|
||||
1. 每次生成需满足:
|
||||
- √ 包含1个核心技能 + 1个成果量化
|
||||
- √ 使用不同句式模板(至少准备5种)
|
||||
- √ 谦虚一些,头衔、工作年限等在历史记录信息中出现一次就好
|
||||
- ✗ 严禁与最近发送的几条相似或雷同
|
||||
- ✗ 严禁出现简历之外的词语
|
||||
- ✗ 严禁包含最近8条已经发过的内容(包括但不限于职位名称)
|
||||
|
||||
**简历分析层:**
|
||||
请从以下简历内容中提取关键要素:\n\`\`\`markdown\n${RESUME_PLACEHOLDER}\n\`\`\`\n
|
||||
|
||||
---
|
||||
要求提取:
|
||||
1. 硬技能:编程语言/技术栈/工具证书等(至少提取5项)
|
||||
2. 项目经历与成果:业绩、带量化数据的结果(至少3条)
|
||||
3. 软技能:沟通/管理等(至少2项)
|
||||
4. 特殊成就:奖项/专利等(可选)
|
||||
|
||||
**消息生成层:**
|
||||
根据上述要素随机组合生成消息
|
||||
|
||||
**质量控制层:**
|
||||
每次生成前执行:
|
||||
1. 检查历史记录
|
||||
2. 确保技能/成果组合未重复
|
||||
3. 确保所生成的新消息不包含最近8条已经发过的内容(包括但不限于职位名称)
|
||||
4. 字数严格控制在10-40字
|
||||
5. 避免感叹号等激进符号
|
||||
6. 减少头衔“资深”、“高级”出现的频率,严禁出现“专家”、“老兵”;减少工作年限“x年”出现的频率
|
||||
|
||||
**输出格式:**
|
||||
请确保仅回复一句话,以JSON响应,不要包含其他解释或内容;数据结构参考:\`{"response": "这里是将会发送给招聘者的内容"}\``
|
||||
|
||||
export const autoReminderPromptTemplateFileName = 'auto-reminder-resume-system-message-template.md'
|
||||
export const getValidTemplate = async () => {
|
||||
let template = await readStorageFile(autoReminderPromptTemplateFileName, { isJson: false })
|
||||
if (!template) {
|
||||
await writeDefaultAutoRemindPrompt()
|
||||
template = defaultPrompt
|
||||
}
|
||||
if (!template.includes(RESUME_PLACEHOLDER)) {
|
||||
const e = new Error(`简历内容占位符字符串不存在。占位字符串是 ${RESUME_PLACEHOLDER}`)
|
||||
e.name = `RESUME_PLACEHOLDER_NOT_EXIST`
|
||||
throw e
|
||||
}
|
||||
return template
|
||||
}
|
||||
|
||||
export const writeDefaultAutoRemindPrompt = async () => {
|
||||
await writeStorageFile(autoReminderPromptTemplateFileName, defaultPrompt, { isJson: false })
|
||||
}
|
||||
|
||||
export const requestNewMessageContent = async (
|
||||
chatRecords,
|
||||
{
|
||||
requestScene,
|
||||
llmConfigIdForPick
|
||||
}: { requestScene?: RequestSceneEnum; llmConfigIdForPick?: string[] } = {}
|
||||
) => {
|
||||
const template = await getValidTemplate()
|
||||
const resumeObject = (await readConfigFile('resumes.json'))?.[0]
|
||||
const resumeContent = formatResumeJsonToMarkdown(resumeObject)
|
||||
const chatList = [
|
||||
{
|
||||
role: 'system',
|
||||
content: template.replace(RESUME_PLACEHOLDER, resumeContent)
|
||||
}
|
||||
]
|
||||
chatList.push({
|
||||
role: 'user',
|
||||
content:
|
||||
'请根据我的简历,帮我写一句谦逊有礼貌的开场白。开头包含“您好”等类似敬语、结尾包含“期待回复”等类似话术。不必包含简历中的具体内容,但需要表达出应聘意向。请确保仅响应一句话,以JSON响应;数据结构参考:`{"response": "这里是将会发送给招聘者的内容"}`'
|
||||
})
|
||||
// chatRecords = chatRecords.slice(chatRecords.length - _index)
|
||||
// debugger
|
||||
for (const record of chatRecords) {
|
||||
const assistantJsonContent = JSON.stringify({
|
||||
response: record.text
|
||||
})
|
||||
chatList.push({
|
||||
role: 'assistant',
|
||||
content: `\`\`\`json\n${assistantJsonContent}\n\`\`\``
|
||||
})
|
||||
chatList.push({
|
||||
role: 'user',
|
||||
content:
|
||||
'围绕我简历中关于自我介绍、技术栈、工作经历、项目描述、项目业绩等内容,写一句自我介绍。开头不必包含“您好”、结尾不必包含“期待回复”;务必确保本次所回复的内容不能与之前所回复的内容雷同或相似。请确保仅回复一句话,以JSON响应,不要包含其他解释或内容;数据结构参考:`{"response": "这里是将会发送给招聘者的内容"}`'
|
||||
})
|
||||
}
|
||||
console.log(chatList)
|
||||
let res, llmConfig
|
||||
const llmRequestRecord: Omit<LlmModelUsageRecord, 'id' | 'providerApiSecretMd5'> & {
|
||||
providerApiSecret: string
|
||||
} = {}
|
||||
const blockModelSet = new Set()
|
||||
while (!res) {
|
||||
let llmConfigList = await readConfigFile('llm.json')
|
||||
if (llmConfigIdForPick?.length) {
|
||||
llmConfigList = llmConfigList.filter((it) => {
|
||||
return llmConfigIdForPick.includes(it.id)
|
||||
})
|
||||
}
|
||||
llmConfig = pickLlmConfigFromList(llmConfigList, blockModelSet)
|
||||
if (!llmConfig) {
|
||||
throw new Error(`CANNOT_FIND_A_USABLE_MODEL`)
|
||||
}
|
||||
console.log(llmConfig.providerCompleteApiUrl)
|
||||
Object.assign(llmRequestRecord, {
|
||||
providerCompleteApiUrl: llmConfig.providerCompleteApiUrl,
|
||||
model: llmConfig.model,
|
||||
providerApiSecret: llmConfig.providerApiSecret,
|
||||
requestStartTime: new Date(),
|
||||
hasError: false,
|
||||
errorMessage: '',
|
||||
requestScene
|
||||
})
|
||||
try {
|
||||
const completion = await completes(
|
||||
{
|
||||
baseURL: llmConfig.providerCompleteApiUrl,
|
||||
apiKey: llmConfig.providerApiSecret,
|
||||
model: llmConfig.model
|
||||
},
|
||||
chatList
|
||||
)
|
||||
res = completion?.choices?.[0] ?? null
|
||||
Object.assign(llmRequestRecord, {
|
||||
completionTokens: completion.usage?.completion_tokens ?? null,
|
||||
promptCacheHitTokens: completion.usage?.prompt_cache_hit_tokens ?? null,
|
||||
promptCacheMissTokens: completion.usage?.prompt_cache_miss_tokens ?? null,
|
||||
promptTokens: completion.usage?.prompt_tokens ?? null,
|
||||
totalTokens: completion.usage?.total_tokens ?? null
|
||||
} as LlmModelUsageRecord)
|
||||
} catch (err) {
|
||||
console.log('request failed', err)
|
||||
blockModelSet.add(llmConfig.id)
|
||||
Object.assign(llmRequestRecord, {
|
||||
hasError: true,
|
||||
errorMessage: err?.message ?? ''
|
||||
})
|
||||
} finally {
|
||||
llmRequestRecord.requestEndTime = new Date()
|
||||
try {
|
||||
await recordGptCompletionRequest(llmRequestRecord)
|
||||
} catch (err) {
|
||||
console.log('CANNOT_SAVE_LLM_COMPLETION_LOG', err)
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(res)
|
||||
// _index++
|
||||
let textToSend
|
||||
try {
|
||||
const rawMarkdownText = res?.message?.content
|
||||
try {
|
||||
textToSend = JSON.parse(
|
||||
rawMarkdownText.replace(/^```json/m, '').replace(/```$/m, '')
|
||||
)?.response
|
||||
} catch (err) {
|
||||
gtag('encounter_error_when_parse_llm_text', {
|
||||
err,
|
||||
model: llmConfig?.model,
|
||||
providerCompleteApiUrl: llmConfig?.providerCompleteApiUrl
|
||||
})
|
||||
throw err
|
||||
}
|
||||
textToSend = textToSend?.replace(/。$/, '')
|
||||
if (!textToSend) {
|
||||
gtag('llm_respond_text_is_empty', {
|
||||
model: llmConfig?.model,
|
||||
providerCompleteApiUrl: llmConfig?.providerCompleteApiUrl
|
||||
})
|
||||
throw new Error(`empty content. ${err?.message} ${res?.message?.content}`)
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`fail to parse response. ${err?.message} ${res?.message?.content}`)
|
||||
}
|
||||
return {
|
||||
responseText: textToSend,
|
||||
usedLlmConfig: llmConfig,
|
||||
recordInfo: llmRequestRecord
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendGptContent(page: Page, chatRecords) {
|
||||
const textToSend = (
|
||||
await requestNewMessageContent(chatRecords, {
|
||||
requestScene: RequestSceneEnum.readNoReplyAutoReminder
|
||||
})
|
||||
).responseText
|
||||
const chatInputSelector = `.chat-conversation .message-controls .chat-input`
|
||||
const chatInputHandle = await page.$(chatInputSelector)
|
||||
await chatInputHandle.click()
|
||||
await sleep(500)
|
||||
await chatInputHandle.click()
|
||||
await chatInputHandle.type(textToSend, {
|
||||
delay: 50
|
||||
})
|
||||
await sleep(1000)
|
||||
const sendButtonSelector = `.chat-conversation .message-controls .chat-op .btn-send:not(.disabled)`
|
||||
await page.click(sendButtonSelector)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { bootstrap, launchBoss } from './bootstrap'
|
||||
import { MsgStatus, type ChatListItem } from './types'
|
||||
import { Browser, Page } from 'puppeteer'
|
||||
import { sendLookForwardReplyEmotion } from './boss-operation'
|
||||
import { sendGptContent, sendLookForwardReplyEmotion } from './boss-operation'
|
||||
import { sleep, sleepWithRandomDelay } from '@geekgeekrun/utils/sleep.mjs'
|
||||
import attachListenerForKillSelfOnParentExited from '../../utils/attachListenerForKillSelfOnParentExited'
|
||||
import { app } from 'electron'
|
||||
import { app, dialog } from 'electron'
|
||||
import { initDb } from '@geekgeekrun/sqlite-plugin'
|
||||
import {
|
||||
getPublicDbFilePath,
|
||||
@@ -16,10 +16,26 @@ import { writeStorageFile } from '@geekgeekrun/geek-auto-start-chat-with-boss/ru
|
||||
import * as fs from 'fs'
|
||||
import { pipeWriteRegardlessError } from '../utils/pipe'
|
||||
import { BossInfo } from '@geekgeekrun/sqlite-plugin/dist/entity/BossInfo'
|
||||
import { messageForSaveFilter } from '../../../common/utils/chat-list'
|
||||
import { RECHAT_CONTENT_SOURCE, RECHAT_LLM_FALLBACK } from '../../../common/enums/auto-start-chat'
|
||||
import gtag from '../../utils/gtag'
|
||||
|
||||
const throttleIntervalMinutes =
|
||||
readConfigFile('boss.json').autoReminder?.throttleIntervalMinutes ?? 10
|
||||
const rechatLimitDay = readConfigFile('boss.json').autoReminder?.rechatLimitDay ?? 21
|
||||
const recentMessageQuantityForLlm =
|
||||
readConfigFile('boss.json').autoReminder?.recentMessageQuantityForLlm ?? 8
|
||||
const rechatContentSource =
|
||||
readConfigFile('boss.json').autoReminder?.rechatContentSource ??
|
||||
RECHAT_CONTENT_SOURCE.LOOK_FORWARD_EMOTION
|
||||
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: {
|
||||
@@ -31,7 +47,7 @@ async function saveCurrentChatRecord(page) {
|
||||
'document.querySelector(".main-wrap").__vue__.$store.state.userInfo'
|
||||
)
|
||||
const bossInfo = await page.evaluate(
|
||||
'document.querySelector(".chat-conversation").__vue__.bossInfo$'
|
||||
'document.querySelector(".chat-conversation .chat-record")?.__vue__?.boss'
|
||||
)
|
||||
|
||||
const ds = await dbInitPromise
|
||||
@@ -105,7 +121,6 @@ const mainLoop = async () => {
|
||||
'你与该职位竞争者PK情况',
|
||||
'简历诊断提醒',
|
||||
'附件简历还没准备好',
|
||||
'开场问题,期待你的回答',
|
||||
'设置合适的期望薪资范围'
|
||||
].map((it) => new RegExp(it))
|
||||
browser = await bootstrap()
|
||||
@@ -171,6 +186,9 @@ const mainLoop = async () => {
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
await pageMapByName.boss?.waitForFunction(() => {
|
||||
return Array.isArray(document.querySelector('.main-wrap .chat-user')?.__vue__?.list)
|
||||
})
|
||||
// find target boss - with unread icon, or recommend system message
|
||||
const friendListData = (await pageMapByName.boss!.evaluate(
|
||||
`
|
||||
@@ -183,9 +201,10 @@ const mainLoop = async () => {
|
||||
(rechatLimitDay && it.updateTime
|
||||
? +new Date() - it.updateTime < rechatLimitDay * 24 * 60 * 60 * 1000
|
||||
: true) &&
|
||||
((it.lastIsSelf && it.lastMsgStatus === MsgStatus.HAS_READ) ||
|
||||
((((it.lastIsSelf && it.lastMsgStatus === MsgStatus.HAS_READ) ||
|
||||
canNotConfirmIfHasReadMsgTemplateList.some((regExp) => regExp.test(it.lastText))) &&
|
||||
!it.unreadCount
|
||||
!it.unreadCount) ||
|
||||
(!it.lastIsSelf && it.lastText === '开场问题,期待你的回答'))
|
||||
)
|
||||
})
|
||||
|
||||
@@ -252,33 +271,76 @@ const mainLoop = async () => {
|
||||
})
|
||||
}
|
||||
await sleepWithRandomDelay(1500)
|
||||
const bossInfo = await pageMapByName.boss?.evaluate(() => {
|
||||
return document.querySelector('.chat-conversation')?.__vue__['bossInfo$']
|
||||
})
|
||||
// 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$`
|
||||
)
|
||||
|
||||
const historyMessageList =
|
||||
(
|
||||
await pageMapByName.boss?.evaluate(() => {
|
||||
return (
|
||||
document.querySelector('.main-wrap .chat-conversation .chat-record')?.__vue__
|
||||
?.records$ ?? []
|
||||
)
|
||||
return document.querySelector('.message-content .chat-record')?.__vue__?.list$ ?? []
|
||||
})
|
||||
)?.filter((msg) => ['received', 'sent'].includes(msg.style)) ?? []
|
||||
)?.filter(messageForSaveFilter) ?? []
|
||||
|
||||
const lastGeekMessageSendTime =
|
||||
historyMessageList.findLast((it) => it.style === 'sent')?.time ?? 0
|
||||
const lastGeekMessageSendTime = historyMessageList.findLast((it) => it.isSelf)?.time ?? 0
|
||||
if (
|
||||
historyMessageList[historyMessageList.length - 1].style === 'sent' &&
|
||||
isExpectJobTypeMatch &&
|
||||
historyMessageList[historyMessageList.length - 1].isSelf &&
|
||||
historyMessageList[historyMessageList.length - 1].status === MsgStatus.HAS_READ &&
|
||||
(!bossInfo.bothTalked ||
|
||||
!historyMessageList.filter((it) => it.style === 'received').length) &&
|
||||
((conversationInfo &&
|
||||
Object.hasOwn(conversationInfo, 'bothTalked') &&
|
||||
!conversationInfo.bothTalked) ||
|
||||
!historyMessageList.filter(
|
||||
(it) => !it.isSelf // not sent by me
|
||||
).length) &&
|
||||
// don't disturb too much
|
||||
Date.now() - lastGeekMessageSendTime >=
|
||||
(throttleIntervalMinutes + 4 * Math.random()) * 60 * 1000
|
||||
) {
|
||||
await sleepWithRandomDelay(3250)
|
||||
await sendLookForwardReplyEmotion(pageMapByName.boss!)
|
||||
if (rechatContentSource === RECHAT_CONTENT_SOURCE.GEMINI_WITH_CHAT_CONTEXT) {
|
||||
try {
|
||||
const messageListForGpt = historyMessageList
|
||||
.filter((it) => it.bizType !== 101 && it.isSelf)
|
||||
.slice(-recentMessageQuantityForLlm)
|
||||
await sendGptContent(pageMapByName.boss!, messageListForGpt)
|
||||
gtag('rnrr_llm_content_sent')
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
if (rechatLlmFallback === RECHAT_LLM_FALLBACK.SEND_LOOK_FORWARD_EMOTION) {
|
||||
await sendLookForwardReplyEmotion(pageMapByName.boss!)
|
||||
gtag('rnrr_look_forward_reply_emotion_sent', {
|
||||
fallback: true
|
||||
})
|
||||
} else {
|
||||
gtag('rnrr_encounter_error', {
|
||||
error: err
|
||||
})
|
||||
throw err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await sendLookForwardReplyEmotion(pageMapByName.boss!)
|
||||
gtag('rnrr_look_forward_reply_emotion_sent')
|
||||
}
|
||||
} else {
|
||||
cursorToContinueFind += 1
|
||||
}
|
||||
@@ -338,6 +400,17 @@ export async function runEntry() {
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
if (err instanceof Error && err.message === 'CANNOT_FIND_A_USABLE_MODEL') {
|
||||
gtag('cannot_find_a_usable_model')
|
||||
await dialog.showMessageBox({
|
||||
type: 'error',
|
||||
message:
|
||||
'未找到可以使用的模型,请确定您所配置的模型均可使用。重启本程序或许可以解决这个问题',
|
||||
buttons: ['退出']
|
||||
})
|
||||
process.exit(0)
|
||||
break;
|
||||
}
|
||||
} finally {
|
||||
pageMapByName['boss'] = null
|
||||
await sleep(rerunInterval)
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
const runMode = process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE
|
||||
import minimist from 'minimist'
|
||||
const isUiDev = process.env.NODE_ENV === 'development'
|
||||
const commandlineArgs = minimist(isUiDev ? process.argv.slice(2) : process.argv.slice(1))
|
||||
console.log(commandlineArgs)
|
||||
|
||||
const runMode = commandlineArgs['mode'];
|
||||
|
||||
;(async () => {
|
||||
switch (runMode) {
|
||||
|
||||
@@ -2,17 +2,34 @@ import gtag from '.'
|
||||
|
||||
export default class GtagPlugin {
|
||||
apply(hooks) {
|
||||
hooks.newChatStartup.tap('GtagPlugin', (_, { chatStartupFrom }) => {
|
||||
gtag('new_chat_startup', { chatStartupFrom })
|
||||
})
|
||||
hooks.jobMarkedAsNotSuit.tap('GtagPlugin', (_, { markFrom }) => {
|
||||
gtag('job_marked_as_not_suit', { markFrom })
|
||||
hooks.newChatStartup.tap('GtagPlugin', (jobData, { chatStartupFrom, jobSource }) => {
|
||||
gtag('new_chat_startup', {
|
||||
chatStartupFrom,
|
||||
encryptJobId: jobData.jobInfo.encryptId,
|
||||
jobSource
|
||||
})
|
||||
})
|
||||
hooks.jobMarkedAsNotSuit.tap(
|
||||
'GtagPlugin',
|
||||
(jobData, { markFrom, markOp, markReason, jobSource }) => {
|
||||
gtag('job_marked_as_not_suit', {
|
||||
markFrom,
|
||||
markOp,
|
||||
markReason,
|
||||
bossActiveTimeDesc: jobData.bossInfo.activeTimeDesc,
|
||||
encryptJobId: jobData.jobInfo.encryptId,
|
||||
jobSource
|
||||
})
|
||||
}
|
||||
)
|
||||
hooks.noPositionFoundForCurrentJob.tap('GtagPlugin', () => {
|
||||
gtag('no_position_found_for_current_job')
|
||||
})
|
||||
hooks.noPositionFoundAfterTraverseAllJob.tap('GtagPlugin', () => {
|
||||
gtag('no_position_found_after_traverse_all_job')
|
||||
})
|
||||
hooks.encounterEmptyRecommendJobList.tap('GtagPlugin', ({ pageQuery }) => {
|
||||
gtag('encounter_empty_rec_job_list', { pageQuery })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import buildInfo from '../../../common/build-info.json'
|
||||
import os from 'node:os'
|
||||
|
||||
type LowercaseLetter =
|
||||
| 'a'
|
||||
@@ -55,6 +56,7 @@ function getCommonParams() {
|
||||
return {
|
||||
app_version: buildInfo.version,
|
||||
app_build_hash: buildInfo.buildHash,
|
||||
os_info: `${os.type()} | ${os.release()} | ${os.arch()}`,
|
||||
t: Number(new Date())
|
||||
}
|
||||
}
|
||||
@@ -68,9 +70,14 @@ export default async function gtag<T extends string>(
|
||||
...getCommonParams(),
|
||||
...params
|
||||
}
|
||||
Object.keys(params).forEach((k) => {
|
||||
if ([null, undefined].includes(params[k])) {
|
||||
delete params[k]
|
||||
}
|
||||
})
|
||||
// ServiceWorker环境下直接调用上报函数
|
||||
const reporter = (await import('./Analytics')).default
|
||||
return reporter.fireEvent(name, params)
|
||||
return reporter.fireEvent(name.replace(/-/g, '_'), params)
|
||||
}
|
||||
|
||||
// Fire a page view event.
|
||||
|
||||
59
packages/ui/src/main/utils/initPublicIpc.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { BrowserWindow, ipcMain, shell } from 'electron'
|
||||
import gtag from './gtag'
|
||||
import buildInfo from '../../common/build-info.json'
|
||||
import os from 'node:os'
|
||||
|
||||
export default function initPublicIpc() {
|
||||
ipcMain.on(
|
||||
'update-window-size',
|
||||
(
|
||||
ev,
|
||||
size: {
|
||||
width: number
|
||||
height: number
|
||||
animate?: boolean
|
||||
}
|
||||
) => {
|
||||
const win = BrowserWindow.fromWebContents(ev.sender)
|
||||
if (!win) {
|
||||
return
|
||||
}
|
||||
win.setMinimumSize(size.width, size.height)
|
||||
win.setSize(size.width, size.height, size.animate)
|
||||
}
|
||||
)
|
||||
ipcMain.on('open-external-link', (_, link) => {
|
||||
shell.openExternal(link, {
|
||||
activate: true
|
||||
})
|
||||
})
|
||||
ipcMain.on('gtag', (ev, { name, params } = {}) => {
|
||||
gtag(name, {
|
||||
...params,
|
||||
electron_log_source: 'renderer'
|
||||
})
|
||||
})
|
||||
ipcMain.on('send-feed-back-to-github-issue', (ev, payload) => {
|
||||
const getIssueUrlWithBody = (issueBody: string = '') => {
|
||||
const baseUrl = `https://github.com/geekgeekrun/geekgeekrun/issues/new`
|
||||
issueBody = issueBody || ''
|
||||
if (!issueBody || !issueBody.trim()) {
|
||||
return baseUrl
|
||||
}
|
||||
const urlObj = new URL(baseUrl)
|
||||
urlObj.searchParams.append('body', issueBody)
|
||||
|
||||
return urlObj.toString()
|
||||
}
|
||||
|
||||
shell.openExternal(
|
||||
getIssueUrlWithBody(`\n\n\n-----
|
||||
版本号:${buildInfo.version}(${buildInfo.buildVersion})
|
||||
提交:${buildInfo.buildHash.substring(0, 6)}
|
||||
操作系统信息: \`${os.type()}\` / \`${os.release()}\` / \`${os.arch()}\``),
|
||||
{
|
||||
activate: true
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -47,14 +47,5 @@ export const initIpc = () => {
|
||||
createFirstLaunchNoticeApproveFlag()
|
||||
firstLaunchNoticeWindow?.close()
|
||||
})
|
||||
ipcMain.on('update-window-size', (ev, size: {
|
||||
width: number, height: number, animate?: boolean
|
||||
}) => {
|
||||
const win = BrowserWindow.fromWebContents(ev.sender)
|
||||
if (!win) {
|
||||
return
|
||||
}
|
||||
win.setSize(size.width, size.height, size.animate)
|
||||
} )
|
||||
}
|
||||
initIpc()
|
||||
|
||||
44
packages/ui/src/main/window/llmConfigWindow.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { BrowserWindow, ipcMain } from 'electron'
|
||||
import path from 'path'
|
||||
|
||||
export let llmConfigWindow: BrowserWindow | null = null
|
||||
export function createLlmConfigWindow(
|
||||
opt?: Electron.BrowserWindowConstructorOptions
|
||||
): BrowserWindow {
|
||||
// Create the browser window.
|
||||
if (llmConfigWindow) {
|
||||
llmConfigWindow!.show()
|
||||
}
|
||||
llmConfigWindow = new BrowserWindow({
|
||||
width: 576,
|
||||
height: 410,
|
||||
resizable: false,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, '../preload/index.js'),
|
||||
sandbox: false
|
||||
},
|
||||
...opt
|
||||
})
|
||||
|
||||
llmConfigWindow.on('ready-to-show', () => {
|
||||
llmConfigWindow!.show()
|
||||
})
|
||||
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
// Load the remote URL for development or the local html file for production.
|
||||
if (process.env.NODE_ENV === 'development' && process.env['ELECTRON_RENDERER_URL']) {
|
||||
llmConfigWindow.loadURL(process.env['ELECTRON_RENDERER_URL'] + '#/llmConfig')
|
||||
} else {
|
||||
llmConfigWindow.loadURL(
|
||||
'file://' + path.join(__dirname, '../renderer/index.html') + '#/llmConfig'
|
||||
)
|
||||
}
|
||||
|
||||
llmConfigWindow!.once('closed', () => {
|
||||
llmConfigWindow = null
|
||||
})
|
||||
|
||||
return llmConfigWindow!
|
||||
}
|
||||
@@ -8,8 +8,9 @@ export let mainWindow: BrowserWindow | null = null
|
||||
export function createMainWindow(): BrowserWindow {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1024,
|
||||
width: 1280,
|
||||
height: 720,
|
||||
minWidth: 1280,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
...(process.platform === 'linux'
|
||||
@@ -23,8 +24,6 @@ export function createMainWindow(): BrowserWindow {
|
||||
}
|
||||
})
|
||||
|
||||
process.env.NODE_ENV === 'development' && openDevTools(mainWindow)
|
||||
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
mainWindow.show()
|
||||
})
|
||||
@@ -36,6 +35,12 @@ export function createMainWindow(): BrowserWindow {
|
||||
show: true
|
||||
})
|
||||
})
|
||||
mainWindow.on('ready-to-show', async () => {
|
||||
process.env.NODE_ENV === 'development' &&
|
||||
setTimeout(() => {
|
||||
mainWindow && openDevTools(mainWindow)
|
||||
}, 500)
|
||||
})
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||
shell.openExternal(details.url)
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
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,
|
||||
{ autoReminderConfig } = {}
|
||||
): BrowserWindow {
|
||||
// Create the browser window.
|
||||
if (readNoReplyReminderLlmMockWindow) {
|
||||
readNoReplyReminderLlmMockWindow!.show()
|
||||
}
|
||||
readNoReplyReminderLlmMockWindow = new BrowserWindow({
|
||||
width: 600,
|
||||
height: 800,
|
||||
resizable: false,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, '../preload/index.js'),
|
||||
sandbox: false
|
||||
},
|
||||
...opt
|
||||
})
|
||||
|
||||
readNoReplyReminderLlmMockWindow.on('ready-to-show', () => {
|
||||
readNoReplyReminderLlmMockWindow!.show()
|
||||
})
|
||||
|
||||
// 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']) {
|
||||
urlObj = new URL(process.env['ELECTRON_RENDERER_URL'] + '#/readNoReplyReminderLlmMock')
|
||||
} else {
|
||||
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
|
||||
})
|
||||
|
||||
return readNoReplyReminderLlmMockWindow!
|
||||
}
|
||||
44
packages/ui/src/main/window/resumeEditorWindow.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { BrowserWindow, ipcMain } from 'electron'
|
||||
import path from 'path'
|
||||
|
||||
export let resumeEditorWindow: BrowserWindow | null = null
|
||||
export function createResumeEditorWindow(
|
||||
opt?: Electron.BrowserWindowConstructorOptions
|
||||
): BrowserWindow {
|
||||
// Create the browser window.
|
||||
if (resumeEditorWindow) {
|
||||
resumeEditorWindow!.show()
|
||||
}
|
||||
resumeEditorWindow = new BrowserWindow({
|
||||
width: 960,
|
||||
height: 720,
|
||||
resizable: true,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, '../preload/index.js'),
|
||||
sandbox: false
|
||||
},
|
||||
...opt
|
||||
})
|
||||
|
||||
resumeEditorWindow.on('ready-to-show', () => {
|
||||
resumeEditorWindow!.show()
|
||||
})
|
||||
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
// Load the remote URL for development or the local html file for production.
|
||||
if (process.env.NODE_ENV === 'development' && process.env['ELECTRON_RENDERER_URL']) {
|
||||
resumeEditorWindow.loadURL(process.env['ELECTRON_RENDERER_URL'] + '#/resumeEditor')
|
||||
} else {
|
||||
resumeEditorWindow.loadURL(
|
||||
'file://' + path.join(__dirname, '../renderer/index.html') + '#/resumeEditor'
|
||||
)
|
||||
}
|
||||
|
||||
resumeEditorWindow!.once('closed', () => {
|
||||
resumeEditorWindow = null
|
||||
})
|
||||
|
||||
return resumeEditorWindow!
|
||||
}
|
||||
@@ -9,4 +9,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ElConfigProvider } from 'element-plus'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { onMounted } from 'vue'
|
||||
import { gtagRenderer } from './utils/gtag'
|
||||
|
||||
gtagRenderer('app_component_before_create')
|
||||
onMounted(() => {
|
||||
gtagRenderer('app_component_mounted')
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="job-combo-filter">
|
||||
<div class="filter-item">
|
||||
<div>薪资待遇</div>
|
||||
<div font-size-12px>薪资待遇</div>
|
||||
<el-select
|
||||
v-model="modelValue.salaryList"
|
||||
multiple
|
||||
@@ -18,7 +18,7 @@
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<div>工作经验</div>
|
||||
<div font-size-12px>工作经验</div>
|
||||
<el-select
|
||||
v-model="modelValue.experienceList"
|
||||
multiple
|
||||
@@ -35,7 +35,7 @@
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<div>学历要求</div>
|
||||
<div font-size-12px>学历要求</div>
|
||||
<el-select
|
||||
v-model="modelValue.degreeList"
|
||||
multiple
|
||||
@@ -52,7 +52,7 @@
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<div>公司行业</div>
|
||||
<div font-size-12px>公司行业</div>
|
||||
<el-select
|
||||
v-model="modelValue.industryList"
|
||||
multiple
|
||||
@@ -75,7 +75,7 @@
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<div>公司规模</div>
|
||||
<div font-size-12px>公司规模</div>
|
||||
<el-select
|
||||
v-model="modelValue.scaleList"
|
||||
multiple
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
<template #header>
|
||||
<div class="diff-table-header">
|
||||
{{ transformUtcDateToLocalDate(item.value).format('YYYY-MM-DD HH:mm:ss') }}
|
||||
<el-tooltip content="待对比条目少于2个" :disabled="tableProps.length > 1">
|
||||
<el-tooltip
|
||||
content="待对比条目少于2个"
|
||||
:disabled="tableProps.length > 1"
|
||||
@show="gtagRenderer('tooltip_show_about_lake_of_compare_item')"
|
||||
>
|
||||
<el-radio v-model="diffPivot" :label="item.value" :disabled="tableProps.length <= 1">作为diff基准</el-radio>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
@@ -44,6 +48,7 @@ import { JobInfoChangeLog } from '@geekgeekrun/sqlite-plugin/src/entity/JobInfoC
|
||||
import { ElTable, ElTableColumn, ElForm, ElFormItem, ElRow, ElCol, ElDivider } from 'element-plus'
|
||||
import TextDiff from '../../components/TextDiff.vue'
|
||||
import { transformUtcDateToLocalDate } from '@geekgeekrun/utils/date.mjs'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const props = defineProps({
|
||||
jobInfo: {
|
||||
|
||||
@@ -3,9 +3,20 @@
|
||||
<el-form-item label="公司">{{ jobInfo.companyName }}</el-form-item>
|
||||
<el-form-item label="职位名称">{{ jobInfo.jobName }}</el-form-item>
|
||||
<el-form-item label="职位分类">{{ jobInfo.positionName }}</el-form-item>
|
||||
<el-form-item label="开聊时间">{{
|
||||
transformUtcDateToLocalDate(jobInfo.date).format('YYYY-MM-DD HH:mm:ss')
|
||||
}}</el-form-item>
|
||||
<el-form-item v-if="scene === 'startChatRecord'" label="开聊时间">
|
||||
{{
|
||||
jobInfo.date
|
||||
? transformUtcDateToLocalDate(jobInfo.date).format('YYYY-MM-DD HH:mm:ss')
|
||||
: '无记录'
|
||||
}}
|
||||
</el-form-item>
|
||||
<el-form-item v-if="scene === 'markAsNotSuitRecord'" label="标记时间">
|
||||
{{
|
||||
jobInfo.date
|
||||
? transformUtcDateToLocalDate(jobInfo.date).format('YYYY-MM-DD HH:mm:ss')
|
||||
: '无记录'
|
||||
}}
|
||||
</el-form-item>
|
||||
<el-form-item label="工作经验">{{ jobInfo.experienceName }}</el-form-item>
|
||||
<el-form-item label="薪资">{{
|
||||
`${jobInfo.salaryLow}-${jobInfo.salaryHigh}k` +
|
||||
@@ -14,19 +25,26 @@
|
||||
<el-form-item label="职位描述">
|
||||
<pre class="of-auto">{{ jobInfo.description }}</pre>
|
||||
</el-form-item>
|
||||
<el-form-item label="BOSS">{{ jobInfo.bossName }} - {{ jobInfo.bossTitle }}</el-form-item>
|
||||
<el-form-item label="BOSS"
|
||||
>{{ jobInfo.bossName
|
||||
}}<template v-if="jobInfo.bossTitle"> - {{ jobInfo.bossTitle }}</template></el-form-item
|
||||
>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { type VChatStartupLog } from '@geekgeekrun/sqlite-plugin/src/entity/VChatStartupLog'
|
||||
import { type VMarkAsNotSuitLog } from '@geekgeekrun/sqlite-plugin/src/entity/VMarkAsNotSuitLog'
|
||||
import { transformUtcDateToLocalDate } from '@geekgeekrun/utils/date.mjs'
|
||||
|
||||
const props = defineProps({
|
||||
defineProps({
|
||||
jobInfo: {
|
||||
type: Object as PropType<VChatStartupLog>,
|
||||
type: Object as PropType<VChatStartupLog | VMarkAsNotSuitLog>,
|
||||
required: true
|
||||
},
|
||||
scene: {
|
||||
type: String
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<draggable
|
||||
:model-value="modelValue"
|
||||
class="list-group"
|
||||
:component-data="{
|
||||
tag: 'ul',
|
||||
type: 'transition-group',
|
||||
name: !drag ? 'flip-list' : null
|
||||
}"
|
||||
:group="{ name: 'parent', put: ['parent'] }"
|
||||
v-bind="dragOptions"
|
||||
handle=".drag-handle-wrap"
|
||||
@update:model-value="emit('update:model-value', $event)"
|
||||
@start="drag = true"
|
||||
@end="
|
||||
() => {
|
||||
drag = false
|
||||
setTimeout(() => {
|
||||
gtagRenderer('job-source-dragged', {
|
||||
sourceOrder: modelValue?.map((it) => JobSource[it.type]).join(','),
|
||||
enabledSourceOrder: modelValue
|
||||
?.filter?.((it) => !!it.enabled)
|
||||
?.map((it) => JobSource[it.type])
|
||||
?.join(',')
|
||||
})
|
||||
}, 50)
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<li class="list-group-item">
|
||||
<div flex flex-items-center>
|
||||
<span class="drag-handle-wrap">
|
||||
<span class="drag-handle" />
|
||||
</span>
|
||||
<span class="inner-content">
|
||||
<div flex w-full flex-1>
|
||||
<template
|
||||
v-if="
|
||||
element.type === 'search' &&
|
||||
(!element?.children?.length ||
|
||||
element?.children?.every((it) => !(it.enabled && !!it.keyword?.trim())))
|
||||
"
|
||||
>
|
||||
<el-switch
|
||||
model-value="false"
|
||||
mr10px
|
||||
disabled
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
inline-prompt
|
||||
@click="
|
||||
() => {
|
||||
if (!element?.children?.length) {
|
||||
Message.info({
|
||||
message: '请添加一个要搜索的关键词',
|
||||
grouping: true
|
||||
})
|
||||
} else if (
|
||||
element?.children?.every((it) => !(it.enabled && !!it.keyword?.trim()))
|
||||
) {
|
||||
Message.info({
|
||||
message: '请启用一个要搜索的关键词',
|
||||
grouping: true
|
||||
})
|
||||
}
|
||||
gtagRenderer('job-source-switch-ph-clicked', { type: element.type })
|
||||
}
|
||||
"
|
||||
/>
|
||||
{{ element.label }}
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-switch
|
||||
v-model="element.enabled"
|
||||
mr10px
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
inline-prompt
|
||||
@change="
|
||||
(v) => gtagRenderer('job-source-switch-changed', { type: element.type, v })
|
||||
"
|
||||
/>
|
||||
{{ element.label }}
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="element.type === 'search'">
|
||||
<div flex flex-items-center>
|
||||
<span color-orange align-self-end mr10px>
|
||||
{{ getSearchSourceTipText(element) }}
|
||||
</span>
|
||||
<el-button
|
||||
p-0
|
||||
h-fit
|
||||
type="text"
|
||||
@click="
|
||||
() => {
|
||||
addSearchKeyword(element)
|
||||
gtagRenderer('job-source-search-kw-added', {
|
||||
kwListLength: element.children?.length
|
||||
})
|
||||
}
|
||||
"
|
||||
>添加关键词</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="element.type === 'search' && element?.children?.length">
|
||||
<draggable
|
||||
v-model="element.children"
|
||||
class="list-group"
|
||||
:component-data="{
|
||||
tag: 'ul',
|
||||
type: 'transition-group',
|
||||
name: !drag ? 'flip-list' : null
|
||||
}"
|
||||
:group="{ name: 'child', put: ['child'] }"
|
||||
v-bind="dragOptions"
|
||||
handle=".drag-handle-wrap"
|
||||
@start="drag = true"
|
||||
@end="
|
||||
() => {
|
||||
drag = false
|
||||
setTimeout(() => {
|
||||
gtagRenderer('job-source-search-kw-dragged', {
|
||||
kwListLength: element.children?.length
|
||||
})
|
||||
}, 50)
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #item="{ element: searchItem, index }">
|
||||
<li class="list-group-item">
|
||||
<div flex flex-items-center>
|
||||
<span class="drag-handle-wrap">
|
||||
<span class="drag-handle" />
|
||||
</span>
|
||||
<span class="inner-content">
|
||||
<div flex w-full>
|
||||
<el-switch
|
||||
v-if="element.enabled && searchItem.keyword?.trim()"
|
||||
v-model="searchItem.enabled"
|
||||
mr10px
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
inline-prompt
|
||||
@change="(v) => gtagRenderer('job-source-search-kw-switch-changed', { v })"
|
||||
/>
|
||||
<el-switch
|
||||
v-else
|
||||
disabled
|
||||
:model-value="false"
|
||||
mr10px
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
inline-prompt
|
||||
@click="
|
||||
() => {
|
||||
if (!searchItem.keyword?.trim()) {
|
||||
Message.info({
|
||||
message: '该条关键词为空,请输入要搜索的关键词',
|
||||
grouping: true
|
||||
})
|
||||
} else if (!element.enabled) {
|
||||
Message.info({
|
||||
message: '请启用“通过搜索找到的职位”来源',
|
||||
grouping: true
|
||||
})
|
||||
}
|
||||
gtagRenderer('job-source-search-kw-switch-ph-clicked')
|
||||
}
|
||||
"
|
||||
/>
|
||||
<el-input
|
||||
v-model="searchItem.keyword"
|
||||
maxlength="100"
|
||||
@blur="
|
||||
() => {
|
||||
searchItem.keyword = searchItem.keyword?.trim() ?? ''
|
||||
gtagRenderer('job-source-search-kw-input-blurred', {
|
||||
contentLength: searchItem.keyword?.length
|
||||
})
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<el-button
|
||||
p-0
|
||||
ml-10px
|
||||
h-fit
|
||||
type="danger"
|
||||
link
|
||||
@click="
|
||||
() => {
|
||||
removeSearchKeywordByIndex(element, index)
|
||||
gtagRenderer('job-source-search-kw-removed', {
|
||||
itemIndex: index,
|
||||
contentLength: searchItem.keyword?.length
|
||||
})
|
||||
}
|
||||
"
|
||||
>删除</el-button
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
</draggable>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
</draggable>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import draggable from 'vuedraggable'
|
||||
import { ElMessage as Message } from 'element-plus'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
import { JobSource } from '@geekgeekrun/sqlite-plugin/src/enums'
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array
|
||||
}
|
||||
})
|
||||
|
||||
const setTimeout = globalThis.setTimeout.bind(globalThis)
|
||||
|
||||
const emit = defineEmits(['update:model-value'])
|
||||
|
||||
const drag = ref(false)
|
||||
|
||||
const dragOptions = computed(() => {
|
||||
return {
|
||||
animation: 200,
|
||||
disabled: false,
|
||||
ghostClass: 'ghost'
|
||||
}
|
||||
})
|
||||
|
||||
function addSearchKeyword(item) {
|
||||
if (!item.children) {
|
||||
item.children = []
|
||||
}
|
||||
item.enabled = true
|
||||
item.children.push({
|
||||
type: 'search-kw',
|
||||
enabled: true,
|
||||
keyword: ''
|
||||
})
|
||||
}
|
||||
|
||||
function removeSearchKeywordByIndex(item, index) {
|
||||
item.children?.splice(index, 1)
|
||||
}
|
||||
const searchKeywordCountMap = computed(() => {
|
||||
const target = props.modelValue?.find((it) => it.type === 'search' && it.enabled)
|
||||
if (!target || !target?.children?.length) {
|
||||
return {}
|
||||
}
|
||||
const map = {}
|
||||
target.children?.forEach((it) => {
|
||||
if (!it.keyword) {
|
||||
return
|
||||
}
|
||||
if (!map[it.keyword]) {
|
||||
map[it.keyword] = 0
|
||||
}
|
||||
map[it.keyword]++
|
||||
})
|
||||
|
||||
return map
|
||||
})
|
||||
|
||||
const getSearchSourceTipText = (element) => {
|
||||
if (!element?.children?.length) {
|
||||
return `添加一个关键词后方可启用->`
|
||||
}
|
||||
const seg: string[] = []
|
||||
if (element.enabled) {
|
||||
if (element.children?.every((it) => !(it.enabled && !!it.keyword?.trim()))) {
|
||||
seg.push(`启用下方任一非空项后方可启用`)
|
||||
} else if (element.children?.some((it) => it.enabled && !it.keyword?.trim())) {
|
||||
seg.push(`空项会被跳过`)
|
||||
}
|
||||
if (Object.values(searchKeywordCountMap.value).some((n) => n > 1)) {
|
||||
seg.push(`重复项仅取第一个启用的项`)
|
||||
}
|
||||
}
|
||||
return seg.join(';')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ghost {
|
||||
opacity: 0.5;
|
||||
filter: blur(2px);
|
||||
}
|
||||
|
||||
.list-group {
|
||||
line-height: 32px;
|
||||
min-height: 20px;
|
||||
.list-group {
|
||||
margin-left: 20px;
|
||||
}
|
||||
.list-group-item {
|
||||
background-color: #fff;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
padding-right: 10px;
|
||||
border: 1px solid var(--el-card-border-color);
|
||||
margin-top: 6px;
|
||||
margin-bottom: 6px;
|
||||
box-shadow: var(--el-box-shadow-light);
|
||||
border-radius: 4px;
|
||||
.inner-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
::v-deep(.el-checkbox) {
|
||||
.el-checkbox__label {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.drag-handle-wrap {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
width: 25px;
|
||||
height: 1em;
|
||||
cursor: grab;
|
||||
margin-right: 4px;
|
||||
.drag-handle {
|
||||
width: 20px;
|
||||
background-image: linear-gradient(
|
||||
90deg,
|
||||
transparent 35%,
|
||||
var(--el-card-border-color) 35%,
|
||||
var(--el-card-border-color) 45%,
|
||||
transparent 45%,
|
||||
transparent 55%,
|
||||
var(--el-card-border-color) 55%,
|
||||
var(--el-card-border-color) 65%,
|
||||
transparent 65%,
|
||||
transparent 100%
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button p-0 h-auto flex size="small" type="text" :icon="Plus" @click="addCondition"
|
||||
>添加条件</el-button
|
||||
>
|
||||
<div class="job-combo-filter" mt-8px>
|
||||
<el-table
|
||||
size="small"
|
||||
:data="props.modelValue"
|
||||
border
|
||||
:style="{ maxWidth: '100%' }"
|
||||
:row-style="
|
||||
({ row }) => {
|
||||
return {
|
||||
backgroundColor:
|
||||
duplicatedMap.get(getStaticCombineFilterKey(row))?.length > 1
|
||||
? '#fcd4b7'
|
||||
: 'transparent'
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #empty>
|
||||
<div lh-1.5em>
|
||||
列表中没有条件,将仅使用默认的“初始空条件”为您筛选职位<br />
|
||||
你可以点击表格左上角“<el-button
|
||||
p-0
|
||||
h-auto
|
||||
size="small"
|
||||
type="text"
|
||||
:icon="Plus"
|
||||
@click="addCondition"
|
||||
>添加条件</el-button
|
||||
>”按钮,添加更多筛选条件。
|
||||
</div>
|
||||
</template>
|
||||
<el-table-column :resizable="false" label="" :width="80">
|
||||
<template #default="{ $index: index }">
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: '2px',
|
||||
height: 'fit-content'
|
||||
}"
|
||||
>
|
||||
<el-button
|
||||
:disabled="index <= 0"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowUp"
|
||||
@click="moveConditionUp(index)"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="index >= modelValue?.length - 1"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowDown"
|
||||
@click="moveConditionDown(index)"
|
||||
/>
|
||||
<el-button
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="Delete"
|
||||
@click="removeCondition(index)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :resizable="false" label="薪资待遇" prop="salary">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.salary"
|
||||
:disabled="row.___itemType === 'empty-condition-placeholder'"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="it in conditions.salaryList.filter((it) => it.code !== 0)"
|
||||
:key="it.code"
|
||||
:value="it.code"
|
||||
:label="it.name"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :resizable="false" label="工作经验" prop="experience">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.experience"
|
||||
:disabled="row.___itemType === 'empty-condition-placeholder'"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="it in conditions.experienceList.filter((it) => it.code !== 0)"
|
||||
:key="it.code"
|
||||
:value="it.code"
|
||||
:label="it.name"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :resizable="false" label="学历要求" prop="degree">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.degree"
|
||||
:disabled="row.___itemType === 'empty-condition-placeholder'"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="it in conditions.degreeList.filter((it) => it.code !== 0)"
|
||||
:key="it.code"
|
||||
:value="it.code"
|
||||
:label="it.name"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :resizable="false" label="公司行业" :width="200" prop="industry">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.industry"
|
||||
:disabled="row.___itemType === 'empty-condition-placeholder'"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option-group
|
||||
v-for="group in industryFilterExemption"
|
||||
:key="group.code"
|
||||
:label="group.name"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in group.subLevelModelList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :resizable="false" label="公司规模" prop="scale">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.scaleList"
|
||||
:disabled="row.___itemType === 'empty-condition-placeholder'"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="it in conditions.scaleList.filter((it) => it.code !== 0)"
|
||||
:key="it.code"
|
||||
:value="it.code"
|
||||
:label="it.name"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
Array.from(duplicatedMap.values()).some((it) => {
|
||||
return it.length > 1
|
||||
})
|
||||
"
|
||||
color-orange
|
||||
font-size-12px
|
||||
>
|
||||
列表中被橙色高亮的条件存在重复项,相关重复项将被合并,运行时遍历顺序以第一次出现为准
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import conditions from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-conditions-20241002.json'
|
||||
import industryFilterExemption from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-industry-filter-exemption-20241002.json'
|
||||
import { ArrowUp, ArrowDown, Delete, Plus } from '@element-plus/icons-vue'
|
||||
import { computed, PropType } from 'vue'
|
||||
|
||||
import { getStaticCombineFilterKey } from '@geekgeekrun/geek-auto-start-chat-with-boss/combineCalculator.mjs'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array as PropType<
|
||||
Array<{
|
||||
salary: number | null
|
||||
experience: number | null
|
||||
degree: number | null
|
||||
industry: number | null
|
||||
scale: number | null
|
||||
}>
|
||||
>,
|
||||
default: () => []
|
||||
},
|
||||
isSkipEmptyConditionForCombineRecommendJobFilter: {
|
||||
type: Boolean
|
||||
}
|
||||
})
|
||||
|
||||
function getNewConditionItem() {
|
||||
return {
|
||||
salary: null,
|
||||
experience: null,
|
||||
degree: null,
|
||||
industry: null,
|
||||
scale: null
|
||||
}
|
||||
}
|
||||
|
||||
function addCondition() {
|
||||
props.modelValue?.push(getNewConditionItem())
|
||||
// gtagRenderer('resume_work_exp_added')
|
||||
}
|
||||
function moveConditionUp(index) {
|
||||
;[props.modelValue[index], props.modelValue[index - 1]] = [
|
||||
props.modelValue[index - 1],
|
||||
props.modelValue[index]
|
||||
]
|
||||
// gtagRenderer('resume_work_exp_moved_up')
|
||||
}
|
||||
|
||||
function moveConditionDown(index) {
|
||||
;[props.modelValue[index], props.modelValue[index + 1]] = [
|
||||
props.modelValue[index + 1],
|
||||
props.modelValue[index]
|
||||
]
|
||||
// gtagRenderer('resume_work_exp_moved_down')
|
||||
}
|
||||
|
||||
function removeCondition(index) {
|
||||
props.modelValue?.splice(index, 1)
|
||||
// gtagRenderer('resume_work_exp_removed')
|
||||
}
|
||||
const duplicatedMap = computed(() => {
|
||||
const map = new Map()
|
||||
for (const condition of props.modelValue ?? []) {
|
||||
const key = getStaticCombineFilterKey(condition)
|
||||
if (!map.has(key)) {
|
||||
map.set(key, [])
|
||||
}
|
||||
const arr = map.get(key)
|
||||
arr.push(condition)
|
||||
}
|
||||
return map
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.job-combo-filter {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
gap: 10px;
|
||||
.filter-item {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,13 +2,15 @@ import { createApp } from 'vue'
|
||||
import ElementPlus, { ElMessage } from 'element-plus'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import { createPinia } from 'pinia'
|
||||
import 'normalize.css'
|
||||
import './style/public.scss'
|
||||
import 'element-plus/dist/index.css'
|
||||
import 'virtual:uno.css'
|
||||
import 'animate.css'
|
||||
|
||||
createApp(App).use(router).use(ElementPlus).mount('#app')
|
||||
const pinia = createPinia()
|
||||
createApp(App).use(pinia).use(router).use(ElementPlus).mount('#app')
|
||||
electron.ipcRenderer.on('toast-message', (_, payload) => {
|
||||
ElMessage(payload)
|
||||
})
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
import { useRouter } from 'vue-router'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { sleep } from '@geekgeekrun/utils/sleep.mjs'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -33,10 +34,12 @@ const checkDependenciesResult = ref({})
|
||||
const downloadProcessWaitee = ref(null)
|
||||
|
||||
onMounted(async () => {
|
||||
gtagRenderer('bootstrap_mounted')
|
||||
checkDependenciesResult.value = await electron.ipcRenderer.invoke('check-dependencies')
|
||||
downloadProcessWaitee.value = Promise.withResolvers()
|
||||
|
||||
if (Object.values(checkDependenciesResult.value).includes(false)) {
|
||||
gtagRenderer('dependencies_need_download')
|
||||
router.replace('/downloadingDependencies')
|
||||
} else {
|
||||
downloadProcessWaitee.value!.resolve()
|
||||
@@ -45,10 +48,11 @@ onMounted(async () => {
|
||||
downloadProcessWaitee.value!.promise.then(async () => {
|
||||
const isCookieFileValid = await electron.ipcRenderer.invoke('check-boss-zhipin-cookie-file')
|
||||
if (!isCookieFileValid) {
|
||||
gtagRenderer('found_cookie_invalid_when_bootstrap')
|
||||
router.replace('/cookieAssistant')
|
||||
} else {
|
||||
await sleep(1000)
|
||||
router.replace('/configuration')
|
||||
router.replace('/main-layout')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, onUnmounted, PropType } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const props = defineProps({
|
||||
dependenciesStatus: {
|
||||
@@ -47,9 +48,11 @@ const processDownloadBrowser = async () => {
|
||||
const promiseList: Array<Promise<void>> = []
|
||||
const processTasks = async () => {
|
||||
if (!props.dependenciesStatus.puppeteerExecutableAvailable) {
|
||||
gtagRenderer('start_download_puppeteer')
|
||||
const p = processDownloadBrowser()
|
||||
promiseList.push(p)
|
||||
p.then(() => {
|
||||
gtagRenderer('puppeteer_download_success')
|
||||
props.dependenciesStatus.puppeteerExecutableAvailable = true
|
||||
})
|
||||
}
|
||||
@@ -64,6 +67,7 @@ const processTasks = async () => {
|
||||
})
|
||||
await p
|
||||
} catch {
|
||||
gtagRenderer('encounter_error_when_download_deps')
|
||||
await ElMessageBox.confirm('需要重试吗?', '核心组件下载失败', {
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false,
|
||||
@@ -72,9 +76,11 @@ const processTasks = async () => {
|
||||
cancelButtonText: '退出程序'
|
||||
})
|
||||
.then(() => {
|
||||
gtagRenderer('start_retry_download_deps')
|
||||
processTasks()
|
||||
})
|
||||
.catch(() => {
|
||||
gtagRenderer('cancel_download_deps_and_exit')
|
||||
promiseList.length = 0
|
||||
electron.ipcRenderer.invoke('exit-app-immediately')
|
||||
})
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
<template>
|
||||
<div class="form-wrap">
|
||||
<el-form ref="formRef" :model="formContent" label-position="top" :rules="formRules">
|
||||
<el-form-item label="BOSS直聘 Cookie">
|
||||
<el-button size="small" type="primary" font-size-inherit @click="handleClickLaunchLogin"
|
||||
>编辑Cookie</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="钉钉机器人 AccessToken(用于记录开聊,请勿使用公司内部群)"
|
||||
prop="dingtalkRobotAccessToken"
|
||||
>
|
||||
<el-input v-model="formContent.dingtalkRobotAccessToken" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="期望职位白名单正则(按照职位名称+职位描述筛选职位,为空时将不按此条件筛选)"
|
||||
prop="expectJobRegExpStr"
|
||||
>
|
||||
<el-input v-model="formContent.expectJobRegExpStr" />
|
||||
</el-form-item>
|
||||
<el-form-item label="期望公司(以逗号分隔,为空时将不按此条件筛选)" prop="expectCompanies">
|
||||
<el-input
|
||||
v-model="formContent.expectCompanies"
|
||||
:autosize="{ minRows: 4 }"
|
||||
type="textarea"
|
||||
@blur="handleExpectCompaniesInputBlur"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="推荐职位筛选器(当前求职期望找不到合适职位时,将尝试所有可能的筛选组合,查找新工作)"
|
||||
prop="filter"
|
||||
>
|
||||
<AnyCombineBossRecommendFilter v-model="formContent.anyCombineRecommendJobFilter" />
|
||||
<div>
|
||||
当前组合条件数:{{ currentAnyCombineRecommendJobFilterCombinationCount.toLocaleString() }}
|
||||
<span
|
||||
v-if="
|
||||
currentAnyCombineRecommendJobFilterCombinationCount >= 10 &&
|
||||
currentAnyCombineRecommendJobFilterCombinationCount < 100
|
||||
"
|
||||
class="color-orange"
|
||||
>组合条件太多,建议少选择一些</span
|
||||
>
|
||||
<span
|
||||
v-if="currentAnyCombineRecommendJobFilterCombinationCount >= 100"
|
||||
class="color-orange"
|
||||
>你开心就好</span
|
||||
>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="标记不合适机制" class="color-orange">
|
||||
1. 如果查找到的职位活跃时间为“本月活跃”或更往前的时间,则这个职位将被标记为不合适<br />
|
||||
2. 如果查找到的职位,职位名称、职位类型、职位描述与期望职位白名单正则不匹配,则这个职位将被标记为不合适
|
||||
</el-form-item>
|
||||
<el-form-item class="last-form-item">
|
||||
<el-button @click="handleSave">仅保存配置</el-button>
|
||||
<el-button type="primary" @click="handleSubmit"> 保存配置,并开始求职! </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { ElForm, ElMessage } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import AnyCombineBossRecommendFilter from '@renderer/features/AnyCombineBossRecommendFilter/index.vue'
|
||||
import { calculateTotalCombinations } from '@geekgeekrun/geek-auto-start-chat-with-boss/combineCalculator.mjs'
|
||||
const router = useRouter()
|
||||
|
||||
const formContent = ref({
|
||||
dingtalkRobotAccessToken: '',
|
||||
expectCompanies: '',
|
||||
anyCombineRecommendJobFilter: {},
|
||||
expectJobRegExpStr: ''
|
||||
})
|
||||
|
||||
const currentAnyCombineRecommendJobFilterCombinationCount = computed(() => {
|
||||
return calculateTotalCombinations(formContent.value.anyCombineRecommendJobFilter)
|
||||
})
|
||||
|
||||
electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
||||
console.log(res)
|
||||
formContent.value.dingtalkRobotAccessToken = res.config['dingtalk.json']['groupRobotAccessToken']
|
||||
formContent.value.expectCompanies = res.config['target-company-list.json'].join(',')
|
||||
formContent.value.anyCombineRecommendJobFilter = res.config['boss.json']
|
||||
?.anyCombineRecommendJobFilter ?? {
|
||||
salaryList: [],
|
||||
experienceList: [],
|
||||
degreeList: [],
|
||||
scaleList: [],
|
||||
industryList: []
|
||||
}
|
||||
formContent.value.expectJobRegExpStr = res.config['boss.json']?.expectJobRegExpStr ?? ''
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
expectJobRegExpStr: {
|
||||
validator(_, value, cb) {
|
||||
if (!value) {
|
||||
cb()
|
||||
return
|
||||
}
|
||||
try {
|
||||
new RegExp(value, 'ig')
|
||||
cb()
|
||||
} catch (err) {
|
||||
cb(new Error(`正则无效:${err.message}`))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
const handleSubmit = async () => {
|
||||
formContent.value.expectJobRegExpStr = (formContent.value.expectJobRegExpStr || '').trim()
|
||||
await formRef.value!.validate()
|
||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||
|
||||
router.replace({
|
||||
path: '/geekAutoStartChatWithBoss/prepareRun',
|
||||
query: { flow: 'geek-auto-start-chat-with-boss' }
|
||||
})
|
||||
}
|
||||
const handleSave = async () => {
|
||||
await formRef.value!.validate()
|
||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||
ElMessage.success('Configuration saved.')
|
||||
}
|
||||
|
||||
const handleExpectCompaniesInputBlur = (event) => {
|
||||
event.target.value = (event.target?.value ?? '')
|
||||
.split(/,|,/)
|
||||
.map((it) => it.trim())
|
||||
.filter(Boolean)
|
||||
.join(',')
|
||||
}
|
||||
|
||||
const handleClickLaunchLogin = () => {
|
||||
router.replace('/cookieAssistant')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.form-wrap {
|
||||
margin: 0 auto;
|
||||
max-width: 1000px;
|
||||
max-height: 100vh;
|
||||
overflow: auto;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
:deep(.el-form) {
|
||||
padding-top: 8px;
|
||||
}
|
||||
.last-form-item {
|
||||
:deep(.el-form-item__content) {
|
||||
margin-top: 0px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,176 +0,0 @@
|
||||
<template>
|
||||
<div class="form-wrap">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:rules="formRules"
|
||||
:model="formContent.autoReminder"
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item label="BOSS直聘 Cookie">
|
||||
<el-button size="small" type="primary" font-size-inherit @click="handleClickLaunchLogin"
|
||||
>编辑Cookie</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item label="跟进话术" class="color-orange">
|
||||
当发现已读不回的Boss时,将向Boss发出“[盼回复]”表情
|
||||
</el-form-item>
|
||||
<el-form-item label="跟进间隔(分钟)" prop="throttleIntervalMinutes">
|
||||
<el-input-number
|
||||
v-model="formContent.autoReminder.throttleIntervalMinutes"
|
||||
class="w-150px"
|
||||
:min="3"
|
||||
:precision="1"
|
||||
:step="0.5"
|
||||
@blur="handleThrottleIntervalMinutesBlur"
|
||||
/> 分钟内不多次跟进同一Boss
|
||||
</el-form-item>
|
||||
<el-form-item label="跟进时限(天)" prop="rechatLimitDay">
|
||||
<div>
|
||||
<div><el-checkbox v-model="enableRechatLimit" /> 启用</div>
|
||||
<el-input-number
|
||||
v-model="formContent.autoReminder.rechatLimitDay"
|
||||
class="w-150px"
|
||||
:min="0"
|
||||
:precision="1"
|
||||
:step="0.5"
|
||||
:disabled="!enableRechatLimit"
|
||||
/> 天<br />
|
||||
<div v-if="enableRechatLimit">
|
||||
不再跟进 (<span class="text-orange">{{ rechatLimitDateString }}</span>)之前列表中没有进展的聊天
|
||||
</div>
|
||||
<div v-else>这将会跟进列表中所有聊天(<span class="text-orange">不建议</span>)</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item class="last-form-item">
|
||||
<el-button type="primary" @click="handleSubmit">开始提醒</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
||||
import { dayjs, ElForm } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
const router = useRouter()
|
||||
|
||||
const formContent = ref({
|
||||
autoReminder: {
|
||||
throttleIntervalMinutes: 10,
|
||||
rechatLimitDay: 21
|
||||
}
|
||||
})
|
||||
|
||||
const enableRechatLimit = computed({
|
||||
get() {
|
||||
return Boolean(formContent.value.autoReminder?.rechatLimitDay)
|
||||
},
|
||||
set(val) {
|
||||
if (!val) {
|
||||
formContent.value.autoReminder.rechatLimitDay = 0
|
||||
} else {
|
||||
formContent.value.autoReminder.rechatLimitDay = 21
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
||||
const conf = res.config['boss.json']?.autoReminder || {}
|
||||
conf.throttleIntervalMinutes = conf.throttleIntervalMinutes ?? 10
|
||||
conf.rechatLimitDay = conf.rechatLimitDay ?? 21
|
||||
|
||||
formContent.value.autoReminder = conf
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
throttleIntervalMinutes: {
|
||||
validator(_, value, cb) {
|
||||
if (/[^0-9.]/.test(String(value)) || isNaN(parseFloat(value)) || isNaN(Number(value))) {
|
||||
cb(new Error(`请输入数字!`))
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
}
|
||||
},
|
||||
rechatLimitDay: {
|
||||
validator(_, value, cb) {
|
||||
if (/[^0-9.]/.test(String(value)) || isNaN(parseFloat(value)) || isNaN(Number(value))) {
|
||||
cb(new Error(`请输入数字!`))
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
watch(
|
||||
() => formContent.value.autoReminder,
|
||||
() => {
|
||||
nextTick(() => {
|
||||
formRef.value?.validate?.()
|
||||
})
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value!.validate()
|
||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||
router.replace({
|
||||
path: '/geekAutoStartChatWithBoss/prepareRun',
|
||||
query: { flow: 'read-no-reply-reminder' }
|
||||
})
|
||||
}
|
||||
function handleThrottleIntervalMinutesBlur() {
|
||||
if (formContent.value.autoReminder.throttleIntervalMinutes < 3) {
|
||||
formContent.value.autoReminder.throttleIntervalMinutes = 3
|
||||
}
|
||||
formContent.value.autoReminder.throttleIntervalMinutes = Number(
|
||||
formContent.value.autoReminder.throttleIntervalMinutes
|
||||
)
|
||||
}
|
||||
|
||||
const handleClickLaunchLogin = () => {
|
||||
router.replace('/cookieAssistant')
|
||||
}
|
||||
|
||||
const currentStamp = ref(new Date())
|
||||
let timer = 0
|
||||
function updateCurrentStamp() {
|
||||
currentStamp.value = new Date()
|
||||
timer = window.setTimeout(updateCurrentStamp, 1000)
|
||||
}
|
||||
updateCurrentStamp()
|
||||
onUnmounted(() => {
|
||||
window.clearTimeout(timer)
|
||||
})
|
||||
|
||||
const rechatLimitDateString = computed(() => {
|
||||
return dayjs(
|
||||
+currentStamp.value - formContent.value.autoReminder.rechatLimitDay * 24 * 60 * 60 * 1000
|
||||
).format('YYYY-MM-DD HH:mm:ss')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.form-wrap {
|
||||
margin: 0 auto;
|
||||
max-width: 1000px;
|
||||
max-height: 100vh;
|
||||
overflow: auto;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
:deep(.el-form) {
|
||||
padding-top: 40px;
|
||||
}
|
||||
.last-form-item {
|
||||
:deep(.el-form-item__content) {
|
||||
margin-top: 40px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,148 +0,0 @@
|
||||
<template>
|
||||
<div class="flex h100vh">
|
||||
<div class="flex flex-col w160px pt30px pl30px aside-nav of-hidden">
|
||||
<div class="nav-list flex-1 of-auto">
|
||||
<RouterLink to="./GeekAutoStartChatWithBoss">Boss炸弹</RouterLink>
|
||||
<RouterLink to="./ReadNoReplyReminder">已读不回提醒器</RouterLink>
|
||||
<hr />
|
||||
<a href="javascript:void(0)" @click="handleLaunchBossSite">
|
||||
手动逛Boss<el-icon><TopRight /></el-icon>
|
||||
</a>
|
||||
<hr />
|
||||
<RouterLink to="./StartChatRecord">开聊记录</RouterLink>
|
||||
<RouterLink to="./MarkAsNotSuitRecord">标记不合适记录</RouterLink>
|
||||
<RouterLink to="./JobLibrary">职位库</RouterLink>
|
||||
<RouterLink to="./BossLibrary">Boss库</RouterLink>
|
||||
<RouterLink to="./CompanyLibrary">公司库</RouterLink>
|
||||
</div>
|
||||
<div class="pt-16px pb-16px flex-0 font-size-12px">
|
||||
<div>当前版本: {{ buildInfo.version }}({{ buildInfo.buildVersion }})</div>
|
||||
<div class="feedback-area flex flex-items-center mt-8px">
|
||||
<el-button type="text" size="small" @click="handleGotoProjectPageClick"
|
||||
>项目首页</el-button
|
||||
>
|
||||
|
|
||||
<el-button type="text" size="small" @click="handleFeedbackClick">反馈问题</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<RouterView v-slot="{ Component }" class="flex-1">
|
||||
<KeepAlive>
|
||||
<component :is="Component" />
|
||||
</KeepAlive>
|
||||
</RouterView>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElIcon } from 'element-plus'
|
||||
import { TopRight } from '@element-plus/icons-vue'
|
||||
import useBuildInfo from '@renderer/hooks/useBuildInfo'
|
||||
import { debounce } from 'lodash-es'
|
||||
const router = useRouter()
|
||||
const unmountedCbs: Array<InstanceType<typeof Function>> = []
|
||||
onUnmounted(() => {
|
||||
while (unmountedCbs.length) {
|
||||
const fn = unmountedCbs.shift()!
|
||||
try {
|
||||
fn()
|
||||
} catch {}
|
||||
}
|
||||
})
|
||||
const goToCheckBossZhipinCookieFile = () => router.replace('/cookieAssistant')
|
||||
onMounted(() => {
|
||||
electron.ipcRenderer.on('check-boss-zhipin-cookie-file', goToCheckBossZhipinCookieFile)
|
||||
})
|
||||
onUnmounted(() => {
|
||||
electron.ipcRenderer.removeListener(
|
||||
'check-boss-zhipin-cookie-file',
|
||||
goToCheckBossZhipinCookieFile
|
||||
)
|
||||
})
|
||||
;(async () => {
|
||||
const checkDependenciesResult = await electron.ipcRenderer.invoke('check-dependencies')
|
||||
if (Object.values(checkDependenciesResult).includes(false)) {
|
||||
router.replace('/')
|
||||
return
|
||||
}
|
||||
|
||||
const isCookieFileValid = await electron.ipcRenderer.invoke('check-boss-zhipin-cookie-file')
|
||||
if (!isCookieFileValid) {
|
||||
router.replace('/cookieAssistant')
|
||||
return
|
||||
}
|
||||
})()
|
||||
|
||||
const { buildInfo } = useBuildInfo()
|
||||
const getIssueUrlWithBody = (issueBody: string = '') => {
|
||||
const baseUrl = `https://github.com/geekgeekrun/geekgeekrun/issues/new`
|
||||
issueBody = issueBody || ''
|
||||
if (!issueBody || !issueBody.trim()) {
|
||||
return baseUrl
|
||||
}
|
||||
const urlObj = new URL(baseUrl)
|
||||
urlObj.searchParams.append('body', issueBody)
|
||||
|
||||
return urlObj.toString()
|
||||
}
|
||||
const handleFeedbackClick = () => {
|
||||
electron.ipcRenderer.send(
|
||||
'open-external-link',
|
||||
getIssueUrlWithBody(`\n\n\n-----
|
||||
版本号:${buildInfo.value.version}(${buildInfo.value.buildVersion})
|
||||
提交:${buildInfo.value.buildHash.substring(0, 6)}`)
|
||||
)
|
||||
}
|
||||
const handleGotoProjectPageClick = () => {
|
||||
electron.ipcRenderer.send('open-external-link', 'https://github.com/geekgeekrun/geekgeekrun')
|
||||
}
|
||||
|
||||
const handleLaunchBossSite = debounce(
|
||||
async () => {
|
||||
return await electron.ipcRenderer.invoke('open-site-with-boss-cookie', {
|
||||
url: `https://www.zhipin.com/`
|
||||
})
|
||||
},
|
||||
1000,
|
||||
{ leading: true, trailing: false }
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.aside-nav {
|
||||
background-image: linear-gradient(45deg, #eaf4f1, #dcf6f2);
|
||||
.nav-list {
|
||||
> a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 2.5em;
|
||||
box-sizing: border-box;
|
||||
padding-left: 2em;
|
||||
&.router-link-active {
|
||||
background-color: #fff;
|
||||
font-weight: 700;
|
||||
color: #2faa9e;
|
||||
border-radius: 9999px 0 0 9999px;
|
||||
}
|
||||
}
|
||||
> hr {
|
||||
border: 0 solid;
|
||||
height: 1px;
|
||||
background-color: #b3c8c3;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
width: 140px;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.feedback-area {
|
||||
:deep(.el-button) {
|
||||
height: fit-content;
|
||||
padding: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="cookie-assistant-page">
|
||||
<div ml1em mt1em mb1em >Cookie 助手</div>
|
||||
<div ml1em mt1em mb1em font-size-16px>Boss 登录助手</div>
|
||||
<el-alert
|
||||
v-if="cookieInvalid"
|
||||
type="warning"
|
||||
@@ -11,11 +11,11 @@
|
||||
</el-alert>
|
||||
<div ml1em mt1em line-height-normal>
|
||||
如果您了解如何获取Cookie、了解有效的Cookie格式,可以直接在下方输入框中进行编辑。由于手动编辑较为麻烦,建议您打开已登录过Boss直聘的浏览器,使用<a
|
||||
color-blue
|
||||
decoration-none
|
||||
class="color-blue! decoration-none"
|
||||
href="javascript:void(0)"
|
||||
@click.prevent="handleEditThisCookieExtensionStoreLinkClick"
|
||||
>EditThisCookie 扩展程序</a
|
||||
>
|
||||
EditThisCookie 扩展程序 </a
|
||||
>复制Cookie,然后粘贴在下方输入框中。文本格式为被序列化为JSON的数组,不含两侧引号。
|
||||
</div>
|
||||
<br />
|
||||
@@ -85,7 +85,12 @@
|
||||
size="small"
|
||||
type="primary"
|
||||
font-size-inherit
|
||||
@click="fillCollectedCookie"
|
||||
@click="
|
||||
() => {
|
||||
gtagRenderer('replace_inputted_cookie_by_collected')
|
||||
fillCollectedCookie()
|
||||
}
|
||||
"
|
||||
>使用获取到的Cookie</el-button
|
||||
></template
|
||||
></el-alert
|
||||
@@ -103,8 +108,15 @@
|
||||
import { ElForm, ElMessage } from 'element-plus'
|
||||
import { ref, onUnmounted, onMounted } from 'vue'
|
||||
import { checkCookieListFormat } from '../../../../common/utils/cookie'
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRouter } from 'vue-router'
|
||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const gtagRenderer = (name, params?: object) => {
|
||||
return baseGtagRenderer(name, {
|
||||
scene: 'cookie-assistant',
|
||||
...params
|
||||
})
|
||||
}
|
||||
const router = useRouter()
|
||||
const cookieInvalid = ref(false)
|
||||
|
||||
@@ -138,11 +150,13 @@ const formRules = {
|
||||
`JSON格式无效 - 存在语法错误: ${err.message};建议使用EditThisCookie扩展程序进行复制。`
|
||||
)
|
||||
)
|
||||
gtagRenderer('wrong_cookie_format_json_syntax_error')
|
||||
return
|
||||
}
|
||||
|
||||
if (!checkCookieListFormat(JSON.parse(formContent.value.collectedCookies))) {
|
||||
cb(new Error(`Cookie格式无效 - 部分字段缺失;建议使用EditThisCookie扩展程序进行复制。`))
|
||||
gtagRenderer('wrong_cookie_format_field_loss')
|
||||
return
|
||||
}
|
||||
cb()
|
||||
@@ -158,6 +172,9 @@ const handleCookieCollected = (_, payload) => {
|
||||
collectedCookie.value = payload.cookies
|
||||
if (!hasUserMutateInput.value) {
|
||||
fillCollectedCookie()
|
||||
gtagRenderer('cookie_collected_and_auto_filled')
|
||||
} else {
|
||||
gtagRenderer('cookie_collected_after_changed_input')
|
||||
}
|
||||
}
|
||||
const fillCollectedCookie = () => {
|
||||
@@ -169,28 +186,33 @@ const fillCollectedCookie = () => {
|
||||
}
|
||||
|
||||
const handleClickLaunchLogin = () => {
|
||||
gtagRenderer('launch_login_button_clicked')
|
||||
electron.ipcRenderer.send('launch-bosszhipin-login-page-with-preload-extension')
|
||||
loginCookieWaitingStatus.value = LOGIN_COOKIE_WAITING_STATUS.WAITING_FOR_LOGIN
|
||||
}
|
||||
|
||||
const handleEditThisCookieExtensionStoreLinkClick = () => {
|
||||
gtagRenderer('etc_extension_link_clicked')
|
||||
electron.ipcRenderer.send(
|
||||
'open-external-link',
|
||||
'https://chromewebstore.google.com/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg'
|
||||
'https://chromewebstore.google.com/detail/editthiscookie-v3/ojfebgpkimhlhcblbalbfjblapadhbol'
|
||||
)
|
||||
}
|
||||
|
||||
const handleCancel = () => {
|
||||
router.replace('/configuration')
|
||||
gtagRenderer('cancel_clicked')
|
||||
router.replace('/main-layout')
|
||||
}
|
||||
const handleSubmit = async () => {
|
||||
gtagRenderer('save_clicked')
|
||||
await formRef.value!.validate()
|
||||
await electron.ipcRenderer.invoke('write-storage-file', {
|
||||
fileName: 'boss-cookies.json',
|
||||
data: formContent.value.collectedCookies
|
||||
})
|
||||
ElMessage.success('Boss直聘 Cookie 保存成功')
|
||||
router.replace('/configuration')
|
||||
gtagRenderer('save_cookie_done')
|
||||
router.replace('/main-layout')
|
||||
}
|
||||
|
||||
const handleBossZhipinLoginPageClosed = () => {
|
||||
@@ -199,6 +221,9 @@ const handleBossZhipinLoginPageClosed = () => {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
gtagRenderer('cookie_assistant_mounted')
|
||||
})
|
||||
onMounted(async () => {
|
||||
electron.ipcRenderer.once('BOSS_ZHIPIN_COOKIE_COLLECTED', handleCookieCollected)
|
||||
electron.ipcRenderer.on('BOSS_ZHIPIN_LOGIN_PAGE_CLOSED', handleBossZhipinLoginPageClosed)
|
||||
@@ -226,6 +251,7 @@ onUnmounted(() => {
|
||||
.cookie-assistant-page {
|
||||
max-width: 640px;
|
||||
margin: 0 auto;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="first-run-readme" ref="componentRootEl">
|
||||
<div ref="componentRootEl" class="first-run-readme">
|
||||
<div class="first-run-readme__inner">
|
||||
<div class="readme-title">欢迎使用GeekGeekRun!祝您求职顺利~</div>
|
||||
<div class="readme-desc">
|
||||
@@ -12,25 +12,32 @@
|
||||
>
|
||||
<ElCheckbox :label="0" :class="[unreadItemsAfterClickSubmit[0] ? 'unread' : '']">
|
||||
本程序从某种程度上说属于辅助工具,与<el-link
|
||||
@click="
|
||||
electron.ipcRenderer.send(
|
||||
'open-external-link',
|
||||
'https://about.zhipin.com/agreement/'
|
||||
)
|
||||
color-blue
|
||||
@click.stop.prevent="
|
||||
() => {
|
||||
electron.ipcRenderer.send(
|
||||
'open-external-link',
|
||||
'https://about.zhipin.com/agreement/'
|
||||
)
|
||||
gtagRenderer('view_boss_agreement_clicked')
|
||||
}
|
||||
"
|
||||
>《Boss直聘用户协议》</el-link
|
||||
>相关条款相违背;
|
||||
根据该条款,如果一些非正常用户行为被风控监测到,您需要承受包括不仅限于<b
|
||||
class="color-red"
|
||||
>账号被强制退出登录</b
|
||||
>、<b class="color-red">账号被限制使用</b>、<b class="color-red">账号被封禁</b
|
||||
>(2023年3月版)相关条款相违背,您在注册Boss直聘时已签署过这一条款;根据该条款
|
||||
<i>七、用户的平台使用义务</i>、<i>八、违约责任</i>
|
||||
章节,如果一些非正常用户行为被风控监测到,您需要承受包括不仅限于<b class="color-red"
|
||||
>账号被强制退出登录、账号被限制使用、账号被封禁</b
|
||||
>等对您不利的风险;因此使用本程序即意味着<b class="color-red">您愿意接受以上风险</b
|
||||
>,且如果相关风险发生,<b class="color-red">您需要自行承担相关后果</b>,<b
|
||||
class="color-red"
|
||||
>本程序不负责</b
|
||||
>。
|
||||
>,且如果相关风险发生,<b class="color-red">您需要自行承担相关后果,本程序不负责</b>。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="1" :class="[unreadItemsAfterClickSubmit[1] ? 'unread' : '']">
|
||||
本程序需要存储您的登录凭据,即Cookie,来模拟您在Boss直聘上开聊Boss的行为;本程序仅会把您的Cookie存储在本地,并在您访问Boss直聘时将其传输到Boss直聘,<b
|
||||
class="color-red"
|
||||
>不会泄露给第三方</b
|
||||
>,也不会进行除自动开聊Boss以外的行为;<b class="color-red">请勿向他人泄漏您的Cookie</b
|
||||
>。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="2" :class="[unreadItemsAfterClickSubmit[2] ? 'unread' : '']">
|
||||
本程序会通过尽可能模仿用户行为来规避相关风险,但并不能保证可以完全规避。建议您使用本程序时<b
|
||||
class="color-red"
|
||||
>注意节制</b
|
||||
@@ -38,39 +45,58 @@
|
||||
>注册一个本程序专用的新的Boss直聘账号</b
|
||||
>进行求职。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="2" :class="[unreadItemsAfterClickSubmit[2] ? 'unread' : '']">
|
||||
本程序原理是模拟用户在Boss直聘网页上进行点击操作;Boss直聘网站每过一段时间会发生改版,且有可能包含A/B实验,这将导致本程序相关脚本失效,此时您可以点击程序左下角进行反馈。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="3" :class="[unreadItemsAfterClickSubmit[3] ? 'unread' : '']">
|
||||
您的雇主可能会对您的计算机终端或网络进行监控,从而审计、跟踪您的行为;建议您<b
|
||||
本程序原理是模拟用户在Boss直聘网页上,寻找关键元素并进行点击操作;Boss直聘网站经常<b>发生改版</b>,且有可能<b>包含A/B实验</b>,这将导致本程序相关脚本失效(典型表现为本程序运行到某一步骤后,<b
|
||||
class="color-red"
|
||||
>不要在您雇主提供的计算机终端或网络上使用本程序</b
|
||||
>。
|
||||
>浏览器重复“闪退、重新启动”</b
|
||||
>)。如果您在使用过程中遇上程序未按照预期执行的情况,请点击程序左下角进行反馈。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="4" :class="[unreadItemsAfterClickSubmit[4] ? 'unread' : '']">
|
||||
本程序需要存储您的登录凭据,即Cookie,来模拟您在Boss直聘上开聊Boss的行为;本程序仅会把您的Cookie存储在本地,并在您访问Boss直聘时将其传输到Boss直聘,<b
|
||||
class="color-red"
|
||||
>不会泄露给第三方</b
|
||||
>,也不会进行除自动开聊Boss以外的行为;<b class="color-red">请勿向他人泄漏您的Cookie</b
|
||||
您所在公司可能会对您的计算机终端或网络进行<b color-red>监控</b>,从而<b color-red
|
||||
>审计、跟踪</b
|
||||
>您的行为;上级 / HRBP 团队可能会从 IT
|
||||
团队处获取到监控数据,从而了解团队成员离职倾向。如果您不希望上级 / HRBP
|
||||
团队了解到您正在求职,建议您<b color-red
|
||||
>不要在您所在公司提供的计算机终端或网络上使用本程序</b
|
||||
>。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="5" :class="[unreadItemsAfterClickSubmit[5] ? 'unread' : '']">
|
||||
本程序<b class="color-red"
|
||||
>不会上报您的隐私(诸如能够识别出您身份的信息),不会向您的雇主报告您的求职行为</b
|
||||
>;如果您在使用过程中遇上程序错误,您可以点击程序左下角进行反馈。
|
||||
本程序尊重您的隐私,<b color-red
|
||||
>不会上报能够识别出您身份的信息、不会参与任何钓鱼活动、不会向您所在公司及上级 / HRBP
|
||||
团队报告您的求职行为、不会向猎头公司泄露您的信息</b
|
||||
>。
|
||||
</ElCheckbox>
|
||||
|
||||
<ElCheckbox :label="6" :class="[unreadItemsAfterClickSubmit[6] ? 'unread' : '']">
|
||||
<b class="color-red">本程序不对您的求职过程与结果负责</b
|
||||
>,为您开聊的职位均在Boss直聘上发布;请<b class="color-red">自行甄别为您开聊的公司</b
|
||||
>、<b class="color-red">认真决定是否参加面试</b>、<b class="color-red">慎重选择Offer</b
|
||||
本程序<b class="color-red">没有内置任何付费功能</b>,<b class="color-red"
|
||||
>下载、使用是免费的</b
|
||||
>,任何人可以<b class="color-red">免费获得、免费使用</b>。<b class="color-red"
|
||||
>作者没有利用本程序赚到过任何收入</b
|
||||
>。如果您是从GitHub以外的地方付费后“购买”的本程序,或您被提示“必须付费后才能使用本程序”,<b
|
||||
class="color-red"
|
||||
>那您大概率被骗了</b
|
||||
>,或者<b class="color-red">您下载到了本程序修改版</b>。<b class="color-red"
|
||||
>本程序对此概不负责,请勿找作者商讨退款、售后事宜,相关事宜请咨询卖方</b
|
||||
>。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="7" :class="[unreadItemsAfterClickSubmit[7] ? 'unread' : '']">
|
||||
请在Boss直聘上自行<b class="color-red">屏蔽您不期望投递的公司</b>。
|
||||
本程序<b class="color-red">不对您的求职过程与结果负责</b
|
||||
>,为您开聊的职位均在Boss直聘上发布,职位信息真实性由Boss直聘负责;请<b
|
||||
class="color-red"
|
||||
>自行甄别为您开聊的公司、认真决定是否参加面试、慎重选择Offer</b
|
||||
>。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="8" :class="[unreadItemsAfterClickSubmit[8] ? 'unread' : '']">
|
||||
本程序经历过了多次测试,理论上来说大部分情况下可以正常运行;如果您有顾虑,建议通过VMWare
|
||||
WorkStation/Fusion、VirtualBox、Hyper-V/Windows沙盒等虚拟化技术运行本程序。如发生问题,请点击程序左下角进行反馈。
|
||||
请在Boss直聘上自行<b class="color-red">屏蔽您不期望投递的公司</b
|
||||
>;如果您不希望您当前公司其它具有招聘账号的员工看到您在Boss直聘上活跃,请<b
|
||||
class="color-red"
|
||||
>在Boss直聘上屏蔽当前公司及与之关联的公司</b
|
||||
>。
|
||||
</ElCheckbox>
|
||||
<ElCheckbox :label="9" :class="[unreadItemsAfterClickSubmit[9] ? 'unread' : '']">
|
||||
本程序经历过了多次测试,理论上来说大部分情况下可以正常运行,但可能也会出现测试用例覆盖不到位,导致程序不按预期运行的情况;如果您有顾虑,建议通过
|
||||
VMware Workstation / Fusion、Oracle VirtualBox、Microsoft Hyper-V
|
||||
等虚拟化技术运行本程序。如果您在使用过程中遇上程序未按照预期执行的情况,请点击程序左下角进行反馈。
|
||||
</ElCheckbox>
|
||||
</ElCheckboxGroup>
|
||||
</article>
|
||||
@@ -86,22 +112,36 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElCheckbox, ElCheckboxGroup, ElMessage } from 'element-plus'
|
||||
import { ref, onMounted, onBeforeMount } from 'vue';
|
||||
import { ref, onMounted, onBeforeMount } from 'vue'
|
||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||
import { sleep } from '@geekgeekrun/utils/sleep.mjs'
|
||||
|
||||
const gtagRenderer = (name, params?: object) => {
|
||||
return baseGtagRenderer(name, {
|
||||
scene: 'first-run-agreement',
|
||||
...params
|
||||
})
|
||||
}
|
||||
const electron = window.electron
|
||||
|
||||
const readmeItemCheckStatusList = ref<number[]>([])
|
||||
|
||||
const handleCancel = () => {
|
||||
const handleCancel = async () => {
|
||||
gtagRenderer('cancel_clicked')
|
||||
await sleep(500)
|
||||
electron.ipcRenderer.invoke('exit-app-immediately')
|
||||
}
|
||||
|
||||
const unreadItemsAfterClickSubmit = ref<Record<number, true>>({})
|
||||
const handleSubmit = () => {
|
||||
const COUNT = 9
|
||||
gtagRenderer('submit_clicked')
|
||||
const COUNT = 10
|
||||
if (readmeItemCheckStatusList.value.length !== COUNT) {
|
||||
ElMessage.warning(
|
||||
`您还有${COUNT - readmeItemCheckStatusList.value.length}条没有读完,读完就打勾标记一下吧`
|
||||
)
|
||||
gtagRenderer('agreement_not_finish_read_tip_displayed')
|
||||
ElMessage.warning({
|
||||
message: `您还有${COUNT - readmeItemCheckStatusList.value.length}条没有读完,读完就打勾标记一下吧`,
|
||||
grouping: true
|
||||
})
|
||||
unreadItemsAfterClickSubmit.value = {}
|
||||
for (let i = 0; i < COUNT; i++) {
|
||||
if (!readmeItemCheckStatusList.value.includes(i)) {
|
||||
@@ -111,6 +151,7 @@ const handleSubmit = () => {
|
||||
return
|
||||
}
|
||||
electron.ipcRenderer.invoke('first-launch-notice-approve')
|
||||
gtagRenderer('submit_done')
|
||||
}
|
||||
const handleReadmeItemCheckStatusListChange = (value: number[]) => {
|
||||
value.forEach((it) => {
|
||||
@@ -122,13 +163,10 @@ const handleReadmeItemCheckStatusListChange = (value: number[]) => {
|
||||
const componentRootEl = ref<HTMLElement>()
|
||||
onMounted(() => {
|
||||
const ro = new ResizeObserver(() => {
|
||||
electron.ipcRenderer.send(
|
||||
'update-window-size',
|
||||
{
|
||||
width: componentRootEl.value!.offsetWidth,
|
||||
height: componentRootEl.value!.offsetHeight,
|
||||
}
|
||||
)
|
||||
electron.ipcRenderer.send('update-window-size', {
|
||||
width: componentRootEl.value!.offsetWidth,
|
||||
height: componentRootEl.value!.offsetHeight
|
||||
})
|
||||
})
|
||||
ro.observe(componentRootEl.value!)
|
||||
onBeforeMount(() => {
|
||||
|
||||
@@ -18,22 +18,26 @@ import { ref, onUnmounted, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import FlyingCompanyLogoList from '../../features/FlyingCompanyLogoList/index.vue'
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const { ipcRenderer } = electron
|
||||
const router = useRouter()
|
||||
|
||||
const handleStopButtonClick = async () => {
|
||||
gtagRenderer('gascwb_stop_button_clicked')
|
||||
ipcRenderer.invoke('stop-geek-auto-start-chat-with-boss')
|
||||
}
|
||||
|
||||
const isStopping = ref(false)
|
||||
const handleStopping = () => {
|
||||
gtagRenderer('gascwb_become_stopping')
|
||||
isStopping.value = true
|
||||
}
|
||||
ipcRenderer.once('geek-auto-start-chat-with-boss-stopping', handleStopping)
|
||||
|
||||
const handleStopped = () => {
|
||||
router.replace('/configuration/GeekAutoStartChatWithBoss')
|
||||
gtagRenderer('gascwb_become_stopped')
|
||||
router.replace('/main-layout/GeekAutoStartChatWithBoss')
|
||||
}
|
||||
ipcRenderer.once('geek-auto-start-chat-with-boss-stopped', handleStopped)
|
||||
|
||||
@@ -47,12 +51,14 @@ onMounted(async () => {
|
||||
await electron.ipcRenderer.invoke('run-geek-auto-start-chat-with-boss')
|
||||
} catch (err) {
|
||||
if (err instanceof Error && err.message.includes('NEED_TO_CHECK_RUNTIME_DEPENDENCIES')) {
|
||||
gtagRenderer('gascwb_cannot_run_for_corrupt')
|
||||
ElMessage.error({
|
||||
message: `核心组件损坏,正在尝试修复`
|
||||
})
|
||||
router.replace('/')
|
||||
}
|
||||
console.error(err)
|
||||
gtagRenderer('gascwb_cannot_run_for_unknown_error', { err })
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -16,22 +16,26 @@ import { ref, onUnmounted, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import FlyingCompanyLogoList from '../../features/FlyingCompanyLogoList/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const { ipcRenderer } = electron
|
||||
const router = useRouter()
|
||||
|
||||
const handleStopButtonClick = async () => {
|
||||
gtagRenderer('rnrr_stop_button_clicked')
|
||||
ipcRenderer.invoke('stop-geek-auto-start-chat-with-boss')
|
||||
}
|
||||
|
||||
const isStopping = ref(false)
|
||||
const handleStopping = () => {
|
||||
gtagRenderer('rnrr_become_stopping')
|
||||
isStopping.value = true
|
||||
}
|
||||
ipcRenderer.once('geek-auto-start-chat-with-boss-stopping', handleStopping)
|
||||
|
||||
const handleStopped = () => {
|
||||
router.replace('/configuration/ReadNoReplyReminder')
|
||||
gtagRenderer('rnrr_become_stopped')
|
||||
router.replace('/main-layout/ReadNoReplyReminder')
|
||||
}
|
||||
ipcRenderer.once('geek-auto-start-chat-with-boss-stopped', handleStopped)
|
||||
|
||||
@@ -45,12 +49,14 @@ onMounted(async () => {
|
||||
await electron.ipcRenderer.invoke('run-read-no-reply-auto-reminder')
|
||||
} catch (err) {
|
||||
if (err instanceof Error && err.message.includes('NEED_TO_CHECK_RUNTIME_DEPENDENCIES')) {
|
||||
gtagRenderer('rnrr_cannot_run_for_corrupt')
|
||||
ElMessage.error({
|
||||
message: `核心组件损坏,正在尝试修复`
|
||||
})
|
||||
router.replace('/')
|
||||
}
|
||||
console.error(err)
|
||||
gtagRenderer('rnrr_cannot_run_for_unknown_error', { err })
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
572
packages/ui/src/renderer/src/page/LlmConfig/index.vue
Normal file
@@ -0,0 +1,572 @@
|
||||
<template>
|
||||
<div class="llm-config-page">
|
||||
<div class="main-wrapper">
|
||||
<main>
|
||||
<div class="mt1em mb1em">
|
||||
<div class="flex flex-items-center flex-justify-between">
|
||||
<div>大语言模型设置</div>
|
||||
<el-dropdown
|
||||
@command="
|
||||
(item) => {
|
||||
gtagRenderer('provider_url_for_secret_clicked', {
|
||||
name: item.name
|
||||
})
|
||||
openExternalLink(item.url)
|
||||
}
|
||||
"
|
||||
>
|
||||
<el-button size="small"
|
||||
>获取 API Secret <el-icon class="el-icon--right"><arrow-down /></el-icon
|
||||
></el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="item in providerList" :key="item.name" :command="item">{{
|
||||
item.name
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<el-alert type="info" :closable="false" mb20px line-height-1.25em>
|
||||
<ul pl16px m0>
|
||||
<li>
|
||||
请确保当前服务商提供的模型支持<a
|
||||
:style="{
|
||||
color: 'var(--el-color-primary)'
|
||||
}"
|
||||
href="javascript:void(0)"
|
||||
@click.prevent="
|
||||
() => {
|
||||
gtagRenderer('chat_completion_intro_doc_link_clicked')
|
||||
openExternalLink(
|
||||
'https://api-docs.deepseek.com/zh-cn/api/create-chat-completion'
|
||||
)
|
||||
}
|
||||
"
|
||||
>对话补全</a
|
||||
>且兼容
|
||||
<a
|
||||
:style="{
|
||||
color: 'var(--el-color-primary)'
|
||||
}"
|
||||
href="javascript:void(0)"
|
||||
@click.prevent="
|
||||
() => {
|
||||
gtagRenderer('openai_sdk_intro_doc_link_clicked')
|
||||
openExternalLink('https://www.npmjs.com/package/openai')
|
||||
}
|
||||
"
|
||||
>OpenAI SDK</a
|
||||
>
|
||||
</li>
|
||||
<li><b class="color-red">暂不支持推理模型</b>(例如 DeepSeek-R1)</li>
|
||||
<li>
|
||||
请自行确保您所接入的服务商能够保护您的隐私。<b class="color-red"
|
||||
>此处所列举“服务商-模型”由第三方提供,仅供配置参考,本程序不能保证它们能够合法使用您的数据,不表示本程序认可相关模型</b
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</el-alert>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formContentForElForm"
|
||||
:rules="formRulesForElForm"
|
||||
label-position="top"
|
||||
class="llm-config-form"
|
||||
:validate-on-rule-change="false"
|
||||
>
|
||||
<div v-for="(conf, index) in formContent" :key="conf.id" class="flex gap12px">
|
||||
<div
|
||||
v-if="formContent.length > 1"
|
||||
:style="{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: '10px',
|
||||
height: 'fit-content',
|
||||
marginTop: '10px'
|
||||
}"
|
||||
>
|
||||
<el-button
|
||||
:disabled="index <= 0"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowUp"
|
||||
@click="moveConfigUp(index)"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="index >= formContent.length - 1"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowDown"
|
||||
@click="moveConfigDown(index)"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="1 >= formContent.length"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="Delete"
|
||||
@click="removeConfig(index)"
|
||||
/>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<el-form-item :prop="`${index}_providerCompleteApiUrl`">
|
||||
<div
|
||||
class="el-form-item__label flex-items-center flex-justify-between w-full pr0px"
|
||||
:style="{ display: 'flex' }"
|
||||
>
|
||||
<div>服务提供商 Base URL</div>
|
||||
<el-dropdown @command="(item) => handlePresetClick(item, index)">
|
||||
<el-button size="small"
|
||||
>配置模板 <el-icon class="el-icon--right"><arrow-down /></el-icon
|
||||
></el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="item in llmPresetList"
|
||||
:key="item.name"
|
||||
:command="item"
|
||||
>{{ item.name }}</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<el-input
|
||||
ref="firstInputRefList"
|
||||
v-model="conf.providerCompleteApiUrl"
|
||||
:autosize="{
|
||||
minRows: 10,
|
||||
maxRows: 10
|
||||
}"
|
||||
font-size-12px
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="model" label="要使用的模型(model参数)">
|
||||
<el-input
|
||||
v-model="conf.model"
|
||||
:autosize="{
|
||||
minRows: 10,
|
||||
maxRows: 10
|
||||
}"
|
||||
font-size-12px
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="providerApiSecret" label="从服务提供商处获取的 API Secret">
|
||||
<el-input
|
||||
v-model="conf.providerApiSecret"
|
||||
:autosize="{
|
||||
minRows: 10,
|
||||
maxRows: 10
|
||||
}"
|
||||
font-size-12px
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<div class="serve-weight-config">
|
||||
<div class="flex">
|
||||
<el-form-item prop="enabled">
|
||||
<div class="el-form-item__label">启用</div>
|
||||
<el-checkbox
|
||||
v-if="formContent.length > 1"
|
||||
v-model="conf.enabled"
|
||||
font-size-12px
|
||||
@click="
|
||||
nextTick(() =>
|
||||
gtagRenderer('model_enable_status_changed', { enabled: conf.enabled })
|
||||
)
|
||||
"
|
||||
></el-checkbox>
|
||||
<el-checkbox v-else :model-value="true" font-size-12px disabled />
|
||||
</el-form-item>
|
||||
<el-form-item prop="serveWeight" class="ml40px">
|
||||
<div class="el-form-item__label">权重</div>
|
||||
<el-input-number
|
||||
v-if="formContent.length > 1"
|
||||
v-model="conf.serveWeight"
|
||||
:min="1"
|
||||
:max="100"
|
||||
:step="1"
|
||||
step-strictly
|
||||
:precision="0"
|
||||
font-size-12px
|
||||
placeholder="1 ~ 100"
|
||||
@change="
|
||||
(new_val, old_val) => {
|
||||
gtagRenderer('serve_weight_changed', { new_val, old_val })
|
||||
}
|
||||
"
|
||||
></el-input-number>
|
||||
<el-input-number
|
||||
v-else
|
||||
font-size-12px
|
||||
:model-value="SINGLE_ITEM_DEFAULT_SERVE_WEIGHT"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<!-- <el-form-item class="ml20px">
|
||||
<el-button type="text">测试设置</el-button>
|
||||
</el-form-item> -->
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="index !== formContent.length - 1"
|
||||
class="mt6px mb20px h1px"
|
||||
style="background-color: #dcdcdc"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</main>
|
||||
</div>
|
||||
<footer pt10px pb10px flex flex-justify-center>
|
||||
<div w480px flex flex-justify-between>
|
||||
<div>
|
||||
<el-button font-size-12px type="text" @click="addConfig"
|
||||
>添加备用模型<span v-if="formContent.length <= 1">,以生成更随机的内容</span></el-button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<el-button @click="handleCancel">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
ElForm,
|
||||
ElDropdown,
|
||||
ElDropdownMenu,
|
||||
ElDropdownItem,
|
||||
ElIcon,
|
||||
ElButton,
|
||||
ElInput,
|
||||
ElMessage
|
||||
} from 'element-plus'
|
||||
import { ArrowUp, ArrowDown, Delete } from '@element-plus/icons-vue'
|
||||
import { ref, onMounted, watch, nextTick, computed } from 'vue'
|
||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||
import { SINGLE_ITEM_DEFAULT_SERVE_WEIGHT } from '../../../../common/constant'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
import { sleep } from '@geekgeekrun/utils/sleep.mjs'
|
||||
interface LlmConfigItem {
|
||||
id: string
|
||||
providerCompleteApiUrl: string
|
||||
providerApiSecret: string
|
||||
model: string
|
||||
serveWeight: number
|
||||
enabled: true
|
||||
}
|
||||
|
||||
const gtagRenderer = (name, params?: object) => {
|
||||
return baseGtagRenderer(name, {
|
||||
scene: 'llm-config',
|
||||
...params
|
||||
})
|
||||
}
|
||||
|
||||
function getNewConfigItem(): LlmConfigItem {
|
||||
return {
|
||||
id: uuid(),
|
||||
providerCompleteApiUrl: '',
|
||||
providerApiSecret: '',
|
||||
model: '',
|
||||
serveWeight: 10,
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
const formContent = ref<LlmConfigItem[]>([getNewConfigItem()])
|
||||
|
||||
const formContentForElForm = computed(() => {
|
||||
const valueMap = {}
|
||||
formContent.value.forEach((configItem, i) => {
|
||||
valueMap[`${i}_providerCompleteApiUrl`] = configItem.providerCompleteApiUrl
|
||||
})
|
||||
return valueMap
|
||||
})
|
||||
const formRulesForElForm = computed(() => {
|
||||
const valueMap = {}
|
||||
formContent.value.forEach((_, i) => {
|
||||
valueMap[`${i}_providerCompleteApiUrl`] = [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入服务提供商 Base URL'
|
||||
},
|
||||
{
|
||||
trigger: 'blur',
|
||||
validator(_, value, cb) {
|
||||
try {
|
||||
new URL(value?.trim())
|
||||
} catch (err) {
|
||||
cb(`URL 格式无效,请重新输入`)
|
||||
}
|
||||
if (/^http(s)?:\/\//.test(value)) {
|
||||
cb()
|
||||
return
|
||||
}
|
||||
cb(`服务提供商 Base URL 无效,请重新输入`)
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
return valueMap
|
||||
})
|
||||
|
||||
const handleCancel = () => {
|
||||
gtagRenderer('cancel_clicked')
|
||||
electron.ipcRenderer.send('close-llm-config')
|
||||
gtagRenderer('cancel_done')
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
gtagRenderer('submit_clicked', { llm_config_length: formContent.value.length })
|
||||
await formRef.value?.validate()
|
||||
if (!formContent.value.length) {
|
||||
gtagRenderer('empty_model_list')
|
||||
ElMessage.warning({
|
||||
message: '可选模型列表为空,请出现填写'
|
||||
})
|
||||
formContent.value = [getNewConfigItem()]
|
||||
return
|
||||
} else if (formContent.value.length > 1) {
|
||||
const firstEnabledModel = formContent.value.find(it => it.enabled)
|
||||
if (!firstEnabledModel) {
|
||||
gtagRenderer('no_enabled_model_find_in_model_list')
|
||||
ElMessage.warning({
|
||||
dangerouslyUseHTMLString: true,
|
||||
grouping: true,
|
||||
message: '<div style="white-space: nowrap">所有模型均被禁用;请至少启用一个模型</div>'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
electron.ipcRenderer.invoke('save-llm-config', JSON.parse(JSON.stringify(formContent.value)))
|
||||
gtagRenderer('submit_done')
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
const savedFileContent = (await electron.ipcRenderer.invoke('fetch-config-file-content'))
|
||||
?.config?.['llm.json']
|
||||
if (!savedFileContent?.length) {
|
||||
return
|
||||
}
|
||||
const keyOfItem = Object.keys(getNewConfigItem())
|
||||
formContent.value = savedFileContent.map((it) => {
|
||||
const conf: any = {}
|
||||
for (const k of keyOfItem) {
|
||||
conf[k] = it[k]
|
||||
}
|
||||
if (!it.id) {
|
||||
conf.id = uuid()
|
||||
}
|
||||
return conf
|
||||
})
|
||||
})
|
||||
|
||||
const llmPresetList: {
|
||||
name: string
|
||||
config: Omit<LlmConfigItem, 'id'>
|
||||
}[] = [
|
||||
{
|
||||
name: '由 DeepSeek 提供的 DeepSeek-V3 模型',
|
||||
config: {
|
||||
model: 'deepseek-chat',
|
||||
providerApiSecret: '',
|
||||
providerCompleteApiUrl: 'https://api.deepseek.com/v1',
|
||||
serveWeight: 100,
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '由 火山引擎 提供的 DeepSeek-V3 模型',
|
||||
config: {
|
||||
model: 'deepseek-v3-250324',
|
||||
providerApiSecret: '',
|
||||
providerCompleteApiUrl: 'https://ark.cn-beijing.volces.com/api/v3',
|
||||
serveWeight: 100,
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '由 阿里云百炼 提供的 DeepSeek-V3 模型',
|
||||
config: {
|
||||
model: 'deepseek-v3',
|
||||
providerApiSecret: '',
|
||||
providerCompleteApiUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
|
||||
serveWeight: 100,
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
// TODO:
|
||||
// {
|
||||
// name: '通过 Ollama 部署的 DeepSeek-R1(14B)模型',
|
||||
// config: {
|
||||
// model: 'deepseek-r1:14b',
|
||||
// providerApiSecret: 'ollama',
|
||||
// providerCompleteApiUrl: 'http://127.0.0.1:11434/v1',
|
||||
// serveWeight: 10,
|
||||
// enabled: true
|
||||
// }
|
||||
// },
|
||||
{
|
||||
name: '由 free.v36.cm 提供的 GPT-4o mini 模型',
|
||||
config: {
|
||||
model: 'gpt-4o-mini',
|
||||
providerApiSecret: 'sk-P3kvkV6UZ9WMy6AH792480Fc5e1c4dAb8aE17b20FcAc4eC3',
|
||||
providerCompleteApiUrl: 'https://free.v36.cm/v1',
|
||||
serveWeight: 20,
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '通过 Ollama 部署的 Qwen2.5(7B)模型',
|
||||
config: {
|
||||
model: 'qwen2.5:7b',
|
||||
providerApiSecret: 'ollama',
|
||||
providerCompleteApiUrl: 'http://127.0.0.1:11434/v1',
|
||||
serveWeight: 10,
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
const providerList: Array<{ name: string; url: string }> = [
|
||||
{
|
||||
name: 'DeepSeek',
|
||||
url: 'https://platform.deepseek.com/'
|
||||
},
|
||||
{
|
||||
name: '火山引擎 - 火山方舟',
|
||||
url: 'https://console.volcengine.com/ark'
|
||||
},
|
||||
{
|
||||
name: '阿里云百炼',
|
||||
url: 'https://bailian.console.aliyun.com/?tab=model#/api-key'
|
||||
},
|
||||
{
|
||||
name: 'OpenAI (国内可能不可用)',
|
||||
url: 'https://platform.openai.com/api-keys'
|
||||
},
|
||||
{
|
||||
name: 'FREE-CHATGPT-API (免费)',
|
||||
url: 'https://github.com/popjane/free_chatgpt_api'
|
||||
}
|
||||
]
|
||||
|
||||
function handlePresetClick(selected: (typeof llmPresetList)[number], index) {
|
||||
gtagRenderer('model_preset_clicked', {
|
||||
name: selected.name
|
||||
})
|
||||
for (const k of Object.keys(formContent.value[index])) {
|
||||
formContent.value[index][k] = selected.config[k]
|
||||
}
|
||||
if (!formContent.value[index].id) {
|
||||
formContent.value[index].id = uuid()
|
||||
}
|
||||
}
|
||||
|
||||
const firstInputRefList = ref<InstanceType<typeof ElInput>[]>([])
|
||||
function addConfig() {
|
||||
gtagRenderer('new_config_item_added', { config_list_length_before_add: formContent.value.length })
|
||||
formContent.value.push(getNewConfigItem())
|
||||
nextTick(() => {
|
||||
firstInputRefList.value[firstInputRefList.value.length - 1]?.focus()
|
||||
})
|
||||
}
|
||||
function moveConfigUp(index) {
|
||||
;[formContent.value[index], formContent.value[index - 1]] = [
|
||||
formContent.value[index - 1],
|
||||
formContent.value[index]
|
||||
]
|
||||
gtagRenderer('config_item_moved_up')
|
||||
}
|
||||
|
||||
function moveConfigDown(index) {
|
||||
;[formContent.value[index], formContent.value[index + 1]] = [
|
||||
formContent.value[index + 1],
|
||||
formContent.value[index]
|
||||
]
|
||||
gtagRenderer('config_item_moved_down')
|
||||
}
|
||||
|
||||
function removeConfig(index) {
|
||||
formContent.value.splice(index, 1)
|
||||
gtagRenderer('config_item_removed')
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formContent.value.length,
|
||||
async (nVal) => {
|
||||
await sleep(100)
|
||||
if (nVal <= 1) {
|
||||
electron.ipcRenderer.send('update-window-size', {
|
||||
width: window.innerWidth,
|
||||
height: 576
|
||||
})
|
||||
} else {
|
||||
electron.ipcRenderer.send('update-window-size', {
|
||||
width: window.innerWidth,
|
||||
height: 730
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
const openExternalLink = (url) => {
|
||||
electron.ipcRenderer.send('open-external-link', url)
|
||||
}
|
||||
|
||||
// function handleTestAvailability() {}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.llm-config-page {
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
.main-wrapper {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
main {
|
||||
margin: 0 auto;
|
||||
max-width: 480px;
|
||||
}
|
||||
}
|
||||
footer {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.llm-config-form.el-form {
|
||||
.el-form-item__error--inline {
|
||||
margin-left: 0;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.serve-weight-config {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.el-form-item__label {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.el-form-item__content {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -19,7 +19,17 @@
|
||||
</div>
|
||||
<div class="flex flex-0 flex-justify-between pt10px pb10px">
|
||||
<div class="w100px">
|
||||
<el-button :loading="isTableLoading" size="small" @click="getBossLibrary">刷新</el-button>
|
||||
<el-button
|
||||
:loading="isTableLoading"
|
||||
size="small"
|
||||
@click="
|
||||
() => {
|
||||
gtagRenderer('boss_library_refresh_clicked')
|
||||
getBossLibrary()
|
||||
}
|
||||
"
|
||||
>刷新</el-button
|
||||
>
|
||||
</div>
|
||||
<ElPagination
|
||||
v-model:current-page="pagination.pageNo"
|
||||
@@ -42,6 +52,7 @@ import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { ElTable, ElTableColumn, ElButton, ElPagination } from 'element-plus'
|
||||
import { type VChatStartupLog } from '@geekgeekrun/sqlite-plugin/src/entity/VChatStartupLog'
|
||||
import { PageReq, PagedRes } from '../../../../common/types/pagination'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const tableData = ref<VChatStartupLog[]>([])
|
||||
const pageSizeList = ref<number[]>([100, 200, 300, 400])
|
||||
@@ -54,6 +65,10 @@ const tableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const isTableLoading = ref(false)
|
||||
async function getBossLibrary() {
|
||||
try {
|
||||
gtagRenderer('boss_library_request_sent', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
isTableLoading.value = true
|
||||
const { data: res } = (await electron.ipcRenderer.invoke('get-boss-library', {
|
||||
pageNo: pagination.value.pageNo,
|
||||
@@ -65,7 +80,16 @@ async function getBossLibrary() {
|
||||
pageNo: res.pageNo,
|
||||
pageSize: pagination.value.pageSize
|
||||
}
|
||||
gtagRenderer('boss_library_request_success', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
} catch (err) {
|
||||
gtagRenderer('boss_library_request_error', {
|
||||
err,
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
console.log(err)
|
||||
tableData.value = []
|
||||
} finally {
|
||||
@@ -23,7 +23,15 @@
|
||||
</div>
|
||||
<div class="flex flex-0 flex-justify-between pt10px pb10px">
|
||||
<div class="w100px">
|
||||
<el-button :loading="isTableLoading" size="small" @click="getCompanyLibrary"
|
||||
<el-button
|
||||
:loading="isTableLoading"
|
||||
size="small"
|
||||
@click="
|
||||
() => {
|
||||
gtagRenderer('company_library_refresh_clicked')
|
||||
getCompanyLibrary()
|
||||
}
|
||||
"
|
||||
>刷新</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -49,6 +57,7 @@ import { ElTable, ElTableColumn, ElButton, ElPagination } from 'element-plus'
|
||||
import { type VChatStartupLog } from '@geekgeekrun/sqlite-plugin/src/entity/VChatStartupLog'
|
||||
import { PageReq, PagedRes } from '../../../../common/types/pagination'
|
||||
import { formatCompanyScale } from '@geekgeekrun/sqlite-plugin/src/utils/parser'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const tableData = ref<VChatStartupLog[]>([])
|
||||
const pageSizeList = ref<number[]>([100, 200, 300, 400])
|
||||
@@ -64,6 +73,10 @@ const tableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const isTableLoading = ref(false)
|
||||
async function getCompanyLibrary() {
|
||||
try {
|
||||
gtagRenderer('company_library_request_sent', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
isTableLoading.value = true
|
||||
const { data: res } = (await electron.ipcRenderer.invoke('get-company-library', {
|
||||
pageNo: pagination.value.pageNo,
|
||||
@@ -75,7 +88,16 @@ async function getCompanyLibrary() {
|
||||
pageNo: res.pageNo,
|
||||
pageSize: pagination.value.pageSize
|
||||
}
|
||||
gtagRenderer('company_library_request_success', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
} catch (err) {
|
||||
gtagRenderer('company_library_request_error', {
|
||||
err,
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
console.log(err)
|
||||
tableData.value = []
|
||||
} finally {
|
||||
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="modelValue?.length">
|
||||
<div>当前已选择城市:</div>
|
||||
<div flex flex-wrap gap-10px>
|
||||
<el-tag v-for="it in modelValue" :key="it">
|
||||
{{ it }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div>当前未选择任何期望城市,将不会按照城市进行筛选</div>
|
||||
</div>
|
||||
<div
|
||||
line-height-1
|
||||
:style="{
|
||||
marginTop: modelValue?.length ? '10px' : ''
|
||||
}"
|
||||
>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="
|
||||
() => {
|
||||
isDialogVisible = true
|
||||
gtagRenderer('choose_city_entry_button_clicked')
|
||||
}
|
||||
"
|
||||
>选择城市</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="modelValue?.length"
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="handleClearSelectedCitiesInModelValue"
|
||||
>清空已选择的所有城市</el-button
|
||||
>
|
||||
</div>
|
||||
<el-dialog
|
||||
v-model="isDialogVisible"
|
||||
width="1000px"
|
||||
title="请选择城市"
|
||||
:show-close="false"
|
||||
@open="handleDialogOpen"
|
||||
@closed="handleDialogClosed"
|
||||
>
|
||||
<el-tabs v-model="activeTabName">
|
||||
<el-tab-pane
|
||||
:style="{ height: '300px', overflow: 'auto' }"
|
||||
label="热门城市"
|
||||
name="热门城市"
|
||||
>
|
||||
<el-checkbox-group v-model="selectedCities">
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr 1fr 1fr'
|
||||
}"
|
||||
>
|
||||
<el-checkbox
|
||||
v-for="op in hotCityList.filter((it) => it.code !== 100010000)"
|
||||
:key="op.code"
|
||||
:label="op.name"
|
||||
>
|
||||
{{ op.name }}
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane
|
||||
v-for="it in cityGroupsByAlphabetMap.keys()"
|
||||
:key="it"
|
||||
:style="{ height: '300px', overflow: 'auto' }"
|
||||
:label="it"
|
||||
:value="it"
|
||||
>
|
||||
<div v-for="group in cityGroupsByAlphabetMap.get(it)" :key="group.firstChar">
|
||||
{{ group.firstChar }}
|
||||
<el-checkbox-group v-model="selectedCities">
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr 1fr 1fr'
|
||||
}"
|
||||
>
|
||||
<el-checkbox v-for="op in group.cityList" :key="op.code" :label="op.name">
|
||||
{{ op.name }}
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<template #footer>
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between'
|
||||
}"
|
||||
>
|
||||
<div>
|
||||
<el-button
|
||||
v-if="selectedCities.length"
|
||||
type="danger"
|
||||
@click="handleClearSelectedCitiesInDialog"
|
||||
>清空已选择的所有城市</el-button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<el-button @click="handleCancelClicked">取消</el-button>
|
||||
<el-button type="primary" @click="handleConfirmClicked">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PropType, ref } from 'vue'
|
||||
import cityGroupData from '../../../../../../common/constant/cityGroup.json'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array as PropType<string[]>
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
const { hotCityList, cityGroup } = cityGroupData.zpData
|
||||
|
||||
const activeTabName = ref('热门城市')
|
||||
const isDialogVisible = ref(false)
|
||||
const selectedCities = ref([])
|
||||
|
||||
const cityGroupsByAlphabetMap = ref(
|
||||
new Map(['ABCDE', 'FGHJ', 'KLMN', 'PQRST', 'WXYZ'].map((it) => [it, []]))
|
||||
)
|
||||
for (const group of cityGroup) {
|
||||
const { firstChar } = group
|
||||
const targetKey =
|
||||
[...cityGroupsByAlphabetMap.value.keys()].find((it) => it.includes(firstChar)) ?? null
|
||||
if (!targetKey) {
|
||||
if (!cityGroupsByAlphabetMap.value.get(targetKey)) {
|
||||
cityGroupsByAlphabetMap.value.set(targetKey, [])
|
||||
}
|
||||
}
|
||||
cityGroupsByAlphabetMap.value.get(targetKey)?.push(group)
|
||||
}
|
||||
|
||||
function handleDialogOpen() {
|
||||
activeTabName.value = '热门城市'
|
||||
selectedCities.value = [...(props.modelValue ?? [])]
|
||||
gtagRenderer('choose_city_dialog_open')
|
||||
}
|
||||
|
||||
function handleCancelClicked() {
|
||||
gtagRenderer('choose_city_cancel_button_clicked')
|
||||
isDialogVisible.value = false
|
||||
}
|
||||
function handleConfirmClicked() {
|
||||
gtagRenderer('choose_city_confirm_button_clicked', { value: selectedCities.value.join(',') })
|
||||
isDialogVisible.value = false
|
||||
emits('update:modelValue', [...(selectedCities.value ?? [])])
|
||||
}
|
||||
function handleDialogClosed() {
|
||||
selectedCities.value = []
|
||||
gtagRenderer('choose_city_dialog_closed')
|
||||
}
|
||||
|
||||
function handleClearSelectedCitiesInModelValue() {
|
||||
emits('update:modelValue', [])
|
||||
gtagRenderer('clear_selected_cities_in_mv_clicked')
|
||||
}
|
||||
function handleClearSelectedCitiesInDialog() {
|
||||
selectedCities.value = []
|
||||
gtagRenderer('clear_selected_cities_in_dialog_clicked')
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,233 @@
|
||||
import { JobDetailRegExpMatchLogic } from '@geekgeekrun/sqlite-plugin/src/enums'
|
||||
|
||||
const expectJobFilterTemplateList = [
|
||||
{
|
||||
type: '不限职位',
|
||||
name: '不限职位(随便投)',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: 'Java',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '\\bJava\\b',
|
||||
expectJobDescRegExpStr:
|
||||
'\\bJava\\b|JVM|消息队列|MQ|SQL|Oracle|MongoDB|Redis|Nginx|Dubbo|Docker|K8s|Kubernetes',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: 'Golang',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '\\bGolang\\b',
|
||||
expectJobDescRegExpStr:
|
||||
'\\bGo\\b|\\bGolang\\b|消息队列|MQ|SQL|Oracle|MongoDB|Redis|Nginx|Dubbo|Docker|K8s|Kubernetes',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: '前端开发工程师',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '前端|H5|\\bFE\\b',
|
||||
expectJobTypeRegExpStr: '前端开发|javascript',
|
||||
expectJobDescRegExpStr: '前端|vue|react|node|\\bjs\\b|javascript|H5',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: '前端开发工程师(不考虑外包、兼职)',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '^(?=.*(前端|H5|\\bFE\\b))(?!.*(?:外包|驻场|外派|兼职|短期))',
|
||||
expectJobTypeRegExpStr: '前端开发|javascript',
|
||||
expectJobDescRegExpStr:
|
||||
'^(?=.*(前端|vue|react|node|\\bjs\\b|javascript|H5))(?!.*(?:外包|驻场|外派|兼职|短期))',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: '测试工程师、测试开发',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '测试|测开|QA|质量',
|
||||
expectJobTypeRegExpStr: '测试工程师|测试开发',
|
||||
expectJobDescRegExpStr:
|
||||
'测试|测开|QA|线上问题|自动化|复盘|效率|Selenium|Puppeteer|Playwright|Cypress|JMeter|LoadRunner|QTP|TestNG|JUnit|Pytest|Fiddler|Charles|Jenkins|Appium|黑盒|白盒|用例|缺陷|Linux|Ubuntu|Debian|CentOS|Shell|c\\+\\+|Python|PHP|\\bJava\\b|Node|\\bGo\\b|\\bGolang\\b',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: '运维工程师、运维开发工程师',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '运维(开发)?|SRE',
|
||||
expectJobTypeRegExpStr: '运维(开发)?工程师',
|
||||
expectJobDescRegExpStr:
|
||||
'运维|SRE|服务器|云计算|Docker|K8s|Kubernetes|Linux|Ubuntu|Debian|CentOS|Shell|Python|\\bGo\\b|\\bGolang\\b|监控|Prometheus|Grafana|ELK|负载均衡|部署|Nginx|Apache|DevOps|harbor',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: '数据开发',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '数据开发',
|
||||
expectJobDescRegExpStr: 'c\\+\\+|Python|\\bGo\\b|\\bGolang\\b|\\bJava\\b|Node|数据仓库|ETL|大数据|Hadoop|Spark|Flink|Hive|Presto|数据湖|数仓|SQL|Oracle|MongoDB|Redis|Kafka',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '互联网/AI',
|
||||
name: '实施工程师',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '实施',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '产品',
|
||||
name: '产品经理',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '产品经理',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '产品',
|
||||
name: '用户研究',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '用户研究',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '产品',
|
||||
name: '游戏策划',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '游戏策划',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '客服/运营',
|
||||
name: '产品运营',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '产品运营',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '客服/运营',
|
||||
name: '用户运营',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '用户运营',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '客服/运营',
|
||||
name: '数据标注/AI训练师',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '',
|
||||
expectJobTypeRegExpStr: '数据标注|AI训练师',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '财务/审计/税务',
|
||||
name: '会计、出纳',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '会计|Accountant|出纳|财务',
|
||||
expectJobTypeRegExpStr: '会计|出纳',
|
||||
expectJobDescRegExpStr:
|
||||
'会计|财务|出纳|审计|账务|税务|总账|做账|应付|应收|成本|资产|资金|记账|发票|结算|核算|汇算|利润|对账|报税|回款|SAP|用友|金蝶',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '人力/行政/法务',
|
||||
name: '人力资源专员/助理、人力资源经理/主管',
|
||||
config: {
|
||||
expectJobNameRegExpStr: 'HR|人力|人资|人事',
|
||||
expectJobTypeRegExpStr: '人力',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '人力/行政/法务',
|
||||
name: 'HRBP',
|
||||
config: {
|
||||
expectJobNameRegExpStr: 'BP|HRG|HR|人力|人资|人事',
|
||||
expectJobTypeRegExpStr: 'HRBP|人力',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '人力/行政/法务',
|
||||
name: '员工关系',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '员工关系|劳动关系|SSC|社保|HR|人力|人资|人事',
|
||||
expectJobTypeRegExpStr: '员工关系|人力',
|
||||
expectJobDescRegExpStr: '员工关系|劳动关系|SSC|社保|考勤|入职|离职|入转调离',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '人力/行政/法务',
|
||||
name: '招聘',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '招聘|高招|Recruiter|HR|人力|人资|人事',
|
||||
expectJobTypeRegExpStr: '招聘|猎头|人力',
|
||||
expectJobDescRegExpStr:
|
||||
'招聘|高招|Recruiter|简历|面试|人才引进|Mapping|人才画像|offer|猎头|内推|外推|猎聘|Boss|拉勾|前程无忧|智联|58同城|领英|LinkedIn|ATS|人才库|Moka|北森|iTenant|倍罗|大易',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '人力/行政/法务',
|
||||
name: '薪酬绩效',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '薪酬|绩效|福利|COE|payroll',
|
||||
expectJobTypeRegExpStr: '薪酬绩效',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
{
|
||||
type: '人力/行政/法务',
|
||||
name: '企业文化',
|
||||
config: {
|
||||
expectJobNameRegExpStr: '企业文化|组织文化|组织|OC|廉洁|反腐',
|
||||
expectJobTypeRegExpStr: '企业文化',
|
||||
expectJobDescRegExpStr: '',
|
||||
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.SOME
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
export default expectJobFilterTemplateList
|
||||
@@ -55,7 +55,17 @@
|
||||
</div>
|
||||
<div class="flex flex-0 flex-justify-between pt10px pb10px">
|
||||
<div class="w100px">
|
||||
<el-button :loading="isTableLoading" size="small" @click="getJobLibrary">刷新</el-button>
|
||||
<el-button
|
||||
:loading="isTableLoading"
|
||||
size="small"
|
||||
@click="
|
||||
() => {
|
||||
gtagRenderer('job_library_refresh_clicked')
|
||||
getJobLibrary()
|
||||
}
|
||||
"
|
||||
>刷新</el-button
|
||||
>
|
||||
</div>
|
||||
<ElPagination
|
||||
v-model:current-page="pagination.pageNo"
|
||||
@@ -74,7 +84,13 @@
|
||||
<JobInfoSnapshot
|
||||
v-if="selectedJobInfoForViewSnapshot"
|
||||
:job-info="selectedJobInfoForViewSnapshot"
|
||||
@closed="selectedJobInfoForViewSnapshot = null"
|
||||
scene="jobLibrary"
|
||||
@closed="
|
||||
() => {
|
||||
gtagRenderer('job_info_snapshot_closed')
|
||||
selectedJobInfoForViewSnapshot = null
|
||||
}
|
||||
"
|
||||
/>
|
||||
</ElDrawer>
|
||||
<ElDialog
|
||||
@@ -92,6 +108,7 @@
|
||||
:job-info-history-list="selectedJobHistory ?? []"
|
||||
@closed="
|
||||
() => {
|
||||
gtagRenderer('job_library_list_dialog_closed')
|
||||
selectedJobInfoForViewHistory = null
|
||||
selectedJobHistory = null
|
||||
}
|
||||
@@ -109,6 +126,7 @@ import { type JobInfoChangeLog } from '@geekgeekrun/sqlite-plugin/src/entity/Job
|
||||
import { PageReq, PagedRes } from '../../../../common/types/pagination'
|
||||
import JobInfoSnapshot from '../../features/JobInfoSnapshot/index.vue'
|
||||
import JobInfoHistoryList from '../../features/JobInfoHistoryList/index.vue'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const tableData = ref<VChatStartupLog[]>([])
|
||||
const pageSizeList = ref<number[]>([100, 200, 300, 400])
|
||||
@@ -121,6 +139,10 @@ const tableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const isTableLoading = ref(false)
|
||||
async function getJobLibrary() {
|
||||
try {
|
||||
gtagRenderer('job_library_request_sent', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
isTableLoading.value = true
|
||||
const { data: res } = (await electron.ipcRenderer.invoke('get-job-library', {
|
||||
pageNo: pagination.value.pageNo,
|
||||
@@ -132,7 +154,16 @@ async function getJobLibrary() {
|
||||
pageNo: res.pageNo,
|
||||
pageSize: pagination.value.pageSize
|
||||
}
|
||||
gtagRenderer('job_library_request_success', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
} catch (err) {
|
||||
gtagRenderer('job_library_request_error', {
|
||||
err,
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
console.log(err)
|
||||
tableData.value = []
|
||||
} finally {
|
||||
@@ -160,10 +191,12 @@ const drawVisibleModelValue = ref(false)
|
||||
const selectedJobInfoForViewSnapshot = ref<VChatStartupLog | null>(null)
|
||||
|
||||
function handleViewJobSnapshotButtonClick(record: VChatStartupLog) {
|
||||
gtagRenderer('view_job_snapshot_button_clicked')
|
||||
selectedJobInfoForViewSnapshot.value = record
|
||||
drawVisibleModelValue.value = true
|
||||
}
|
||||
async function handleViewJobOnlineButtonClick(encryptJobId: string) {
|
||||
gtagRenderer('view_job_online_button_clicked')
|
||||
return await electron.ipcRenderer.invoke('open-site-with-boss-cookie', {
|
||||
url: `https://www.zhipin.com/job_detail/${encryptJobId}.html`
|
||||
})
|
||||
@@ -173,6 +206,7 @@ const historyDialogVisibleModelValue = ref(false)
|
||||
const selectedJobInfoForViewHistory = ref<VChatStartupLog | null>(null)
|
||||
const selectedJobHistory = ref<null | JobInfoChangeLog[]>(null)
|
||||
async function handleViewJobHistoryButtonClick(record: VChatStartupLog) {
|
||||
gtagRenderer('view_job_history_button_clicked')
|
||||
let { data: historyList } = await electron.ipcRenderer.invoke(
|
||||
'get-job-history-by-encrypt-id',
|
||||
record.encryptJobId
|
||||
@@ -227,12 +261,13 @@ async function handleViewJobHistoryButtonClick(record: VChatStartupLog) {
|
||||
// })
|
||||
|
||||
if (!historyList.length) {
|
||||
gtagRenderer('job_history_is_not_found')
|
||||
ElMessage.warning({
|
||||
message: '未找到与此条目相关的历史变更记录,再多投一投吧'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
gtagRenderer('job_history_is_found')
|
||||
historyDialogVisibleModelValue.value = true
|
||||
selectedJobInfoForViewHistory.value = record
|
||||
selectedJobHistory.value = historyList
|
||||
@@ -38,6 +38,18 @@
|
||||
<template v-else-if="row.markReason === MarkAsNotSuitReason.JOB_NOT_SUIT">
|
||||
<strong>{{ markReasonTopicMap[row.markReason] }}</strong>
|
||||
</template>
|
||||
<template v-if="row.markReason === MarkAsNotSuitReason.JOB_CITY_NOT_SUIT">
|
||||
<strong>{{ markReasonTopicMap[row.markReason] }}</strong>
|
||||
<pre class="m-0 of-auto">{{ formatMarkReason(row) }}</pre>
|
||||
</template>
|
||||
<template v-if="row.markReason === MarkAsNotSuitReason.JOB_WORK_EXP_NOT_SUIT">
|
||||
<strong>{{ markReasonTopicMap[row.markReason] }}</strong>
|
||||
<pre class="m-0 of-auto">{{ formatMarkReason(row) }}</pre>
|
||||
</template>
|
||||
<template v-if="row.markReason === MarkAsNotSuitReason.JOB_SALARY_NOT_SUIT">
|
||||
<strong>{{ markReasonTopicMap[row.markReason] }}</strong>
|
||||
<pre class="m-0 of-auto">{{ formatMarkReason(row) }}</pre>
|
||||
</template>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="experienceName" label="工作经验" />
|
||||
@@ -72,7 +84,15 @@
|
||||
</div>
|
||||
<div class="flex flex-0 flex-justify-between pt10px pb10px">
|
||||
<div class="w100px">
|
||||
<el-button :loading="isTableLoading" size="small" @click="getMarkAsNotSuitRecord"
|
||||
<el-button
|
||||
:loading="isTableLoading"
|
||||
size="small"
|
||||
@click="
|
||||
() => {
|
||||
gtagRenderer('mansr_refresh_clicked')
|
||||
getMarkAsNotSuitRecord()
|
||||
}
|
||||
"
|
||||
>刷新</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -93,7 +113,13 @@
|
||||
<JobInfoSnapshot
|
||||
v-if="selectedJobInfoForViewSnapshot"
|
||||
:job-info="selectedJobInfoForViewSnapshot"
|
||||
@closed="selectedJobInfoForViewSnapshot = null"
|
||||
scene="markAsNotSuitRecord"
|
||||
@closed="
|
||||
() => {
|
||||
gtagRenderer('mansr_closed')
|
||||
selectedJobInfoForViewSnapshot = null
|
||||
}
|
||||
"
|
||||
/>
|
||||
</ElDrawer>
|
||||
</div>
|
||||
@@ -107,6 +133,7 @@ import { PageReq, PagedRes } from '../../../../common/types/pagination'
|
||||
import JobInfoSnapshot from '../../features/JobInfoSnapshot/index.vue'
|
||||
import { MarkAsNotSuitReason } from '@geekgeekrun/sqlite-plugin/src/enums'
|
||||
import { transformUtcDateToLocalDate } from '@geekgeekrun/utils/date.mjs'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const tableData = ref<VMarkAsNotSuitLog[]>([])
|
||||
const pageSizeList = ref<number[]>([100, 200, 300, 400])
|
||||
@@ -122,6 +149,10 @@ const tableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const isTableLoading = ref(false)
|
||||
async function getMarkAsNotSuitRecord() {
|
||||
try {
|
||||
gtagRenderer('mansr_request_sent', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize
|
||||
})
|
||||
isTableLoading.value = true
|
||||
const { data: res } = (await electron.ipcRenderer.invoke('get-mark-as-not-suit-record', {
|
||||
pageNo: pagination.value.pageNo,
|
||||
@@ -133,7 +164,16 @@ async function getMarkAsNotSuitRecord() {
|
||||
pageNo: res.pageNo,
|
||||
pageSize: pagination.value.pageSize
|
||||
}
|
||||
gtagRenderer('mansr_request_success', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize
|
||||
})
|
||||
} catch (err) {
|
||||
gtagRenderer('mansr_request_error', {
|
||||
err,
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize
|
||||
})
|
||||
console.log(err)
|
||||
tableData.value = []
|
||||
} finally {
|
||||
@@ -158,6 +198,7 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
async function handleViewJobOnlineButtonClick(encryptJobId: string) {
|
||||
gtagRenderer('view_job_online_button_clicked')
|
||||
return await electron.ipcRenderer.invoke('open-site-with-boss-cookie', {
|
||||
url: `https://www.zhipin.com/job_detail/${encryptJobId}.html`
|
||||
})
|
||||
@@ -167,6 +208,7 @@ const drawVisibleModelValue = ref(false)
|
||||
const selectedJobInfoForViewSnapshot = ref<VMarkAsNotSuitLog | null>(null)
|
||||
|
||||
function handleViewJobSnapshotButtonClick(record: VMarkAsNotSuitLog) {
|
||||
gtagRenderer('view_job_snapshot_button_clicked')
|
||||
selectedJobInfoForViewSnapshot.value = record
|
||||
drawVisibleModelValue.value = true
|
||||
}
|
||||
@@ -174,7 +216,10 @@ function handleViewJobSnapshotButtonClick(record: VMarkAsNotSuitLog) {
|
||||
const markReasonTopicMap = {
|
||||
[MarkAsNotSuitReason.BOSS_INACTIVE]: 'Boss不活跃',
|
||||
[MarkAsNotSuitReason.USER_MANUAL_OPERATION_WITH_UNKNOWN_REASON]: '手动标记不合适',
|
||||
[MarkAsNotSuitReason.JOB_NOT_SUIT]: '职位不合适'
|
||||
[MarkAsNotSuitReason.JOB_NOT_SUIT]: '职位不合适',
|
||||
[MarkAsNotSuitReason.JOB_CITY_NOT_SUIT]: '工作地不合适',
|
||||
[MarkAsNotSuitReason.JOB_WORK_EXP_NOT_SUIT]: '工作经验不合适',
|
||||
[MarkAsNotSuitReason.JOB_SALARY_NOT_SUIT]: '薪资不合适'
|
||||
}
|
||||
|
||||
function formatMarkReason(row: VMarkAsNotSuitLog) {
|
||||
@@ -206,6 +251,34 @@ function formatMarkReason(row: VMarkAsNotSuitLog) {
|
||||
.filter(Boolean)
|
||||
.join('\n')
|
||||
}
|
||||
case MarkAsNotSuitReason.JOB_WORK_EXP_NOT_SUIT:
|
||||
case MarkAsNotSuitReason.JOB_CITY_NOT_SUIT: {
|
||||
const extInfo = (() => {
|
||||
try {
|
||||
return JSON.parse(row.extInfo)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
})()
|
||||
return [extInfo?.chosenReasonInUi?.text && `Boss选项内容:${extInfo.chosenReasonInUi.text}`]
|
||||
.filter(Boolean)
|
||||
.join('\n')
|
||||
}
|
||||
case MarkAsNotSuitReason.JOB_SALARY_NOT_SUIT: {
|
||||
const extInfo = (() => {
|
||||
try {
|
||||
return JSON.parse(row.extInfo)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
})()
|
||||
return [
|
||||
extInfo?.salaryDesc && `薪资:${extInfo.salaryDesc}`,
|
||||
extInfo?.chosenReasonInUi?.text && `Boss选项内容:${extInfo.chosenReasonInUi.text}`
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('\n')
|
||||
}
|
||||
default: {
|
||||
return ''
|
||||
}
|
||||
@@ -0,0 +1,582 @@
|
||||
<template>
|
||||
<div class="form-wrap">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:rules="formRules"
|
||||
:model="formContent.autoReminder"
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item label="BOSS直聘 Cookie">
|
||||
<el-button size="small" type="primary" @click="handleClickLaunchLogin"
|
||||
>编辑Cookie</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div>
|
||||
<el-checkbox v-if="!expectJobTypeRegExpStr?.trim()" :model-value="false" disabled>
|
||||
发送提醒消息前,先按照“Boss炸弹-职位类型正则”校验正在与Boss沟通的岗位是否满足期望,校验通过后再提醒
|
||||
</el-checkbox>
|
||||
<template v-else>
|
||||
<el-checkbox v-model="formContent.autoReminder.onlyRemindBossWithExpectJobType">
|
||||
发送提醒消息前,先按照“Boss炸弹-职位类型正则”校验正在与Boss沟通的岗位是否满足期望,校验通过后再提醒
|
||||
</el-checkbox>
|
||||
<div ml1.5em color-gray>
|
||||
<div>当前职位类型正则:{{ expectJobTypeRegExpStr?.trim() }}</div>
|
||||
<template
|
||||
v-if="
|
||||
formContent.autoReminder.rechatContentSource ===
|
||||
RECHAT_CONTENT_SOURCE.GEMINI_WITH_CHAT_CONTEXT
|
||||
"
|
||||
>
|
||||
<div>当前简历中填写的期望职位:{{ resumeContent?.expectJob ?? '-' }}</div>
|
||||
<div color-orange>请确保上方二者信息匹配</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item class="mb0" label="跟进话术 - 当发现已读不回的Boss时,将要向Boss发出:">
|
||||
<el-radio-group v-model="formContent.autoReminder.rechatContentSource">
|
||||
<div>
|
||||
<el-tooltip
|
||||
effect="light"
|
||||
placement="right"
|
||||
:enterable="false"
|
||||
@show="gtagRenderer('tooltip_show_about_lfr_emotion_figure')"
|
||||
>
|
||||
<template #content>
|
||||
<img block h-100px src="./resources/look-forward-reply-emotion.gif" />
|
||||
</template>
|
||||
<el-radio :label="RECHAT_CONTENT_SOURCE.LOOK_FORWARD_EMOTION">
|
||||
“[盼回复]” 表情
|
||||
</el-radio>
|
||||
</el-tooltip>
|
||||
<br />
|
||||
<el-radio :label="RECHAT_CONTENT_SOURCE.GEMINI_WITH_CHAT_CONTEXT">
|
||||
由大语言模型(根据简历及当前聊天上下文)生成的内容
|
||||
</el-radio>
|
||||
</div>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div class="ml-30px">
|
||||
<template
|
||||
v-if="
|
||||
formContent.autoReminder.rechatContentSource ===
|
||||
RECHAT_CONTENT_SOURCE.GEMINI_WITH_CHAT_CONTEXT
|
||||
"
|
||||
>
|
||||
<el-form-item class="mb4px">
|
||||
<div>
|
||||
<el-button size="small" type="primary" @click="handleClickConfigLlm">
|
||||
配置大语言模型
|
||||
</el-button>
|
||||
<div class="font-size-12px color-#666">
|
||||
支持
|
||||
<span
|
||||
class="pl6px pr6px pt4px pb2px color-white border-rd-full font-size-0.8em"
|
||||
style="background-color: #3c4efd"
|
||||
>DeepSeek-V3</span
|
||||
>
|
||||
<span
|
||||
class="ml4px pl6px pr6px pt4px pb2px color-white border-rd-full font-size-0.8em"
|
||||
style="background-color: #000000"
|
||||
>GPT-4o mini</span
|
||||
>
|
||||
<span
|
||||
class="ml4px pl6px pr6px pt4px pb2px color-white border-rd-full font-size-0.8em"
|
||||
style="background-color: #462ac4"
|
||||
>Qwen2.5</span
|
||||
>
|
||||
模型;支持多个“服务商-模型”组合按权重搭配使用
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item class="mb4px">
|
||||
<div>
|
||||
<el-button size="small" type="primary" @click="handleClickEditResume">
|
||||
编辑简历
|
||||
</el-button>
|
||||
<div class="font-size-12px color-#666">
|
||||
简历内容将提交给大语言模型,以用于生成已读不回提醒消息;提交内容及生成消息中不会包含期望薪资
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item class="mb4px">
|
||||
<div>
|
||||
<div>
|
||||
<el-button size="small" type="primary" @click="handleClickEditPrompt">
|
||||
使用外部编辑器编辑提示词模板 (Markdown)
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="
|
||||
() => {
|
||||
gtagRenderer('reset_template_clicked_in_main_form')
|
||||
restoreDefaultTemplate()
|
||||
}
|
||||
"
|
||||
>
|
||||
还原默认提示词模板
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="font-size-12px color-#666">
|
||||
对生成效果不够满意?可在此查看、编辑提示词模板。请在模板中需要插入简历的位置插入
|
||||
__REPLACE_REAL_RESUME_HERE__
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item prop="recentMessageQuantityForLlm">
|
||||
<div>
|
||||
携带最近
|
||||
<el-input-number
|
||||
v-model="formContent.autoReminder.recentMessageQuantityForLlm"
|
||||
class="w-120px"
|
||||
:min="8"
|
||||
:max="20"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
></el-input-number>
|
||||
次聊天内容作为上下文生成新消息
|
||||
</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>
|
||||
<el-select
|
||||
v-model="formContent.autoReminder.rechatLlmFallback"
|
||||
class="w200px"
|
||||
label="name"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in rechatLlmFallbackOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
:label="option.name"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</div>
|
||||
<el-form-item label="跟进间隔(分钟)" prop="throttleIntervalMinutes">
|
||||
<el-input-number
|
||||
v-model="formContent.autoReminder.throttleIntervalMinutes"
|
||||
class="w-150px"
|
||||
:min="3"
|
||||
:precision="1"
|
||||
:step="0.5"
|
||||
@blur="handleThrottleIntervalMinutesBlur"
|
||||
/> 分钟内不多次跟进同一Boss
|
||||
</el-form-item>
|
||||
<el-form-item label="跟进时限(天)" prop="rechatLimitDay" mb-0>
|
||||
<div>
|
||||
<div><el-checkbox v-model="enableRechatLimit" /> 启用</div>
|
||||
<el-input-number
|
||||
v-model="formContent.autoReminder.rechatLimitDay"
|
||||
class="w-150px"
|
||||
:min="0"
|
||||
:precision="1"
|
||||
:step="0.5"
|
||||
:disabled="!enableRechatLimit"
|
||||
/> 天<br />
|
||||
<div v-if="enableRechatLimit">
|
||||
不再跟进 (<span class="text-orange">{{ rechatLimitDateString }}</span
|
||||
>)之前列表中没有进展的聊天
|
||||
</div>
|
||||
<div v-else>这将会跟进列表中所有聊天(<span class="text-orange">不建议</span>)</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-tooltip
|
||||
effect="light"
|
||||
placement="bottom-start"
|
||||
@show="gtagRenderer('tooltip_show_about_stop_trace_one_boss')"
|
||||
>
|
||||
<template #content>
|
||||
<ul m0 line-height-1.5em w-300px pl2em>
|
||||
<li>
|
||||
请向你不想继续提醒的Boss发送任意消息,发送后立即撤回的这条消息即可。
|
||||
<br />
|
||||
<br />
|
||||
对于PC端Boss直聘,鼠标移动到要撤回的消息,点按鼠标右键调出菜单,再鼠标左键点击菜单中的“撤回”。如图所示:
|
||||
<br />
|
||||
<img block w-full src="./resources/withdraw-message-guide.png" />
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<el-button type="text" font-size-12px
|
||||
><span><QuestionFilled w-1em h-1em mr2px /></span
|
||||
>我不想持续提醒某个Boss了,如何处理?</el-button
|
||||
>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<el-form-item class="last-form-item">
|
||||
<el-button type="primary" @click="handleSubmit">开始提醒</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
||||
import { dayjs, ElForm, ElMessage, ElMessageBox, ElSelect, ElOption } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
RECHAT_CONTENT_SOURCE,
|
||||
RECHAT_LLM_FALLBACK
|
||||
} from '../../../../common/enums/auto-start-chat'
|
||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||
import mittBus from '../../utils/mitt'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
const gtagRenderer = (name, params?: object) => {
|
||||
return baseGtagRenderer(name, {
|
||||
scene: 'rnrr-config',
|
||||
...params
|
||||
})
|
||||
}
|
||||
const router = useRouter()
|
||||
const formContent = ref({
|
||||
autoReminder: {
|
||||
throttleIntervalMinutes: 10,
|
||||
rechatLimitDay: 21,
|
||||
rechatContentSource: 1,
|
||||
recentMessageQuantityForLlm: 8,
|
||||
rechatLlmFallback: RECHAT_LLM_FALLBACK.SEND_LOOK_FORWARD_EMOTION,
|
||||
onlyRemindBossWithExpectJobType: true
|
||||
}
|
||||
})
|
||||
|
||||
const enableRechatLimit = computed({
|
||||
get() {
|
||||
return Boolean(formContent.value.autoReminder?.rechatLimitDay)
|
||||
},
|
||||
set(val) {
|
||||
if (!val) {
|
||||
gtagRenderer('rechat_limit_disabled')
|
||||
formContent.value.autoReminder.rechatLimitDay = 0
|
||||
} else {
|
||||
gtagRenderer('rechat_limit_enabled')
|
||||
formContent.value.autoReminder.rechatLimitDay = 21
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
||||
const conf = res.config['boss.json']?.autoReminder || {}
|
||||
conf.throttleIntervalMinutes = conf.throttleIntervalMinutes ?? 10
|
||||
conf.rechatLimitDay = conf.rechatLimitDay ?? 21
|
||||
conf.rechatContentSource = conf.rechatContentSource ?? 1
|
||||
conf.recentMessageQuantityForLlm =
|
||||
typeof conf.recentMessageQuantityForLlm === 'number'
|
||||
? conf.recentMessageQuantityForLlm > 20
|
||||
? 20
|
||||
: conf.recentMessageQuantityForLlm < 8
|
||||
? 8
|
||||
: parseInt(conf.recentMessageQuantityForLlm)
|
||||
: 8
|
||||
conf.onlyRemindBossWithExpectJobType = conf.onlyRemindBossWithExpectJobType ?? true
|
||||
conf.rechatLlmFallback = conf.rechatLlmFallback ?? RECHAT_LLM_FALLBACK.SEND_LOOK_FORWARD_EMOTION
|
||||
formContent.value.autoReminder = conf
|
||||
})
|
||||
|
||||
const expectJobTypeRegExpStr = ref('')
|
||||
async function fetchExpectJobTypeRegExpStr() {
|
||||
await electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
||||
expectJobTypeRegExpStr.value = res.config['boss.json']?.expectJobTypeRegExpStr
|
||||
})
|
||||
}
|
||||
fetchExpectJobTypeRegExpStr()
|
||||
mittBus.on('auto-start-chat-with-boss-config-saved', fetchExpectJobTypeRegExpStr)
|
||||
onUnmounted(() => {
|
||||
mittBus.off('auto-start-chat-with-boss-config-saved', fetchExpectJobTypeRegExpStr)
|
||||
})
|
||||
|
||||
const resumeContent = ref(null)
|
||||
async function fetchResumeContent() {
|
||||
await electron.ipcRenderer.invoke('fetch-resume-content').then((res) => {
|
||||
resumeContent.value = res
|
||||
})
|
||||
}
|
||||
|
||||
fetchResumeContent()
|
||||
|
||||
const formRules = {
|
||||
throttleIntervalMinutes: {
|
||||
validator(_, value, cb) {
|
||||
if (/[^0-9.]/.test(String(value)) || isNaN(parseFloat(value)) || isNaN(Number(value))) {
|
||||
cb(new Error(`请输入数字!`))
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
}
|
||||
},
|
||||
rechatLimitDay: {
|
||||
validator(_, value, cb) {
|
||||
if (/[^0-9.]/.test(String(value)) || isNaN(parseFloat(value)) || isNaN(Number(value))) {
|
||||
cb(new Error(`请输入数字!`))
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
watch(
|
||||
() => formContent.value.autoReminder,
|
||||
() => {
|
||||
nextTick(() => {
|
||||
formRef.value?.validate?.()
|
||||
})
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
async function checkIsCanRun() {
|
||||
if (!(await electron.ipcRenderer.invoke('check-is-resume-content-valid'))) {
|
||||
gtagRenderer('cannot_launch_for_invalid_rc_dialog_show')
|
||||
try {
|
||||
await ElMessageBox.confirm(`简历内容无效;您需要编辑一下您的简历`, {
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonText: '好的,去编辑我的简历',
|
||||
dangerouslyUseHTMLString: true
|
||||
})
|
||||
gtagRenderer('invalid_rc_dialog_click_confirm')
|
||||
try {
|
||||
await electron.ipcRenderer.invoke('resume-edit')
|
||||
await fetchResumeContent()
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
} catch {
|
||||
gtagRenderer('invalid_rc_dialog_click_cancel')
|
||||
}
|
||||
return false
|
||||
}
|
||||
try {
|
||||
await electron.ipcRenderer.invoke('check-if-llm-config-list-valid')
|
||||
} catch (err) {
|
||||
if (err?.message?.includes(`CANNOT_FIND_VALID_CONFIG`)) {
|
||||
gtagRenderer('cannot_launch_for_invalid_llm_config')
|
||||
console.log(`大模型配置无效`, err)
|
||||
ElMessageBox.confirm(
|
||||
'大模型配置不存在或者包含无效配置<br />您是否希望查看并修正当前大模型配置?',
|
||||
'',
|
||||
{
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
type: 'warning',
|
||||
closeOnClickModal: false,
|
||||
dangerouslyUseHTMLString: true
|
||||
}
|
||||
)
|
||||
.then(async () => {
|
||||
gtagRenderer('invalid_llm_config_tip_dialog_confirm')
|
||||
try {
|
||||
await electron.ipcRenderer.invoke('llm-config')
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
gtagRenderer('invalid_llm_config_tip_dialog_cancel')
|
||||
})
|
||||
} else {
|
||||
gtagRenderer('cannot_launch_for_check_llm_config_error', { err })
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '大模型配置检查未通过,请重试'
|
||||
})
|
||||
}
|
||||
return false
|
||||
}
|
||||
try {
|
||||
await electron.ipcRenderer.invoke('check-if-auto-remind-prompt-valid')
|
||||
} catch (err) {
|
||||
if (err?.message?.includes(`RESUME_PLACEHOLDER_NOT_EXIST`)) {
|
||||
gtagRenderer('cannot_launch_for_no_resume_placehold')
|
||||
console.log(`提示词模板无效`, err)
|
||||
ElMessageBox.confirm(
|
||||
'提示词模板缺少简历内容占位符:<br /><b>__REPLACE_REAL_RESUME_HERE__</b><br /><br />您是否希望还原默认的提示词模板?',
|
||||
'',
|
||||
{
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
type: 'warning',
|
||||
closeOnClickModal: false,
|
||||
dangerouslyUseHTMLString: true
|
||||
}
|
||||
)
|
||||
.then(async () => {
|
||||
gtagRenderer('confirm_invalid_rt_tip_dialog')
|
||||
await restoreDefaultTemplate()
|
||||
})
|
||||
.catch(() => {
|
||||
gtagRenderer('close_invalid_rt_tip_dialog')
|
||||
})
|
||||
} else {
|
||||
gtagRenderer('cannot_launch_for_check_prompt_error', { err })
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '用于生成自动提醒消息的提示词检查未通过,请重试'
|
||||
})
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
gtagRenderer('run_read_no_reply_reminder_clicked', {
|
||||
throttle_interval_minutes: formContent.value.autoReminder.throttleIntervalMinutes,
|
||||
rechat_limit_day: formContent.value.autoReminder.rechatLimitDay,
|
||||
rechat_content_source: formContent.value.autoReminder.rechatContentSource,
|
||||
recent_message_quantity_for_llm: formContent.value.autoReminder.recentMessageQuantityForLlm
|
||||
})
|
||||
await formRef.value!.validate()
|
||||
await electron.ipcRenderer.invoke('save-config-file-from-ui', JSON.stringify(formContent.value))
|
||||
gtagRenderer('config_saved')
|
||||
if (
|
||||
formContent.value.autoReminder?.rechatContentSource ===
|
||||
RECHAT_CONTENT_SOURCE.GEMINI_WITH_CHAT_CONTEXT
|
||||
) {
|
||||
if (!(await checkIsCanRun())) {
|
||||
return
|
||||
}
|
||||
if (!(await electron.ipcRenderer.invoke('resume-content-enough-detect'))) {
|
||||
gtagRenderer('rc_not_enough_dialog_show')
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`简历内容可能不够充足(各个部分内容长度相加 <800 字)<br />后续大模型根据简历生成的内容将可能不符合预期(例如相同内容重复生成、生成预期之外的内容)<br /><br />要继续运行吗?`,
|
||||
{
|
||||
cancelButtonText: '不,我再看看',
|
||||
confirmButtonText: '是的,继续运行',
|
||||
dangerouslyUseHTMLString: true
|
||||
}
|
||||
)
|
||||
gtagRenderer('rc_not_enough_dialog_click_confirm')
|
||||
} catch {
|
||||
gtagRenderer('rc_not_enough_dialog_click_cancel')
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
gtagRenderer('run_read_no_reply_reminder_launched')
|
||||
router.replace({
|
||||
path: '/geekAutoStartChatWithBoss/prepareRun',
|
||||
query: { flow: 'read-no-reply-reminder' }
|
||||
})
|
||||
}
|
||||
function handleThrottleIntervalMinutesBlur() {
|
||||
if (formContent.value.autoReminder.throttleIntervalMinutes < 3) {
|
||||
formContent.value.autoReminder.throttleIntervalMinutes = 3
|
||||
}
|
||||
formContent.value.autoReminder.throttleIntervalMinutes = Number(
|
||||
formContent.value.autoReminder.throttleIntervalMinutes
|
||||
)
|
||||
}
|
||||
|
||||
const restoreDefaultTemplate = async () => {
|
||||
await electron.ipcRenderer.invoke('overwrite-auto-remind-prompt-with-default')
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '模板还原成功'
|
||||
})
|
||||
}
|
||||
|
||||
const handleClickLaunchLogin = () => {
|
||||
gtagRenderer('launch_login_clicked')
|
||||
router.replace('/cookieAssistant')
|
||||
}
|
||||
|
||||
const currentStamp = ref(new Date())
|
||||
let timer = 0
|
||||
function updateCurrentStamp() {
|
||||
currentStamp.value = new Date()
|
||||
timer = window.setTimeout(updateCurrentStamp, 1000)
|
||||
}
|
||||
updateCurrentStamp()
|
||||
onUnmounted(() => {
|
||||
window.clearTimeout(timer)
|
||||
})
|
||||
|
||||
const rechatLimitDateString = computed(() => {
|
||||
return dayjs(
|
||||
+currentStamp.value - formContent.value.autoReminder.rechatLimitDay * 24 * 60 * 60 * 1000
|
||||
).format('YYYY-MM-DD HH:mm:ss')
|
||||
})
|
||||
|
||||
const handleClickConfigLlm = async () => {
|
||||
gtagRenderer('config_llm_clicked')
|
||||
try {
|
||||
await electron.ipcRenderer.invoke('llm-config')
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
const handleClickEditResume = async () => {
|
||||
gtagRenderer('edit_resume_clicked')
|
||||
try {
|
||||
await electron.ipcRenderer.invoke('resume-edit')
|
||||
await fetchResumeContent()
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
const handleClickEditPrompt = async () => {
|
||||
gtagRenderer('edit_prompt_clicked')
|
||||
await electron.ipcRenderer.send('no-reply-reminder-prompt-edit')
|
||||
}
|
||||
|
||||
const rechatLlmFallbackOptions = [
|
||||
{
|
||||
name: '发送“[盼回复]”表情',
|
||||
value: RECHAT_LLM_FALLBACK.SEND_LOOK_FORWARD_EMOTION
|
||||
},
|
||||
{
|
||||
name: '退出已读不回提醒器',
|
||||
value: RECHAT_LLM_FALLBACK.EXIT_REMINDER_PROGRAM
|
||||
}
|
||||
]
|
||||
|
||||
async function handleTestEffectClicked() {
|
||||
gtagRenderer('goto_mock_chat_clicked')
|
||||
if (!(await checkIsCanRun())) {
|
||||
return
|
||||
}
|
||||
electron.ipcRenderer.send('test-llm-config-effect', {
|
||||
autoReminderConfig: JSON.parse(JSON.stringify(formContent.value.autoReminder))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.form-wrap {
|
||||
max-height: 100vh;
|
||||
overflow: auto;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
:deep(.el-form) {
|
||||
margin: 0 auto;
|
||||
max-width: 1000px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
.last-form-item {
|
||||
:deep(.el-form-item__content) {
|
||||
margin-top: 0px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -55,7 +55,15 @@
|
||||
</div>
|
||||
<div class="flex flex-0 flex-justify-between pt10px pb10px">
|
||||
<div class="w100px">
|
||||
<el-button :loading="isTableLoading" size="small" @click="getAutoStartChatRecord"
|
||||
<el-button
|
||||
:loading="isTableLoading"
|
||||
size="small"
|
||||
@click="
|
||||
() => {
|
||||
gtagRenderer('start_chat_record_refresh_clicked')
|
||||
getAutoStartChatRecord()
|
||||
}
|
||||
"
|
||||
>刷新</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -76,7 +84,13 @@
|
||||
<JobInfoSnapshot
|
||||
v-if="selectedJobInfoForViewSnapshot"
|
||||
:job-info="selectedJobInfoForViewSnapshot"
|
||||
@closed="selectedJobInfoForViewSnapshot = null"
|
||||
scene="startChatRecord"
|
||||
@closed="
|
||||
() => {
|
||||
gtagRenderer('start_chat_record_closed')
|
||||
selectedJobInfoForViewSnapshot = null
|
||||
}
|
||||
"
|
||||
/>
|
||||
</ElDrawer>
|
||||
</div>
|
||||
@@ -89,6 +103,7 @@ import { type VChatStartupLog } from '@geekgeekrun/sqlite-plugin/src/entity/VCha
|
||||
import { transformUtcDateToLocalDate } from '@geekgeekrun/utils/date.mjs'
|
||||
import { PageReq, PagedRes } from '../../../../common/types/pagination'
|
||||
import JobInfoSnapshot from '../../features/JobInfoSnapshot/index.vue'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const tableData = ref<VChatStartupLog[]>([])
|
||||
const pageSizeList = ref<number[]>([100, 200, 300, 400])
|
||||
@@ -104,6 +119,10 @@ const tableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const isTableLoading = ref(false)
|
||||
async function getAutoStartChatRecord() {
|
||||
try {
|
||||
gtagRenderer('start_chat_record_request_sent', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
isTableLoading.value = true
|
||||
const { data: res } = (await electron.ipcRenderer.invoke('get-auto-start-chat-record', {
|
||||
pageNo: pagination.value.pageNo,
|
||||
@@ -115,7 +134,16 @@ async function getAutoStartChatRecord() {
|
||||
pageNo: res.pageNo,
|
||||
pageSize: pagination.value.pageSize
|
||||
}
|
||||
gtagRenderer('start_chat_record_request_success', {
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
} catch (err) {
|
||||
gtagRenderer('start_chat_record_request_error', {
|
||||
err,
|
||||
page_no: pagination.value.pageNo,
|
||||
page_size: pagination.value.pageSize,
|
||||
})
|
||||
console.log(err)
|
||||
tableData.value = []
|
||||
} finally {
|
||||
258
packages/ui/src/renderer/src/page/MainLayout/index.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<template>
|
||||
<div class="flex h100vh">
|
||||
<div class="flex flex-col min-w200px w200px pt30px pl30px aside-nav of-hidden">
|
||||
<div class="nav-list flex-1 of-auto">
|
||||
<RouterLink to="./GeekAutoStartChatWithBoss">
|
||||
Boss炸弹
|
||||
<el-tooltip
|
||||
placement="right"
|
||||
:enterable="false"
|
||||
@show="gtagRenderer('tooltip_show_for_nav_boss_b_entry')"
|
||||
>
|
||||
<template #content>
|
||||
<div w-480px>
|
||||
<div>扩列神器!按照你所设置的求职偏好,自动开聊推荐职位列表中的匹配的Boss。</div>
|
||||
<br />
|
||||
<div>匹配步骤</div>
|
||||
<ol m0 pl2em>
|
||||
<li>
|
||||
按照公司名称查找职位,查找到目标职位后,自动点击这个职位,右侧将会展示职位详情
|
||||
</li>
|
||||
<li>
|
||||
检查Boss活跃度
|
||||
<ul pl2em>
|
||||
<li>
|
||||
如果Boss活跃度为本月活跃或更往前的时间,则会把职位标记为不合适,一段时间内你将不会在Boss上看到这个职位,且将会推荐新职位置换这个职位
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
对职位名称、职位类型、职位描述进行匹配
|
||||
<ul pl2em>
|
||||
<li>如果匹配则自动点击开聊按钮</li>
|
||||
<li>
|
||||
不匹配则标记这个职位为不合适,一段时间内你将不会在Boss上看到这个职位,且将会推荐新职位置换这个职位
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
<br />
|
||||
<div>异常情况</div>
|
||||
<ol m0 pl2em>
|
||||
<li>
|
||||
当前页面筛选条件下,如果没有更多职位,则自动切换备选筛选条件,以获取更多新职位
|
||||
</li>
|
||||
<li>
|
||||
如当天开聊次数用完,本程序会暂停运行60分钟,之后尝试继续重新运行;如重新运行时间已在第二天,则将会继续开聊
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</template>
|
||||
<QuestionFilled w-1em h-1em mr10px />
|
||||
</el-tooltip>
|
||||
</RouterLink>
|
||||
<RouterLink to="./ReadNoReplyReminder">
|
||||
已读不回提醒器
|
||||
<el-tooltip
|
||||
placement="right"
|
||||
:enterable="false"
|
||||
@show="gtagRenderer('tooltip_show_for_rnrr_entry')"
|
||||
>
|
||||
<template #content>
|
||||
<div w-480px>
|
||||
<div>
|
||||
Boss不明原因已读不回?简历就是投不出去?<br />
|
||||
已读不回提醒器,有事没事提醒一下已读不回的 Ta,助力把握每次机会
|
||||
</div>
|
||||
<br />
|
||||
<div>匹配逻辑</div>
|
||||
<div>在聊天列表中查找对你消息已读不回的Boss,再发一条消息,多次复聊;同时:</div>
|
||||
<ul m0 pl2em>
|
||||
<li>如果设置了“跟进时限”,那么在这个时间之前活跃的聊天将不会被检查</li>
|
||||
<li>
|
||||
如果设置了“跟进间隔”,且再次检查时发现Boss已读不回,且距离上次提醒时间间隔小于这个时间,那么聊天将暂时不会跟进,直到下次检查时距离上次提醒时间间隔大于这个时间
|
||||
</li>
|
||||
</ul>
|
||||
<br />
|
||||
<div>发送内容</div>
|
||||
<ul m0 pl2em>
|
||||
<li>“[盼回复]”表情</li>
|
||||
<li>由大语言模型(根据简历及当前聊天上下文)生成的内容</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
<QuestionFilled w-1em h-1em mr10px />
|
||||
</el-tooltip>
|
||||
</RouterLink>
|
||||
<hr w180px />
|
||||
<a href="javascript:void(0)" @click="handleLaunchBossSite">
|
||||
手动逛Boss<TopRight w-1em h-1em mr10px />
|
||||
</a>
|
||||
<hr w180px />
|
||||
<RouterLink to="./StartChatRecord">开聊记录</RouterLink>
|
||||
<RouterLink to="./MarkAsNotSuitRecord">标记不合适记录</RouterLink>
|
||||
<RouterLink to="./JobLibrary">职位库</RouterLink>
|
||||
<RouterLink to="./BossLibrary">Boss库</RouterLink>
|
||||
<RouterLink to="./CompanyLibrary">公司库</RouterLink>
|
||||
</div>
|
||||
<div class="pt-16px pb-16px flex-0 font-size-12px">
|
||||
<div v-if="updateStore.availableNewRelease" mb16px>
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
alignItems: 'center'
|
||||
}"
|
||||
>
|
||||
最新版本: {{ updateStore.availableNewRelease.releaseVersion }}
|
||||
<img
|
||||
h12px
|
||||
ml10px
|
||||
:style="{
|
||||
filter: `saturate(1.5) brightness(1.5)`,
|
||||
transform: `translateY(-10px)`
|
||||
}"
|
||||
src="./resources/new.gif"
|
||||
/>
|
||||
</div>
|
||||
<div class="update-button-area flex flex-items-center mt-8px">
|
||||
<el-button type="text" size="small" @click="handleDownloadNewReleaseClick"
|
||||
>从GitHub下载</el-button
|
||||
>
|
||||
|
|
||||
<el-button type="text" size="small" @click="handleViewNewReleaseClick"
|
||||
>了解更新内容</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>当前版本: {{ buildInfo.version }}({{ buildInfo.buildVersion }})</div>
|
||||
<div class="feedback-button-area flex flex-items-center mt-8px">
|
||||
<el-button type="text" size="small" @click="handleGotoProjectPageClick"
|
||||
>项目首页</el-button
|
||||
>
|
||||
|
|
||||
<el-button type="text" size="small" @click="handleFeedbackClick">反馈问题</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<RouterView v-slot="{ Component }" class="flex-1">
|
||||
<KeepAlive>
|
||||
<component :is="Component" />
|
||||
</KeepAlive>
|
||||
</RouterView>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { TopRight, QuestionFilled } from '@element-plus/icons-vue'
|
||||
import useBuildInfo from '@renderer/hooks/useBuildInfo'
|
||||
import { debounce } from 'lodash-es'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
import { useUpdateStore } from '../../store/index'
|
||||
|
||||
const router = useRouter()
|
||||
const unmountedCbs: Array<InstanceType<typeof Function>> = []
|
||||
onUnmounted(() => {
|
||||
while (unmountedCbs.length) {
|
||||
const fn = unmountedCbs.shift()!
|
||||
try {
|
||||
fn()
|
||||
} catch {}
|
||||
}
|
||||
})
|
||||
const goToCheckBossZhipinCookieFile = () => router.replace('/cookieAssistant')
|
||||
onMounted(() => {
|
||||
electron.ipcRenderer.on('check-boss-zhipin-cookie-file', goToCheckBossZhipinCookieFile)
|
||||
})
|
||||
onUnmounted(() => {
|
||||
electron.ipcRenderer.removeListener(
|
||||
'check-boss-zhipin-cookie-file',
|
||||
goToCheckBossZhipinCookieFile
|
||||
)
|
||||
})
|
||||
;(async () => {
|
||||
const checkDependenciesResult = await electron.ipcRenderer.invoke('check-dependencies')
|
||||
if (Object.values(checkDependenciesResult).includes(false)) {
|
||||
router.replace('/')
|
||||
return
|
||||
}
|
||||
|
||||
const isCookieFileValid = await electron.ipcRenderer.invoke('check-boss-zhipin-cookie-file')
|
||||
if (!isCookieFileValid) {
|
||||
router.replace('/cookieAssistant')
|
||||
return
|
||||
}
|
||||
})()
|
||||
|
||||
const { buildInfo } = useBuildInfo()
|
||||
const handleFeedbackClick = () => {
|
||||
gtagRenderer('goto_feedback_clicked')
|
||||
electron.ipcRenderer.send('send-feed-back-to-github-issue')
|
||||
}
|
||||
const handleGotoProjectPageClick = () => {
|
||||
gtagRenderer('goto_project_github_clicked')
|
||||
electron.ipcRenderer.send('open-external-link', 'https://github.com/geekgeekrun/geekgeekrun')
|
||||
}
|
||||
|
||||
const handleLaunchBossSite = debounce(
|
||||
async () => {
|
||||
gtagRenderer('launch_boss_site_clicked')
|
||||
return await electron.ipcRenderer.invoke('open-site-with-boss-cookie', {
|
||||
url: `https://www.zhipin.com/`
|
||||
})
|
||||
},
|
||||
1000,
|
||||
{ leading: true, trailing: false }
|
||||
)
|
||||
|
||||
const updateStore = useUpdateStore()
|
||||
function handleDownloadNewReleaseClick() {
|
||||
gtagRenderer('click_download_release_form_nav')
|
||||
electron.ipcRenderer.send('open-external-link', updateStore.availableNewRelease!.assetUrl)
|
||||
}
|
||||
function handleViewNewReleaseClick() {
|
||||
gtagRenderer('click_view_release_form_nav')
|
||||
electron.ipcRenderer.send('open-external-link', updateStore.availableNewRelease!.releasePageUrl)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.aside-nav {
|
||||
background-image: linear-gradient(45deg, #eaf4f1, #dcf6f2);
|
||||
.nav-list {
|
||||
> a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 2.5em;
|
||||
box-sizing: border-box;
|
||||
padding-left: 2em;
|
||||
&.router-link-active {
|
||||
background-color: #fff;
|
||||
font-weight: 700;
|
||||
color: #2faa9e;
|
||||
border-radius: 9999px 0 0 9999px;
|
||||
}
|
||||
}
|
||||
> hr {
|
||||
border: 0 solid;
|
||||
height: 1px;
|
||||
background-color: #b3c8c3;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.feedback-button-area,
|
||||
.update-button-area {
|
||||
:deep(.el-button) {
|
||||
height: fit-content;
|
||||
padding: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
After Width: | Height: | Size: 499 KiB |
|
After Width: | Height: | Size: 793 KiB |
|
After Width: | Height: | Size: 512 KiB |
|
After Width: | Height: | Size: 902 KiB |
|
After Width: | Height: | Size: 346 KiB |
|
After Width: | Height: | Size: 41 KiB |
BIN
packages/ui/src/renderer/src/page/MainLayout/resources/new.gif
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div class="h100vh flex flex-col">
|
||||
<div
|
||||
ref="scrollElRef"
|
||||
:style="{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flex: 1,
|
||||
overflow: `auto`,
|
||||
margin: `0 auto`,
|
||||
alignItems: `flex-end`,
|
||||
width: '100%'
|
||||
}"
|
||||
>
|
||||
<div
|
||||
v-if="messageList.length"
|
||||
:style="{
|
||||
width: '480px',
|
||||
margin: '0 auto'
|
||||
}"
|
||||
>
|
||||
<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"
|
||||
:class="{
|
||||
'will-enter-context': getIsEnterContent(index)
|
||||
}"
|
||||
>
|
||||
{{ item.text }}
|
||||
</div>
|
||||
<div
|
||||
:style="{
|
||||
width: 'fit-content',
|
||||
alignSelf: 'flex-end'
|
||||
}"
|
||||
font-size-10px
|
||||
>
|
||||
{{ item.usedLlmConfig.model }}
|
||||
</div>
|
||||
<div
|
||||
v-if="item?.usedLlmConfig?.providerCompleteApiUrl?.trim()"
|
||||
:style="{
|
||||
width: 'fit-content',
|
||||
overflow: 'hidden',
|
||||
whiteSpace: 'nowrap',
|
||||
textOverflow: 'ellipsis',
|
||||
alignSelf: 'flex-end',
|
||||
color: '#bbb'
|
||||
}"
|
||||
font-size-10px
|
||||
w-fit-content
|
||||
max-w-20em
|
||||
>
|
||||
{{ item.usedLlmConfig.providerCompleteApiUrl }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pb20px"></div>
|
||||
</div>
|
||||
<div v-else w-full h-full flex flex-item-center justify-center>
|
||||
<el-empty>
|
||||
<template #description>
|
||||
<template v-if="!isLoading">
|
||||
点击下方 “<el-button
|
||||
font-size-16px
|
||||
h-fit-content
|
||||
align-baseline
|
||||
p0
|
||||
type="text"
|
||||
@click.prevent="sendLlmGeneratedContent"
|
||||
>发送开场白</el-button
|
||||
>” 以开始模拟聊天
|
||||
</template>
|
||||
<template v-else>请稍候,第一条消息正在回复的路上~</template>
|
||||
</template>
|
||||
</el-empty>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'min-content 1fr min-content',
|
||||
height: `fit-content`,
|
||||
paddingTop: `10px`,
|
||||
paddingBottom: `10px`,
|
||||
backgroundColor: `#f0f0f0`
|
||||
}"
|
||||
>
|
||||
<el-select v-model="selectedLlmConfig" ml10px w160px placeholder="随机使用一个模型">
|
||||
<el-option
|
||||
v-for="(it, index) in llmConfigListForRender"
|
||||
:key="index"
|
||||
:value="it.id"
|
||||
:label="it.model"
|
||||
:disabled="!it.enabled"
|
||||
:style="{
|
||||
paddingTop: '10px',
|
||||
paddingBottom: '10px',
|
||||
height: 'auto',
|
||||
lineHeight: '1.25em'
|
||||
}"
|
||||
>
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between'
|
||||
}"
|
||||
>
|
||||
<div>{{ it.model }}</div>
|
||||
<div class="font-size-12px color-#bbb">
|
||||
{{ formatApiSecret(it.providerApiSecret) || '' }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="it?.providerCompleteApiUrl?.trim?.()"
|
||||
:style="{
|
||||
color: '#bbb',
|
||||
width: '35em',
|
||||
fontSize: '12px',
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis'
|
||||
}"
|
||||
>
|
||||
{{ it.providerCompleteApiUrl }}
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button
|
||||
:loading="isLoading"
|
||||
width-fit-content
|
||||
type="primary"
|
||||
@click="sendLlmGeneratedContent"
|
||||
>
|
||||
<template v-if="isLoading">正在生成消息,请稍候...</template>
|
||||
<template v-else-if="!messageList.length">发送开场白</template>
|
||||
<template v-else>发送下一句提醒内容</template>
|
||||
</el-button>
|
||||
<el-button mr10px type="text" @click="closeWindow">关闭对话框</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { sleep } from '@geekgeekrun/utils/sleep.mjs'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
type MessageItem = {
|
||||
text: string
|
||||
usedLlmConfig: string
|
||||
// recordInfo: any
|
||||
}
|
||||
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 [
|
||||
{
|
||||
id: null,
|
||||
model: '随机使用一个模型',
|
||||
providerCompleteApiUrl: null,
|
||||
enabled: true
|
||||
},
|
||||
...(llmConfigList.value ?? [])
|
||||
]
|
||||
})
|
||||
async function getLlmConfigList() {
|
||||
llmConfigList.value = await electron.ipcRenderer.invoke('get-llm-config-for-test')
|
||||
}
|
||||
getLlmConfigList().catch(() => {})
|
||||
const selectedLlmConfig = ref(null)
|
||||
watch(
|
||||
() => selectedLlmConfig.value,
|
||||
() => {
|
||||
gtagRenderer('change_mock_chat_llm_model', {
|
||||
model: selectedLlmConfig.value?.model ?? ''
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
const scrollElRef = ref(null)
|
||||
const isLoading = ref(false)
|
||||
async function sendLlmGeneratedContent() {
|
||||
gtagRenderer('click_mock_chat_send')
|
||||
isLoading.value = true
|
||||
try {
|
||||
const response = await electron.ipcRenderer.invoke('request-llm-for-test', {
|
||||
messageList: JSON.parse(JSON.stringify((messageList.value ?? []).slice(-8))),
|
||||
llmConfigIdForPick: selectedLlmConfig.value ? [selectedLlmConfig.value] : null
|
||||
})
|
||||
console.log(response)
|
||||
messageList.value.push({
|
||||
text: response.responseText,
|
||||
usedLlmConfig: response.usedLlmConfig
|
||||
})
|
||||
await sleep(50)
|
||||
;(scrollElRef.value as any as HTMLDivElement)?.scrollTo({
|
||||
top: scrollElRef.value?.scrollHeight,
|
||||
behavior: 'smooth'
|
||||
})
|
||||
} catch (err) {
|
||||
ElMessage.error({
|
||||
dangerouslyUseHTMLString: true,
|
||||
grouping: true,
|
||||
message: `<div>本次测试所使用的模型不可用</div><div style="margin-top: 10px; white-space: nowrap;">建议在大语言模型配置中关闭相关模型</div>`
|
||||
})
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function closeWindow() {
|
||||
electron.ipcRenderer.send(`close-read-no-reply-reminder-llm-mock-window`)
|
||||
}
|
||||
|
||||
function formatApiSecret(text) {
|
||||
if (typeof text !== 'string' || !text?.trim()) {
|
||||
return ''
|
||||
}
|
||||
if (text === 'ollama') {
|
||||
return text
|
||||
}
|
||||
if (text.length >= 8) {
|
||||
return `${text.slice(0, 4)}***${text.slice(-4)}`
|
||||
}
|
||||
return `***`
|
||||
}
|
||||
|
||||
gtagRenderer('enter_mock_chat_page')
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.message-item-wrap {
|
||||
max-width: 420px;
|
||||
margin-top: 20px;
|
||||
.message-item {
|
||||
line-height: 1.25em;
|
||||
font-size: 14px;
|
||||
background-color: #d1f0ef;
|
||||
color: #333;
|
||||
padding: 10px;
|
||||
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>
|
||||
571
packages/ui/src/renderer/src/page/ResumeEditor/index.vue
Normal file
@@ -0,0 +1,571 @@
|
||||
<template>
|
||||
<div class="resume-editor-page">
|
||||
<div class="main-wrapper">
|
||||
<main>
|
||||
<div class="mt1em mb1em flex flex-items-center flex-justify-between">
|
||||
<span>简历编辑器</span>
|
||||
</div>
|
||||
<el-alert type="info" :closable="false" mb20px line-height-1.25em>
|
||||
<ul pl16px m0>
|
||||
<li>
|
||||
此简历将作为提示词的一部分提交给语言大模型,仅在匹配职位、生成已读不回提醒消息时使用;大部分信息非必填,但在不填写的情况下,可能会匹配到不准确的职位或生成预料之外的已读不回提醒消息
|
||||
</li>
|
||||
<li>期望薪资仅作匹配职位使用,不会用作生成已读不回提醒消息</li>
|
||||
</ul>
|
||||
</el-alert>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formContentForElForm"
|
||||
:rules="formRulesForElForm"
|
||||
label-position="top"
|
||||
class="resume-editor-form"
|
||||
:validate-on-rule-change="false"
|
||||
>
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr',
|
||||
gap: '10px'
|
||||
}"
|
||||
>
|
||||
<el-form-item label="姓名">
|
||||
<el-input v-model="formContent.name" font-size-12px></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作年限">
|
||||
<el-input v-model="formContent.workYearDesc" font-size-12px></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="期望职位">
|
||||
<el-input v-model="formContent.expectJob" font-size-12px></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="期望薪资(k)">
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr'
|
||||
}"
|
||||
>
|
||||
<el-input v-model="formContent.expectSalary[0]" placeholder="下限" />
|
||||
<el-input v-model="formContent.expectSalary[1]" placeholder="上限" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item label="个人优势">
|
||||
<el-input
|
||||
v-model="formContent.userDescription"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 6,
|
||||
maxRows: 8
|
||||
}"
|
||||
font-size-12px
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="el-form-item__label">
|
||||
工作经历
|
||||
<el-button size="small" :icon="Plus" @click="addWorkExp">新增一条</el-button>
|
||||
</div>
|
||||
<div v-for="(exp, index) in formContent.geekWorkExpList" :key="index">
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
gap: '12px'
|
||||
}"
|
||||
>
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: '10px',
|
||||
height: 'fit-content',
|
||||
marginTop: '10px'
|
||||
}"
|
||||
>
|
||||
<el-button
|
||||
:disabled="index <= 0"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowUp"
|
||||
@click="moveWorkExpUp(index)"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="index >= formContent.geekWorkExpList.length - 1"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowDown"
|
||||
@click="moveWorkExpDown(index)"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="1 >= formContent.geekWorkExpList.length"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="Delete"
|
||||
@click="removeWorkExp(index)"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1.25fr 1fr',
|
||||
gap: '10px',
|
||||
width: '100%'
|
||||
}"
|
||||
>
|
||||
<el-form-item
|
||||
label="公司名称"
|
||||
style="margin-bottom: 18px"
|
||||
:prop="`geekWorkExpList_${index}_company`"
|
||||
>
|
||||
<el-input v-model="exp.company" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任职时间" style="margin-bottom: 18px">
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr'
|
||||
}"
|
||||
>
|
||||
<el-date-picker
|
||||
v-model="exp.startYearMon"
|
||||
:style="{ '--el-date-editor-width': 'auto' }"
|
||||
type="month"
|
||||
placeholder="开始月份"
|
||||
/>
|
||||
<el-date-picker
|
||||
v-model="exp.endYearMon"
|
||||
:style="{ '--el-date-editor-width': 'auto' }"
|
||||
type="month"
|
||||
placeholder="结束月份"
|
||||
/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="职务" style="margin-bottom: 18px">
|
||||
<el-input v-model="exp.positionName" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="工作描述" style="margin-bottom: 18px">
|
||||
<el-input
|
||||
v-model="exp.workDescription"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 6,
|
||||
maxRows: 8
|
||||
}"
|
||||
font-size-12px
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作业绩">
|
||||
<el-input
|
||||
v-model="exp.performance"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 6,
|
||||
maxRows: 8
|
||||
}"
|
||||
font-size-12px
|
||||
/>
|
||||
</el-form-item>
|
||||
<div
|
||||
v-if="index !== formContent.geekWorkExpList.length - 1"
|
||||
class="mt20px mb20px h1px"
|
||||
style="background-color: #dcdcdc"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="el-form-item__label">
|
||||
项目经历
|
||||
<el-button size="small" :icon="Plus" @click="addProjExp">新增一条</el-button>
|
||||
</div>
|
||||
<div v-for="(proj, index) in formContent.geekProjExpList" :key="index">
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
gap: '12px'
|
||||
}"
|
||||
>
|
||||
<div
|
||||
:style="{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: '10px',
|
||||
height: 'fit-content',
|
||||
marginTop: '10px'
|
||||
}"
|
||||
>
|
||||
<el-button
|
||||
:disabled="index <= 0"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowUp"
|
||||
@click="moveProjExpUp(index)"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="index >= formContent.geekProjExpList.length - 1"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="ArrowDown"
|
||||
@click="moveProjExpDown(index)"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="1 >= formContent.geekProjExpList.length"
|
||||
style="margin: 0"
|
||||
circle
|
||||
size="small"
|
||||
:icon="Delete"
|
||||
@click="removeProjExp(index)"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr 1.25fr',
|
||||
gap: '10px',
|
||||
width: '100%'
|
||||
}"
|
||||
>
|
||||
<el-form-item
|
||||
label="项目名称"
|
||||
style="margin-bottom: 18px"
|
||||
:prop="`geekProjExpList_${index}_name`"
|
||||
>
|
||||
<el-input v-model="proj.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目角色" style="margin-bottom: 18px">
|
||||
<el-input v-model="proj.roleName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目时间" style="margin-bottom: 18px">
|
||||
<div
|
||||
:style="{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr'
|
||||
}"
|
||||
>
|
||||
<el-date-picker
|
||||
v-model="proj.startYearMon"
|
||||
:style="{ '--el-date-editor-width': 'auto' }"
|
||||
type="month"
|
||||
placeholder="开始月份"
|
||||
/>
|
||||
<el-date-picker
|
||||
v-model="proj.endYearMon"
|
||||
:style="{ '--el-date-editor-width': 'auto' }"
|
||||
type="month"
|
||||
placeholder="结束月份"
|
||||
/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="项目描述" style="margin-bottom: 18px">
|
||||
<el-input
|
||||
v-model="proj.projectDescription"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 6,
|
||||
maxRows: 8
|
||||
}"
|
||||
font-size-12px
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目业绩">
|
||||
<el-input
|
||||
v-model="proj.performance"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 6,
|
||||
maxRows: 8
|
||||
}"
|
||||
font-size-12px
|
||||
/>
|
||||
</el-form-item>
|
||||
<div
|
||||
v-if="index !== formContent.geekProjExpList.length - 1"
|
||||
class="mt20px mb20px h1px"
|
||||
style="background-color: #dcdcdc"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</main>
|
||||
</div>
|
||||
<footer pt10px pb10px flex flex-justify-center>
|
||||
<div w768px flex flex-justify-between>
|
||||
<div>
|
||||
<!-- <el-button type="text" @click="handleTestAvailability">测试可用性</el-button> -->
|
||||
</div>
|
||||
<div>
|
||||
<el-button @click="handleCancel">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElForm, ElButton, ElAlert, ElMessageBox } from 'element-plus'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { ArrowUp, ArrowDown, Delete, Plus } from '@element-plus/icons-vue'
|
||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||
import { type ResumeContent, resumeContentEnoughDetect } from '../../../../common/utils/resume'
|
||||
|
||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
|
||||
const gtagRenderer = (name, params?: object) => {
|
||||
return baseGtagRenderer(name, {
|
||||
scene: 'resume-editor',
|
||||
...params
|
||||
})
|
||||
}
|
||||
|
||||
const getEmptyFormContent = () => {
|
||||
const o: any = {
|
||||
expectJob: '',
|
||||
name: '',
|
||||
userDescription: '',
|
||||
workYearDesc: '',
|
||||
expectSalary: ['', ''],
|
||||
geekWorkExpList: [],
|
||||
geekProjExpList: []
|
||||
}
|
||||
o.geekProjExpList = [getNewProjExpItem()]
|
||||
o.geekWorkExpList = [getNewWorkExpItem()]
|
||||
|
||||
return o as ResumeContent
|
||||
}
|
||||
const formContent = ref<ResumeContent>(getEmptyFormContent())
|
||||
|
||||
const formContentForElForm = computed(() => {
|
||||
const valueMap = {}
|
||||
formContent.value.geekWorkExpList?.forEach((item, i) => {
|
||||
valueMap[`geekWorkExpList_${i}_company`] = item.company
|
||||
})
|
||||
formContent.value.geekProjExpList?.forEach((item, i) => {
|
||||
valueMap[`geekProjExpList_${i}_name`] = item.name
|
||||
})
|
||||
return valueMap
|
||||
})
|
||||
const formRulesForElForm = computed(() => {
|
||||
const valueMap = {}
|
||||
formContent.value.geekWorkExpList.forEach((_, i) => {
|
||||
valueMap[`geekWorkExpList_${i}_company`] = [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入公司名称'
|
||||
},
|
||||
{
|
||||
trigger: 'blur',
|
||||
validator(_, value, cb) {
|
||||
if (!value.trim()) {
|
||||
cb(`请输入公司名称`)
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
formContent.value.geekProjExpList.forEach((_, i) => {
|
||||
valueMap[`geekProjExpList_${i}_name`] = [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入项目名称'
|
||||
},
|
||||
{
|
||||
trigger: 'blur',
|
||||
validator(_, value, cb) {
|
||||
if (!value.trim()) {
|
||||
cb(`请输入项目名称`)
|
||||
} else {
|
||||
cb()
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
return valueMap
|
||||
})
|
||||
const handleCancel = () => {
|
||||
gtagRenderer('cancel_clicked')
|
||||
electron.ipcRenderer.send('close-resume-editor')
|
||||
gtagRenderer('cancel_done')
|
||||
}
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
gtagRenderer('submit_clicked')
|
||||
if (
|
||||
!resumeContentEnoughDetect({
|
||||
content: formContent.value
|
||||
})
|
||||
) {
|
||||
try {
|
||||
gtagRenderer('rc_not_enough_dialog_show')
|
||||
await ElMessageBox.confirm(
|
||||
`简历内容可能不够充足(各个部分内容长度相加 <800 字)<br />后续大模型根据简历生成的内容将可能不符合预期(例如相同内容重复生成、生成预期之外的内容)<br /><br />要继续保存吗?`,
|
||||
{
|
||||
cancelButtonText: '不,我再改改',
|
||||
confirmButtonText: '是的,继续保存',
|
||||
dangerouslyUseHTMLString: true
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
}
|
||||
electron.ipcRenderer.invoke('save-resume-content', JSON.parse(JSON.stringify(formContent.value)))
|
||||
gtagRenderer('submit_done')
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const savedFileContent = await electron.ipcRenderer.invoke('fetch-resume-content')
|
||||
if (!savedFileContent) {
|
||||
return
|
||||
}
|
||||
for (const k of Object.keys(formContent.value)) {
|
||||
formContent.value[k] = savedFileContent[k]
|
||||
}
|
||||
if (!formContent.value.expectSalary) {
|
||||
formContent.value.expectSalary = ['', '']
|
||||
}
|
||||
if (!formContent.value.expectSalary?.[0] || /\D/.test(formContent.value.expectSalary?.[0])) {
|
||||
formContent.value.expectSalary[0] = ''
|
||||
}
|
||||
if (!formContent.value.expectSalary?.[1] || /\D/.test(formContent.value.expectSalary?.[1])) {
|
||||
formContent.value.expectSalary[1] = ''
|
||||
}
|
||||
if (!formContent.value.geekProjExpList?.length) {
|
||||
formContent.value.geekProjExpList = [getNewProjExpItem()]
|
||||
}
|
||||
if (!formContent.value.geekWorkExpList?.length) {
|
||||
formContent.value.geekWorkExpList = [getNewWorkExpItem()]
|
||||
}
|
||||
} catch (err) {
|
||||
formContent.value = getEmptyFormContent()
|
||||
}
|
||||
})
|
||||
|
||||
// function handlePresetClick(selected: (typeof llmPresetList)[number]) {}
|
||||
|
||||
// #region edit work exp list
|
||||
function getNewWorkExpItem() {
|
||||
return {
|
||||
company: '',
|
||||
endYearMon: '',
|
||||
positionName: '',
|
||||
startYearMon: '',
|
||||
performance: '',
|
||||
workDescription: ''
|
||||
}
|
||||
}
|
||||
function addWorkExp() {
|
||||
formContent.value.geekWorkExpList.push(getNewWorkExpItem())
|
||||
gtagRenderer('resume_work_exp_added')
|
||||
}
|
||||
function moveWorkExpUp(index) {
|
||||
;[formContent.value.geekWorkExpList[index], formContent.value.geekWorkExpList[index - 1]] = [
|
||||
formContent.value.geekWorkExpList[index - 1],
|
||||
formContent.value.geekWorkExpList[index]
|
||||
]
|
||||
gtagRenderer('resume_work_exp_moved_up')
|
||||
}
|
||||
|
||||
function moveWorkExpDown(index) {
|
||||
;[formContent.value.geekWorkExpList[index], formContent.value.geekWorkExpList[index + 1]] = [
|
||||
formContent.value.geekWorkExpList[index + 1],
|
||||
formContent.value.geekWorkExpList[index]
|
||||
]
|
||||
gtagRenderer('resume_work_exp_moved_down')
|
||||
}
|
||||
|
||||
function removeWorkExp(index) {
|
||||
formContent.value.geekWorkExpList.splice(index, 1)
|
||||
gtagRenderer('resume_work_exp_removed')
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region edit proj list
|
||||
function getNewProjExpItem() {
|
||||
return {
|
||||
name: '',
|
||||
endYearMon: '',
|
||||
roleName: '',
|
||||
startYearMon: '',
|
||||
performance: '',
|
||||
projectDescription: ''
|
||||
}
|
||||
}
|
||||
function addProjExp() {
|
||||
formContent.value.geekProjExpList.push(getNewProjExpItem())
|
||||
gtagRenderer('resume_proj_exp_added')
|
||||
}
|
||||
function moveProjExpUp(index) {
|
||||
;[formContent.value.geekProjExpList[index], formContent.value.geekProjExpList[index - 1]] = [
|
||||
formContent.value.geekProjExpList[index - 1],
|
||||
formContent.value.geekProjExpList[index]
|
||||
]
|
||||
gtagRenderer('resume_proj_exp_moved_up')
|
||||
}
|
||||
|
||||
function moveProjExpDown(index) {
|
||||
;[formContent.value.geekProjExpList[index], formContent.value.geekProjExpList[index + 1]] = [
|
||||
formContent.value.geekProjExpList[index + 1],
|
||||
formContent.value.geekProjExpList[index]
|
||||
]
|
||||
gtagRenderer('resume_proj_exp_moved_down')
|
||||
}
|
||||
|
||||
function removeProjExp(index) {
|
||||
formContent.value.geekProjExpList.splice(index, 1)
|
||||
gtagRenderer('resume_proj_exp_removed')
|
||||
}
|
||||
// #endregion
|
||||
|
||||
onMounted(() => {
|
||||
gtagRenderer('resume_editor_mounted')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.resume-editor-page {
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
.main-wrapper {
|
||||
overflow: auto;
|
||||
main {
|
||||
margin: 0 auto;
|
||||
max-width: 768px;
|
||||
}
|
||||
}
|
||||
footer {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.resume-editor-form.el-form {
|
||||
.el-form-item__error--inline {
|
||||
margin-left: 0;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
|
||||
import BootstrapSplash from '@renderer/page/BootstrapSplash/index.vue'
|
||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
@@ -13,59 +14,80 @@ const routes: Array<RouteRecordRaw> = [
|
||||
path: '/cookieAssistant',
|
||||
component: () => import('@renderer/page/CookieAssistant/index.vue'),
|
||||
meta: {
|
||||
title: 'Cookie 助手'
|
||||
title: 'Boss 登录助手'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/configuration',
|
||||
component: () => import('@renderer/page/Configuration/index.vue'),
|
||||
redirect: '/configuration/GeekAutoStartChatWithBoss',
|
||||
path: '/llmConfig',
|
||||
component: () => import('@renderer/page/LlmConfig/index.vue'),
|
||||
meta: {
|
||||
title: '大语言模型设置'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/resumeEditor',
|
||||
component: () => import('@renderer/page/ResumeEditor/index.vue'),
|
||||
meta: {
|
||||
title: '简历编辑'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/readNoReplyReminderLlmMock',
|
||||
component: () => import('@renderer/page/ReadNoReplyReminderLlmMock/index.vue'),
|
||||
meta: {
|
||||
title: '已读不回提醒器 大语言模型测试'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/main-layout',
|
||||
component: () => import('@renderer/page/MainLayout/index.vue'),
|
||||
redirect: '/main-layout/GeekAutoStartChatWithBoss',
|
||||
children: [
|
||||
{
|
||||
path: 'GeekAutoStartChatWithBoss',
|
||||
component: () => import('@renderer/page/Configuration/GeekAutoStartChatWithBoss.vue'),
|
||||
component: () => import('@renderer/page/MainLayout/GeekAutoStartChatWithBoss/index.vue'),
|
||||
meta: {
|
||||
title: 'BOSS炸弹'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'ReadNoReplyReminder',
|
||||
component: () => import('@renderer/page/Configuration/ReadNoReplyReminder.vue'),
|
||||
component: () => import('@renderer/page/MainLayout/ReadNoReplyReminder.vue'),
|
||||
meta: {
|
||||
title: '已读不回提醒器'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'StartChatRecord',
|
||||
component: () => import('@renderer/page/Configuration/StartChatRecord.vue'),
|
||||
component: () => import('@renderer/page/MainLayout/StartChatRecord.vue'),
|
||||
meta: {
|
||||
title: '开聊记录'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'MarkAsNotSuitRecord',
|
||||
component: () => import('@renderer/page/Configuration/MarkAsNotSuitRecord.vue'),
|
||||
component: () => import('@renderer/page/MainLayout/MarkAsNotSuitRecord.vue'),
|
||||
meta: {
|
||||
title: '标记不合适记录'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'JobLibrary',
|
||||
component: () => import('@renderer/page/Configuration/JobLibrary.vue'),
|
||||
component: () => import('@renderer/page/MainLayout/JobLibrary.vue'),
|
||||
meta: {
|
||||
title: '职位库'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'BossLibrary',
|
||||
component: () => import('@renderer/page/Configuration/BossLibrary.vue'),
|
||||
component: () => import('@renderer/page/MainLayout/BossLibrary.vue'),
|
||||
meta: {
|
||||
title: 'Boss库'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'CompanyLibrary',
|
||||
component: () => import('@renderer/page/Configuration/CompanyLibrary.vue'),
|
||||
component: () => import('@renderer/page/MainLayout/CompanyLibrary.vue'),
|
||||
meta: {
|
||||
title: '公司库'
|
||||
}
|
||||
@@ -114,7 +136,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
component: () => import('@renderer/page/BootstrapSplash/page/DownloadingDependencies.vue'),
|
||||
meta: {
|
||||
title: '正在下载核心组件'
|
||||
},
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -125,12 +147,20 @@ const router = createRouter({
|
||||
routes
|
||||
})
|
||||
|
||||
router.afterEach((to) => {
|
||||
router.afterEach((to, from) => {
|
||||
if (to.meta?.title) {
|
||||
document.title = `${to.meta.title} - GeekGeekRun`
|
||||
document.title = `${to.meta.title} - GeekGeekRun 牛人快跑`
|
||||
} else {
|
||||
document.title = `GeekGeekRun`
|
||||
document.title = `GeekGeekRun 牛人快跑`
|
||||
}
|
||||
gtagRenderer('router_path_changed', {
|
||||
from_path: from.fullPath,
|
||||
to_path: to.fullPath
|
||||
})
|
||||
gtagRenderer('page_view', {
|
||||
page_location: location.href,
|
||||
page_title: document.title
|
||||
})
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
20
packages/ui/src/renderer/src/store/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { NewReleaseInfo } from '../../../common/types/update'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export const useUpdateStore = defineStore('update', () => {
|
||||
const availableNewRelease = ref<NewReleaseInfo | null>(null)
|
||||
|
||||
async function checkUpdate() {
|
||||
let result: NewReleaseInfo | null = null
|
||||
try {
|
||||
result = (await electron.ipcRenderer.invoke('check-update')) as NewReleaseInfo | null
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
availableNewRelease.value = result
|
||||
}
|
||||
checkUpdate()
|
||||
setInterval(checkUpdate, 30 * 30 * 1000)
|
||||
return { availableNewRelease }
|
||||
})
|
||||
15
packages/ui/src/renderer/src/utils/gtag.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export function gtagRenderer(name, params: any = null) {
|
||||
try {
|
||||
electron.ipcRenderer.send('gtag', {
|
||||
name,
|
||||
params: {
|
||||
...(params ?? {}),
|
||||
screen_w: window.screen?.width ?? null,
|
||||
screen_h: window.screen?.height ?? null,
|
||||
screen_dpr: window.devicePixelRatio
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
console.log('gtag error', err)
|
||||
}
|
||||
}
|
||||
3
packages/ui/src/renderer/src/utils/mitt.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import mitt from 'mitt'
|
||||
const mittBus = mitt()
|
||||
export default mittBus
|
||||
26
packages/utils/gpt-request.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
import OpenAI from "openai";
|
||||
|
||||
export async function completes(
|
||||
{
|
||||
baseURL,
|
||||
apiKey,
|
||||
model
|
||||
},
|
||||
messages
|
||||
) {
|
||||
const openai = new OpenAI({
|
||||
baseURL,
|
||||
apiKey,
|
||||
});
|
||||
|
||||
const completion = await openai.chat.completions.create({
|
||||
messages,
|
||||
model,
|
||||
frequency_penalty: 0,
|
||||
max_tokens: 100,
|
||||
temperature: 0.1
|
||||
});
|
||||
|
||||
console.log(completion.choices[0].message.content);
|
||||
return completion;
|
||||
}
|
||||