annotation.ts
2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* @Author: liimin 17653212@qq.com
* @Date: 2025-05-09 17:17:10
* @LastEditors: liimin 17653212@qq.com
* @LastEditTime: 2025-05-13 10:34:21
* @FilePath: \ai-assistant\service\annotation.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { del, get, post } from './base'
// import type { AnnotationEnableStatus, AnnotationItemBasic, EmbeddingModelConfig } from '@/app/components/app/annotation/type'
// import { ANNOTATION_DEFAULT } from '@/config'
// export const fetchAnnotationConfig = (appId: string) => {
// return get(`apps/${appId}/annotation-setting`)
// }
// export const updateAnnotationStatus = (appId: string, action: AnnotationEnableStatus, embeddingModel?: EmbeddingModelConfig, score?: number) => {
// let body: any = {
// score_threshold: score || ANNOTATION_DEFAULT.score_threshold,
// }
// if (embeddingModel) {
// body = {
// ...body,
// ...embeddingModel,
// }
// }
// return post(`apps/${appId}/annotation-reply/${action}`, {
// body,
// })
// }
// export const updateAnnotationScore = (appId: string, settingId: string, score: number) => {
// return post(`apps/${appId}/annotation-settings/${settingId}`, {
// body: { score_threshold: score },
// })
// }
// export const queryAnnotationJobStatus = (appId: string, action: AnnotationEnableStatus, jobId: string) => {
// return get(`apps/${appId}/annotation-reply/${action}/status/${jobId}`)
// }
// export const fetchAnnotationList = (appId: string, params: Record<string, any>) => {
// return get(`apps/${appId}/annotations`, { params })
// }
// export const fetchExportAnnotationList = (appId: string) => {
// return get(`apps/${appId}/annotations/export`)
// }
// export const addAnnotation = (appId: string, body: AnnotationItemBasic) => {
// return post(`apps/${appId}/annotations`, { body })
// }
// export const annotationBatchImport: Fetcher<{ job_id: string; job_status: string }, { url: string; body: FormData }> = ({ url, body }) => {
// return post<{ job_id: string; job_status: string }>(url, { body }, { bodyStringify: false, deleteContentType: true })
// }
// export const checkAnnotationBatchImportProgress: Fetcher<{ job_id: string; job_status: string }, { jobID: string; appId: string }> = ({ jobID, appId }) => {
// return get<{ job_id: string; job_status: string }>(`/apps/${appId}/annotations/batch-import-status/${jobID}`)
// }
// export const editAnnotation = (appId: string, annotationId: string, body: AnnotationItemBasic) => {
// return post(`apps/${appId}/annotations/${annotationId}`, { body })
// }
// export const delAnnotation = (appId: string, annotationId: string) => {
// return del(`apps/${appId}/annotations/${annotationId}`)
// }
export const fetchHitHistoryList = (appId: string, annotationId: string, params: Record<string, any>) => {
return get(`apps/${appId}/annotations/${annotationId}/hit-histories`, { params })
}