简历优化和岗位简历

This commit is contained in:
2026-04-13 21:34:40 +08:00
parent a39835be01
commit 1c91818494
32 changed files with 3850 additions and 320 deletions
+253
View File
@@ -1,5 +1,7 @@
import request from '@/utils/request'
import aiService from '@/utils/aiRequest'
import type { ApiResult } from '@/api/auth'
import type { AiResult } from '@/utils/aiRequest'
// ==================== 匹配详情 ====================
@@ -363,3 +365,254 @@ export function fetchJobDetail(jobId: string) {
params: { jobId },
})
}
// ==================== 技能差距分析(AI 接口) ====================
/** 技能差距分析 — 岗位信息 */
export interface SkillGapJob {
/** 岗位 ID */
jobId: string
/** 岗位标题 */
title: string
/** 技能标签列表 */
skillTags: string[]
}
/** 技能差距分析 — 简历信息 */
export interface SkillGapResume {
/** 简历 ID */
resumeId: string
/** 简历名称 */
resumeName: string
/** 目标岗位 */
targetPosition: string
}
/** 技能差距分析返回数据 */
export interface SkillGapData {
/** 匹配度分数 */
score: number
/** 岗位信息 */
job: SkillGapJob
/** 简历信息 */
resume: SkillGapResume
/** 缺少的技能列表 */
missingSkills: string[]
}
/**
* 技能差距分析(AI 接口)
* POST /job/skill-gap
* @param jobId 岗位 ID(字符串,避免大整数精度丢失)
*/
export function fetchSkillGap(jobId: string) {
// jobId 作为字符串发送,避免 JS 大整数精度丢失
return aiService.post<any, { data: AiResult<SkillGapData> }>('/job/skill-gap', { jobId }, {
transformResponse: [(data: string) => {
try {
const processed = data.replace(/:\s*(\d{16,})/g, ':"$1"')
return JSON.parse(processed)
} catch {
return data
}
}],
}).then(res => res.data)
}
// ==================== 定制简历(AI 接口) ====================
/** 定制简历接口返回的简历数据 */
export interface CustomizeResumeData {
/** 简历基本信息 */
resume: {
avatarUrl?: string
name?: string
email?: string
mobileNumber?: string
city?: string
wechatNumber?: string
portfolioUrl?: string
skills?: string[]
certificates?: string[]
summary?: string
}
/** 教育经历 */
education?: Array<{
id?: string
school?: string
major?: string
degree?: string
studyType?: string
startDate?: string
endDate?: string
description?: Array<{ id?: string; text?: string }>
}>
/** 工作经历 */
work?: Array<{
id?: string
companyName?: string
position?: string
startDate?: string
endDate?: string
description?: Array<{ id?: string; text?: string }>
}>
/** 实习经历 */
internship?: Array<{
id?: string
companyName?: string
position?: string
startDate?: string
endDate?: string
description?: Array<{ id?: string; text?: string }>
}>
/** 项目经历 */
project?: Array<{
id?: string
projectName?: string
companyName?: string
role?: string
startDate?: string
endDate?: string
description?: Array<{ id?: string; text?: string }>
}>
/** 竞赛经历 */
competition?: Array<{
id?: string
competitionName?: string
award?: string
awardDate?: string
description?: Array<{ id?: string; text?: string }>
}>
}
/**
* 查询定制简历结果(AI 接口)
* GET /job/customize-resume
*/
export function fetchCustomizeResume() {
return aiService.get<any, { data: AiResult<CustomizeResumeData | null> }>('/job/customize-resume', {
transformResponse: [(data: string) => {
try {
const processed = data.replace(/:\s*(\d{16,})/g, ':"$1"')
return JSON.parse(processed)
} catch {
return data
}
}],
}).then(res => res.data)
}
/** 生成定制简历请求参数 */
export interface GenerateCustomizeResumeParams {
/** 岗位 ID(字符串,避免大整数精度丢失) */
jobId: string
/** 简历 ID(字符串,避免大整数精度丢失) */
resumeId: string
/** 要优化的模块列表 */
optimizeModules: string[]
/** 要新增的技能关键词 */
addSkills?: string[]
}
/**
* 生成定制简历(AI 接口)
* POST /job/customize-resume
* @param params 生成参数
*/
export function generateCustomizeResume(params: GenerateCustomizeResumeParams) {
return aiService.post<any, { data: AiResult<{ success: boolean }> }>('/job/customize-resume', params, {
transformResponse: [(data: string) => {
try {
const processed = data.replace(/:\s*(\d{16,})/g, ':"$1"')
return JSON.parse(processed)
} catch {
return data
}
}],
}).then(res => res.data)
}
// ==================== AI对话编辑简历(AI 接口) ====================
/** AI对话编辑简历的聊天记录项 */
export interface AiEditChatMessage {
/** 角色:user-用户 assistant-AI助手 */
role: 'user' | 'assistant'
/** 消息内容 */
content: string
}
/** AI对话编辑简历请求参数 */
export interface AiEditResumeParams {
/** 岗位 ID(字符串,避免大整数精度丢失) */
jobId: string
/** 用户输入的指令 */
instruction: string
/** 对话历史记录 */
chatHistory?: AiEditChatMessage[]
}
/** AI对话编辑简历返回数据 */
export interface AiEditResumeResponse {
/** 返回类型:message-对话消息 updated-简历已更新 */
type: 'message' | 'updated'
/** AI回复的消息内容 */
message: string
}
/**
* AI对话编辑简历(AI 接口)
* POST /job/customize-resume/ai-edit
* @param params 请求参数
*/
export function aiEditResume(params: AiEditResumeParams) {
// 强制确保 jobId 为字符串,避免大整数精度丢失
const safeParams = { ...params, jobId: String(params.jobId) }
return aiService.post<any, { data: AiResult<AiEditResumeResponse> }>('/job/customize-resume/ai-edit', safeParams, {
transformResponse: [(data: string) => {
try {
const processed = data.replace(/:\s*(\d{16,})/g, ':"$1"')
return JSON.parse(processed)
} catch {
return data
}
}],
}).then(res => res.data)
}
/**
* 撤销AI对话编辑简历的修改(AI 接口)
* POST /job/customize-resume/rollback
*/
export function rollbackCustomizeResume() {
return aiService.post<any, { data: AiResult<null> }>('/job/customize-resume/rollback', null, {
transformResponse: [(data: string) => {
try {
const processed = data.replace(/:\s*(\d{16,})/g, ':"$1"')
return JSON.parse(processed)
} catch {
return data
}
}],
}).then(res => res.data)
}
/**
* 修改定制简历(AI 接口)
* PUT /job/customize-resume
* 输入框失焦或选择器选中后自动调用
* @param data 定制简历完整数据
*/
export function updateCustomizeResume(data: CustomizeResumeData) {
return aiService.put<any, { data: AiResult<null> }>('/job/customize-resume', data, {
transformResponse: [(raw: string) => {
try {
const processed = raw.replace(/:\s*(\d{16,})/g, ':"$1"')
return JSON.parse(processed)
} catch {
return raw
}
}],
}).then(res => res.data)
}