105 lines
2.1 KiB
TypeScript
105 lines
2.1 KiB
TypeScript
import request from '@/utils/request';
|
|
|
|
type ApiResult<T> = {
|
|
code: number;
|
|
msg: string;
|
|
data: T;
|
|
};
|
|
|
|
export type CaseTag = {
|
|
text: string;
|
|
type: string;
|
|
};
|
|
|
|
export type CaseSummaryItem = {
|
|
label: string;
|
|
text: string;
|
|
};
|
|
|
|
export type CaseRecord = {
|
|
caseId: string;
|
|
title: string;
|
|
type: string;
|
|
status: string;
|
|
time: string;
|
|
owner: string;
|
|
summary: string;
|
|
};
|
|
|
|
export type CaseDetailResponse = {
|
|
caseId: string;
|
|
fileName: string;
|
|
title: string;
|
|
type: string;
|
|
status: string;
|
|
time: string;
|
|
owner: string;
|
|
transcript: string;
|
|
summary: string;
|
|
mediaUrl?: string;
|
|
mediaOssId?: number | null;
|
|
};
|
|
|
|
export type CaseUploadResponse = {
|
|
caseId: string;
|
|
fileName: string;
|
|
transcript: string;
|
|
tags: CaseTag[];
|
|
source: string;
|
|
};
|
|
|
|
export type CaseOrganizeResponse = {
|
|
caseId: string;
|
|
summary: CaseSummaryItem[];
|
|
tags: CaseTag[];
|
|
aiSummary: string;
|
|
source: string;
|
|
};
|
|
|
|
export type CaseCurateResponse = {
|
|
selectedCaseIds: string[];
|
|
records: CaseRecord[];
|
|
sampleHint: string;
|
|
};
|
|
|
|
export function uploadCaseAudio(data: FormData): Promise<ApiResult<CaseUploadResponse>> {
|
|
return request({
|
|
url: '/api/knowledge/case/upload',
|
|
method: 'post',
|
|
data,
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function organizeKnowledgeCase(data: { caseId: string }): Promise<ApiResult<CaseOrganizeResponse>> {
|
|
return request({
|
|
url: '/api/knowledge/case/organize',
|
|
method: 'post',
|
|
data,
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function curateKnowledgeCase(data: { caseId: string; criteria: string; limit: number }): Promise<ApiResult<CaseCurateResponse>> {
|
|
return request({
|
|
url: '/api/knowledge/case/curate',
|
|
method: 'post',
|
|
data,
|
|
headers: { repeatSubmit: false }
|
|
});
|
|
}
|
|
|
|
export function getCaseRecords(limit = 20): Promise<ApiResult<CaseRecord[]>> {
|
|
return request({
|
|
url: `/api/knowledge/case/records?limit=${limit}`,
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
export function getCaseDetail(caseId: string): Promise<ApiResult<CaseDetailResponse>> {
|
|
return request({
|
|
url: `/api/knowledge/case/records/${encodeURIComponent(caseId)}`,
|
|
method: 'get'
|
|
});
|
|
}
|