AI助手和Nova助手

This commit is contained in:
2026-05-06 15:07:44 +08:00
parent 1c91818494
commit f341408254
38 changed files with 4759 additions and 657 deletions
+280
View File
@@ -0,0 +1,280 @@
import request from '@/utils/request'
import type { ApiResult } from '@/api/auth'
// ==================== 求职助手配置相关 ====================
/** 语言能力项 */
export interface LanguageAbility {
/** 语种,如英语、日语、法语等 */
language?: string
/** 掌握程度,可选值:入门/日常会话/商务会话/无障碍沟通/母语 */
proficiency?: string
}
/** 求职助手配置数据(查询返回 + 保存请求共用) */
export interface AgentConfig {
/** 工作类型 1=实习 2=全职 */
jobType?: number
/** Agent模式 1=协作模式 2=托管模式 */
agentMode?: number
/** 每周投递目标数量 1=少于20个 2=20到50个 3=多于50个 */
weeklyTarget?: number
/** 投递时自动针对岗位优化简历 0=关闭 1=开启 */
autoOptimizeResume?: number
/** 是否愿意接受部门调剂 */
acceptDeptTransfer?: string
/** 是否接受地点调剂 */
acceptLocationTransfer?: string
/** 可参加的面试方式 */
interviewType?: string[]
/** 语言能力 */
languages?: LanguageAbility[]
/** 预计到岗时间 */
availableDate?: string
/** 每周可实习天数 */
internDaysPerWeek?: string
/** 预计实习时长 */
internDuration?: string
/** 状态 0=未启用 1=已启用(仅查询返回) */
status?: number
}
/**
* 查询求职助手配置
* GET /job-agent/config
*/
export function fetchAgentConfig() {
return request.get<any, ApiResult<AgentConfig>>('/job-agent/config')
}
/**
* 保存求职助手配置
* POST /job-agent/config/save
*/
export function saveAgentConfig(data: AgentConfig) {
return request.post<any, ApiResult>('/job-agent/config/save', data)
}
// ==================== 求职助手岗位推荐 ====================
/** 匹配度详情 */
export interface AgentJobMatchDetail {
/** 学历匹配分 */
educationScore: number
/** 技能匹配分 */
skillScore: number
/** 经验匹配分 */
experienceScore: number
}
/** 推荐岗位项 */
export interface AgentRecommendJob {
/** 岗位 ID */
id: number
/** 岗位名称 */
title: string
/** 薪资描述 */
salary: string
/** 公司名称 */
companyName: string
/** 公司简称 */
companyShortName: string
/** 公司类型 */
companyType: string
/** 公司 Logo */
companyLogoUrl: string
/** 地区名称 */
regionName: string
/** 岗位类型名称 */
categoryName: string
/** 岗位标签 */
tags: string[]
/** 来源链接 */
sourceUrl: string
/** 是否收藏 */
isFavorite: boolean
/** 投递状态(null=未投递,-1=待投递,0=已投递 1=面试中 2=有Offer 3=未通过 4=已结束) */
applicationStatus: number | null
/** 岗位状态(0=有效 1=已下架 2=已过期) */
status: number
/** 匹配总分(0-90 */
matchScore: number
/** 匹配度详情 */
matchDetail: AgentJobMatchDetail
}
/** 求职助手岗位推荐返回数据 */
export interface AgentRecommendResult {
/** 推荐说明(20字以内) */
summary: string
/** 推荐的岗位列表(8-10个) */
list: AgentRecommendJob[]
}
/** 求职助手岗位推荐请求参数 */
export interface AgentRecommendParams {
/** 用户偏好描述 */
preference?: string
/** 排除已推荐过的岗位 ID 列表(字符串避免大整数精度丢失) */
excludeJobIds?: (number | string)[]
}
/**
* 求职助手岗位推荐
* POST /job/agent/recommend
*/
export function fetchAgentRecommend(params: AgentRecommendParams = {}) {
return request.post<any, ApiResult<AgentRecommendResult>>('/job/agent/recommend', params)
}
// ==================== 岗位投递状态变更 ====================
/** 岗位投递请求参数 */
export interface JobApplyParams {
/** 岗位 ID */
jobId: number
/** 投递状态:-1=待投递 0=已投递 1=面试中 2=有Offer 3=未通过 4=已结束,null=取消 */
status: number | null
}
/**
* 变更岗位投递状态(添加到待投递等)
* POST /job/apply
*/
export function applyJob(params: JobApplyParams) {
return request.post<any, ApiResult>('/job/apply', params)
}
/**
* 取消投递 / 从待投递移除
* DELETE /job/apply?jobId=xxx
* @param jobId 岗位 ID
*/
export function cancelApplyJob(jobId: number) {
return request.delete<any, ApiResult>('/job/apply', {
params: { jobId },
})
}
// ==================== Agent 对话消息 ====================
/** 消息创建时间 */
export interface InstantTime {
/** 距 1970-01-01T00:00:00Z 的秒数 */
seconds: number
/** 纳秒偏移(0 ~ 999,999,999 */
nanos: number
}
/** Agent 对话消息项 */
export interface AgentChatMessage {
/** 消息 ID */
id: number
/** 消息类型:user / assistant / recommend / apply_progress */
type: string
/** 文本内容 */
content: string
/** 附加数据 JSON(如推荐岗位列表等) */
extra: string
/** 创建时间 */
createTime: InstantTime
}
/**
* 查询当前 Agent 对话消息列表
* GET /job-agent/chat/messages?limit=xxx
* @param limit 查询条数
*/
export function fetchAgentChatMessages(limit: number = 50) {
return request.get<any, ApiResult<AgentChatMessage[]>>('/job-agent/chat/messages', {
params: { limit },
})
}
/** 添加对话消息请求参数 */
export interface AddChatMessageParams {
/** 消息类型:user / assistant / recommend / apply_progress */
type: string
/** 文本内容 */
content?: string
/** 附加数据 JSON */
extra?: string
}
/**
* 添加 Agent 对话消息
* POST /job-agent/chat/message
*/
export function addAgentChatMessage(params: AddChatMessageParams) {
return request.post<any, ApiResult>('/job-agent/chat/message', params)
}
// ==================== 批量查询岗位投递记录 ====================
/** 岗位投递记录项 */
export interface JobApplyRecord {
/** 岗位 ID */
jobId: number
/** 投递状态:-1=待投递 0=已投递 1=面试中 2=有Offer 3=未通过 4=已结束 */
status: number
/** 投递时间 */
applyTime: InstantTime
/** 创建时间 */
createTime: InstantTime
}
/**
* 根据岗位 ID 批量查询投递记录
* POST /job/apply/listByJobIds
* @param jobIds 岗位 ID 列表
*/
export function fetchApplyByJobIds(jobIds: number[]) {
return request.post<any, ApiResult<JobApplyRecord[]>>('/job/apply/listByJobIds', jobIds)
}
// ==================== Agent AI 对话(Python 后端) ====================
import aiService from '@/utils/aiRequest'
import type { AiResult } from '@/utils/aiRequest'
/** AI 对话历史消息项 */
export interface AgentChatHistoryItem {
/** 角色:user / assistant */
role: string
/** 消息内容 */
content: string
}
/** Agent AI 对话请求参数 */
export interface AgentChatParams {
/** 用户输入的消息 */
message: string
/** 简历 ID(字符串,避免大整数精度丢失) */
resumeId: string
/** 对话历史 */
history?: AgentChatHistoryItem[]
/** 意向岗位类型名称 */
jobCategories?: string[]
/** 意向城市名称 */
regions?: string[]
/** 意向行业名称 */
industries?: string[]
}
/** Agent AI 对话返回数据 */
export interface AgentChatResponse {
/** AI 回复的消息内容 */
message: string
/** 工具调用名称(null=普通回复,recommend=推荐岗位) */
tool: string | null
/** 工具调用参数 */
toolParams: Record<string, any> | null
}
/**
* Agent AI 对话(Python 后端)
* POST /job-agent/chat
*/
export function sendAgentChat(params: AgentChatParams) {
return aiService.post<any, { data: AiResult<AgentChatResponse> }>('/job-agent/chat', params).then(res => res.data)
}