184 lines
4.2 KiB
TypeScript
184 lines
4.2 KiB
TypeScript
import request from '@/utils/request';
|
|
|
|
type ApiResult<T> = {
|
|
code: number;
|
|
msg: string;
|
|
data: T;
|
|
};
|
|
|
|
export type InterviewStartRequest = {
|
|
candidateId: string;
|
|
positionCode: string;
|
|
mode: string;
|
|
};
|
|
|
|
export type InterviewQuestionResponse = {
|
|
questionId: string;
|
|
seq: number;
|
|
questionText: string;
|
|
point: string;
|
|
scenario: string;
|
|
sampleAnswer: string;
|
|
};
|
|
|
|
export type InterviewStartResponse = {
|
|
sessionId: string;
|
|
candidateId: string;
|
|
candidateName: string;
|
|
positionCode: string;
|
|
questions: InterviewQuestionResponse[];
|
|
source: string;
|
|
};
|
|
|
|
export type InterviewAnswerRequest = {
|
|
sessionId: string;
|
|
questionId: string;
|
|
answerText?: string;
|
|
answerAudioUrl?: string;
|
|
};
|
|
|
|
export type InterviewAnswerResponse = {
|
|
score: number;
|
|
dimensions: Record<string, number>;
|
|
aiComment: string;
|
|
};
|
|
|
|
export type InterviewFinishRequest = {
|
|
sessionId: string;
|
|
answers: Record<string, string>;
|
|
};
|
|
|
|
export type InterviewFinishResponse = {
|
|
totalScore: number;
|
|
suggestion: string;
|
|
result: string;
|
|
aiSummary: string;
|
|
evidence: string;
|
|
dimensions: Array<{
|
|
label: string;
|
|
value: number | string;
|
|
note: string;
|
|
}>;
|
|
records: InterviewRecord[];
|
|
source: string;
|
|
};
|
|
|
|
export type InterviewRecord = {
|
|
sessionId?: string;
|
|
time: string;
|
|
candidate: string;
|
|
position: string;
|
|
score: number;
|
|
reviewedScore?: number | null;
|
|
finalScore?: number;
|
|
reviewStatus?: string;
|
|
reviewer?: string;
|
|
reviewNote?: string;
|
|
result: string;
|
|
summary: string;
|
|
};
|
|
|
|
export type InterviewReviewRequest = {
|
|
reviewedScore: number;
|
|
reviewNote?: string;
|
|
};
|
|
|
|
export type CandidateLinkResponse = {
|
|
candidateId: string;
|
|
extPartyId: string;
|
|
status: string;
|
|
linkedTime: string;
|
|
};
|
|
|
|
export type CandidateMaterialReview = {
|
|
id: number | string;
|
|
candidateId: string;
|
|
candidateName: string;
|
|
ossId: number | string;
|
|
fileName: string;
|
|
materialType: string;
|
|
fileSize: number;
|
|
status: string;
|
|
reviewer?: string | null;
|
|
reviewedTime?: string | null;
|
|
time: string;
|
|
};
|
|
|
|
export function startInterview(data: InterviewStartRequest): Promise<ApiResult<InterviewStartResponse>> {
|
|
return request({
|
|
url: '/api/recruit/interview/start',
|
|
method: 'post',
|
|
data,
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function submitInterviewAnswer(data: InterviewAnswerRequest): Promise<ApiResult<InterviewAnswerResponse>> {
|
|
return request({
|
|
url: '/api/recruit/interview/answer',
|
|
method: 'post',
|
|
data,
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function finishInterview(data: InterviewFinishRequest): Promise<ApiResult<InterviewFinishResponse>> {
|
|
return request({
|
|
url: '/api/recruit/interview/finish',
|
|
method: 'post',
|
|
data,
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function listInterviewRecords(limit = 20): Promise<ApiResult<InterviewRecord[]>> {
|
|
return request({
|
|
url: '/api/recruit/interview/records',
|
|
method: 'get',
|
|
params: { limit }
|
|
});
|
|
}
|
|
|
|
export function reviewInterviewRecord(sessionId: string, data: InterviewReviewRequest): Promise<ApiResult<null>> {
|
|
return request({
|
|
url: `/api/recruit/interview/records/${encodeURIComponent(sessionId)}/review`,
|
|
method: 'post',
|
|
data,
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function getCandidateEmployeeLink(candidateId: string): Promise<ApiResult<CandidateLinkResponse | null>> {
|
|
return request({
|
|
url: '/api/recruit/interview/candidate-links',
|
|
method: 'get',
|
|
params: { candidateId }
|
|
});
|
|
}
|
|
|
|
export function linkCandidateEmployee(candidateId: string, extPartyId: string): Promise<ApiResult<CandidateLinkResponse>> {
|
|
return request({
|
|
url: '/api/recruit/interview/candidate-links',
|
|
method: 'post',
|
|
data: { candidateId, extPartyId },
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function listCandidateMaterialsForReview(status = ''): Promise<ApiResult<CandidateMaterialReview[]>> {
|
|
return request({
|
|
url: '/api/aihr/hr/candidate/materials',
|
|
method: 'get',
|
|
params: { status }
|
|
});
|
|
}
|
|
|
|
export function reviewCandidateMaterial(id: number | string, status: string): Promise<ApiResult<CandidateMaterialReview>> {
|
|
return request({
|
|
url: `/api/aihr/hr/candidate/materials/${id}/review`,
|
|
method: 'post',
|
|
data: { status },
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|