add logic to check if resume content rich enough

This commit is contained in:
geekgeekrun
2025-04-13 23:47:25 +08:00
parent 0e85942de5
commit 7b5ff9951b
5 changed files with 70 additions and 26 deletions

View File

@@ -1,3 +1,27 @@
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],
@@ -53,3 +77,7 @@ export function formatResumeJsonToMarkdown(resume) {
return result
}
export function resumeContentEnoughDetect(resumeItem: { content: ResumeContent }) {
return formatResumeJsonToMarkdown(resumeItem)?.length > 800
}

View File

@@ -38,6 +38,7 @@ import {
autoReminderPromptTemplateFileName,
writeDefaultAutoRemindPrompt
} from '../../READ_NO_REPLY_AUTO_REMINDER/boss-operation'
import { resumeContentEnoughDetect } from '../../../../common/utils/resume'
export default function initIpc() {
ipcMain.handle('fetch-config-file-content', async () => {
@@ -502,6 +503,10 @@ export default function initIpc() {
ipcMain.handle('check-if-auto-remind-prompt-valid', async () => {
await getValidTemplate()
})
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()
})

View File

@@ -6,7 +6,7 @@ import {
readStorageFile,
writeStorageFile
} from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
import { formatResumeJsonToMarkdown } from '../../../common/utils/format-resume-json-to-markdown'
import { formatResumeJsonToMarkdown } from '../../../common/utils/resume'
import { SINGLE_ITEM_DEFAULT_SERVE_WEIGHT } from '../../../common/constant'
export const sendLookForwardReplyEmotion = async (page: Page) => {

View File

@@ -268,6 +268,21 @@ const handleSubmit = async () => {
}
return
}
if (!(await electron.ipcRenderer.invoke('resume-content-enough-detect'))) {
gtagRenderer('resume_content_not_enough_dialog_show')
try {
await ElMessageBox.confirm(
`简历内容可能不够充足(各个部分内容长度相加 <800 字)<br />后续大模型根据简历生成的内容将可能不够随机<br /><br />要继续运行吗?`,
{
cancelButtonText: '不,我再看看',
confirmButtonText: '是的,继续运行',
dangerouslyUseHTMLString: true
}
)
} catch {
return
}
}
gtagRenderer('reminder_launched')
router.replace({
path: '/geekAutoStartChatWithBoss/prepareRun',

View File

@@ -310,34 +310,11 @@
</template>
<script lang="ts" setup>
import { ElForm, ElButton, ElAlert } from 'element-plus'
import { ElForm, ElButton, ElAlert, ElMessageBox } from 'element-plus'
import { ref, onMounted } from 'vue'
import { ArrowUp, ArrowDown, Delete, Plus } from '@element-plus/icons-vue'
import { gtagRenderer } from '@renderer/utils/gtag'
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]
}
import { type ResumeContent, resumeContentEnoughDetect } from '../../../../common/utils/resume'
const formRef = ref<InstanceType<typeof ElForm>>()
@@ -367,6 +344,25 @@ const handleCancel = () => {
}
const handleSubmit = async () => {
gtagRenderer('submit_clicked')
if (
!resumeContentEnoughDetect({
content: formContent.value
})
) {
try {
gtagRenderer('resume_content_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')
}