chore: initialize wygj monorepo
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
type ApiResult<T> = {
|
||||
code: number;
|
||||
msg: string;
|
||||
data: T;
|
||||
};
|
||||
|
||||
export type SopDoc = {
|
||||
title: string;
|
||||
desc: string;
|
||||
hit: string;
|
||||
type: string;
|
||||
};
|
||||
|
||||
export type SopSnippet = {
|
||||
title: string;
|
||||
text: string;
|
||||
};
|
||||
|
||||
export type SopRecord = {
|
||||
title: string;
|
||||
category: string;
|
||||
version: string;
|
||||
status: string;
|
||||
owner: string;
|
||||
summary: string;
|
||||
};
|
||||
|
||||
export type SopSearchResponse = {
|
||||
queryText: string;
|
||||
category: string;
|
||||
answer: string;
|
||||
reference: string;
|
||||
docs: SopDoc[];
|
||||
snippets: SopSnippet[];
|
||||
training: string[];
|
||||
records: SopRecord[];
|
||||
};
|
||||
|
||||
export type SopUploadResponse = {
|
||||
docId: string;
|
||||
ossId: number;
|
||||
fileName: string;
|
||||
category: string;
|
||||
fragments: number;
|
||||
summary: string;
|
||||
tags: string[];
|
||||
snippets: SopSnippet[];
|
||||
};
|
||||
|
||||
export function searchKnowledgeSop(data: { queryText: string; category: string; limit: number }): Promise<ApiResult<SopSearchResponse>> {
|
||||
return request({
|
||||
url: '/api/knowledge/search',
|
||||
method: 'post',
|
||||
data,
|
||||
headers: { repeatSubmit: false }
|
||||
});
|
||||
}
|
||||
|
||||
export function uploadKnowledgeDoc(data: FormData): Promise<ApiResult<SopUploadResponse>> {
|
||||
return request({
|
||||
url: '/api/knowledge/doc/upload',
|
||||
method: 'post',
|
||||
data,
|
||||
headers: { repeatSubmit: false }
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user