diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts new file mode 100644 index 000000000..53ec327cd --- /dev/null +++ b/ui/src/api/application.ts @@ -0,0 +1,5 @@ +import { Result } from '@/request/Result' +import { get, post, del, put } from '@/request/index' +const prefix = '/application' + +export default {} diff --git a/ui/src/api/dataset.ts b/ui/src/api/dataset.ts index 3b4325ece..0a3239837 100644 --- a/ui/src/api/dataset.ts +++ b/ui/src/api/dataset.ts @@ -1,8 +1,6 @@ import { Result } from '@/request/Result' import { get, post, del, put } from '@/request/index' import type { datasetListRequest, datasetData } from '@/api/type/dataset' -import type { Ref } from 'vue' -import type { KeyValue } from '@/api/type/common' const prefix = '/dataset' /** @@ -89,240 +87,11 @@ const putDateset: (dataset_id: string, data: any) => Promise> = ( return put(`${prefix}/${dataset_id}`, data) } -/** - * 分段预览(上传文档) - * @param 参数 file:file,limit:number,patterns:array,with_filter:boolean - */ -const postSplitDocument: (data: any) => Promise> = (data) => { - return post(`${prefix}/document/split`, data) -} - -/** - * 分段标识列表 - * @param loading 加载器 - * @returns 分段标识列表 - */ -const listSplitPattern: (loading?: Ref) => Promise>>> = ( - loading -) => { - return get(`${prefix}/document/split_pattern`, {}, loading) -} - -/** - * 文档列表 - * @param 参数 dataset_id, name - */ - -const getDocument: (dataset_id: string, name?: string) => Promise> = ( - dataset_id, - name -) => { - return get(`${prefix}/${dataset_id}/document`, name && { name }) -} - -/** - * 创建文档 - * @param 参数 - * { - "name": "string", - "paragraphs": [ - { - "content": "string", - "title": "string", - "problem_list": [ - { - "id": "string", - "content": "string" - } - ] - } - ] -} - */ -const postDocument: (dataset_id: string, data: any) => Promise> = ( - dataset_id, - data -) => { - return post(`${prefix}/${dataset_id}/document`, data) -} - -/** - * 修改文档 - * @param 参数 - * dataset_id, document_id, - * { - "name": "string", - "is_active": true - } - */ -const putDocument: (dataset_id: string, document_id: string, data: any) => Promise> = ( - dataset_id, - document_id, - data: any -) => { - return put(`${prefix}/${dataset_id}/document/${document_id}`, data) -} - -/** - * 删除文档 - * @param 参数 dataset_id, document_id, - */ -const delDocument: (dataset_id: string, document_id: string) => Promise> = ( - dataset_id, - document_id -) => { - return del(`${prefix}/${dataset_id}/document/${document_id}`) -} - -/** - * 文档详情 - * @param 参数 dataset_id - */ -const getDocumentDetail: (dataset_id: string, document_id: string) => Promise> = ( - dataset_id, - document_id -) => { - return get(`${prefix}/${dataset_id}/document/${document_id}`) -} - -/** - * 段落列表 - * @param 参数 dataset_id - */ -const getParagraph: (dataset_id: string, document_id: string) => Promise> = ( - dataset_id, - document_id -) => { - return get(`${prefix}/${dataset_id}/document/${document_id}/paragraph`) -} - -/** - * 删除段落 - * @param 参数 dataset_id, document_id, paragraph_id - */ -const delParagraph: ( - dataset_id: string, - document_id: string, - paragraph_id: string -) => Promise> = (dataset_id, document_id, paragraph_id) => { - return del(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`) -} - -/** - * 创建段落 - * @param 参数 - * dataset_id, document_id - * { - "content": "string", - "title": "string", - "is_active": true, - "problem_list": [ - { - "id": "string", - "content": "string" - } - ] - } - */ -const postParagraph: ( - dataset_id: string, - document_id: string, - data: any -) => Promise> = (dataset_id, document_id, data: any) => { - return post(`${prefix}/${dataset_id}/document/${document_id}/paragraph`, data) -} - -/** - * 修改段落 - * @param 参数 - * dataset_id, document_id, paragraph_id - * { - "content": "string", - "title": "string", - "is_active": true, - "problem_list": [ - { - "id": "string", - "content": "string" - } - ] - } - */ -const putParagraph: ( - dataset_id: string, - document_id: string, - paragraph_id: string, - data: any -) => Promise> = (dataset_id, document_id, paragraph_id, data: any) => { - return put(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`, data) -} - -/** - * 问题列表 - * @param 参数 dataset_id,document_id,paragraph_id - */ -const getProblem: ( - dataset_id: string, - document_id: string, - paragraph_id: string -) => Promise> = (dataset_id, document_id, paragraph_id: string) => { - return get(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`) -} - -/** - * 创建问题 - * @param 参数 - * dataset_id, document_id, paragraph_id - * { - "id": "string", - content": "string" - } - */ -const postProblem: ( - dataset_id: string, - document_id: string, - paragraph_id: string, - data: any -) => Promise> = (dataset_id, document_id, paragraph_id, data: any) => { - return post( - `${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`, - data - ) -} -/** - * 删除问题 - * @param 参数 dataset_id, document_id, paragraph_id,problem_id - */ -const delProblem: ( - dataset_id: string, - document_id: string, - paragraph_id: string, - problem_id: string -) => Promise> = (dataset_id, document_id, paragraph_id, problem_id) => { - return del( - `${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem/${problem_id}` - ) -} - export default { getDateset, getAllDateset, delDateset, postDateset, getDatesetDetail, - putDateset, - postSplitDocument, - getDocument, - postDocument, - putDocument, - delDocument, - getDocumentDetail, - getParagraph, - delParagraph, - putParagraph, - postParagraph, - getProblem, - postProblem, - delProblem, - listSplitPattern + putDateset } diff --git a/ui/src/api/document.ts b/ui/src/api/document.ts new file mode 100644 index 000000000..f2f0afde3 --- /dev/null +++ b/ui/src/api/document.ts @@ -0,0 +1,113 @@ +import { Result } from '@/request/Result' +import { get, post, del, put } from '@/request/index' +import type { Ref } from 'vue' +import type { KeyValue } from '@/api/type/common' +const prefix = '/dataset' + +/** + * 分段预览(上传文档) + * @param 参数 file:file,limit:number,patterns:array,with_filter:boolean + */ +const postSplitDocument: (data: any) => Promise> = (data) => { + return post(`${prefix}/document/split`, data) +} + +/** + * 分段标识列表 + * @param loading 加载器 + * @returns 分段标识列表 + */ +const listSplitPattern: (loading?: Ref) => Promise>>> = ( + loading +) => { + return get(`${prefix}/document/split_pattern`, {}, loading) +} + +/** + * 文档列表 + * @param 参数 dataset_id, name + */ + +const getDocument: (dataset_id: string, name?: string) => Promise> = ( + dataset_id, + name +) => { + return get(`${prefix}/${dataset_id}/document`, name && { name }) +} + +/** + * 创建文档 + * @param 参数 + * { + "name": "string", + "paragraphs": [ + { + "content": "string", + "title": "string", + "problem_list": [ + { + "id": "string", + "content": "string" + } + ] + } + ] +} + */ +const postDocument: (dataset_id: string, data: any) => Promise> = ( + dataset_id, + data +) => { + return post(`${prefix}/${dataset_id}/document`, data) +} + +/** + * 修改文档 + * @param 参数 + * dataset_id, document_id, + * { + "name": "string", + "is_active": true + } + */ +const putDocument: (dataset_id: string, document_id: string, data: any) => Promise> = ( + dataset_id, + document_id, + data: any +) => { + return put(`${prefix}/${dataset_id}/document/${document_id}`, data) +} + +/** + * 删除文档 + * @param 参数 dataset_id, document_id, + */ +const delDocument: (dataset_id: string, document_id: string) => Promise> = ( + dataset_id, + document_id +) => { + return del(`${prefix}/${dataset_id}/document/${document_id}`) +} + +/** + * 文档详情 + * @param 参数 dataset_id + */ +const getDocumentDetail: (dataset_id: string, document_id: string) => Promise> = ( + dataset_id, + document_id +) => { + return get(`${prefix}/${dataset_id}/document/${document_id}`) +} + + + +export default { + postSplitDocument, + getDocument, + postDocument, + putDocument, + delDocument, + getDocumentDetail, + listSplitPattern +} diff --git a/ui/src/api/model.ts b/ui/src/api/model.ts new file mode 100644 index 000000000..fb3962492 --- /dev/null +++ b/ui/src/api/model.ts @@ -0,0 +1,17 @@ +import { Result } from '@/request/Result' +import { get, post, del, put } from '@/request/index' +import type { modelRequest } from '@/api/type/model' +const prefix = '/model' +const prefix_provider = '/provider' + +/** + * 获得模型列表 + * @params 参数 name, model_type, model_name + */ +const getModel: (data?: modelRequest) => Promise> = (data) => { + return get(`${prefix}`, data) +} + +export default { + getModel +} diff --git a/ui/src/api/paragraph.ts b/ui/src/api/paragraph.ts new file mode 100644 index 000000000..178ca1e34 --- /dev/null +++ b/ui/src/api/paragraph.ts @@ -0,0 +1,132 @@ +import { Result } from '@/request/Result' +import { get, post, del, put } from '@/request/index' +const prefix = '/dataset' + +/** + * 段落列表 + * @param 参数 dataset_id + */ +const getParagraph: (dataset_id: string, document_id: string) => Promise> = ( + dataset_id, + document_id +) => { + return get(`${prefix}/${dataset_id}/document/${document_id}/paragraph`) +} + +/** + * 删除段落 + * @param 参数 dataset_id, document_id, paragraph_id + */ +const delParagraph: ( + dataset_id: string, + document_id: string, + paragraph_id: string +) => Promise> = (dataset_id, document_id, paragraph_id) => { + return del(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`) +} + +/** + * 创建段落 + * @param 参数 + * dataset_id, document_id + * { + "content": "string", + "title": "string", + "is_active": true, + "problem_list": [ + { + "id": "string", + "content": "string" + } + ] + } + */ +const postParagraph: ( + dataset_id: string, + document_id: string, + data: any +) => Promise> = (dataset_id, document_id, data: any) => { + return post(`${prefix}/${dataset_id}/document/${document_id}/paragraph`, data) +} + +/** + * 修改段落 + * @param 参数 + * dataset_id, document_id, paragraph_id + * { + "content": "string", + "title": "string", + "is_active": true, + "problem_list": [ + { + "id": "string", + "content": "string" + } + ] + } + */ +const putParagraph: ( + dataset_id: string, + document_id: string, + paragraph_id: string, + data: any +) => Promise> = (dataset_id, document_id, paragraph_id, data: any) => { + return put(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`, data) +} + +/** + * 问题列表 + * @param 参数 dataset_id,document_id,paragraph_id + */ +const getProblem: ( + dataset_id: string, + document_id: string, + paragraph_id: string +) => Promise> = (dataset_id, document_id, paragraph_id: string) => { + return get(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`) +} + +/** + * 创建问题 + * @param 参数 + * dataset_id, document_id, paragraph_id + * { + "id": "string", + content": "string" + } + */ +const postProblem: ( + dataset_id: string, + document_id: string, + paragraph_id: string, + data: any +) => Promise> = (dataset_id, document_id, paragraph_id, data: any) => { + return post( + `${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`, + data + ) +} +/** + * 删除问题 + * @param 参数 dataset_id, document_id, paragraph_id,problem_id + */ +const delProblem: ( + dataset_id: string, + document_id: string, + paragraph_id: string, + problem_id: string +) => Promise> = (dataset_id, document_id, paragraph_id, problem_id) => { + return del( + `${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem/${problem_id}` + ) +} + +export default { + getParagraph, + delParagraph, + putParagraph, + postParagraph, + getProblem, + postProblem, + delProblem, +} diff --git a/ui/src/api/team.ts b/ui/src/api/team.ts index 03c6b18d7..9e6ef896b 100644 --- a/ui/src/api/team.ts +++ b/ui/src/api/team.ts @@ -1,7 +1,6 @@ import { Result } from '@/request/Result' import { get, post, del, put } from '@/request/index' import type { TeamMember } from '@/api/type/team' -// import type { Ref } from 'vue' const prefix = '/team/member' diff --git a/ui/src/api/type/application.ts b/ui/src/api/type/application.ts new file mode 100644 index 000000000..ff4f7b8e0 --- /dev/null +++ b/ui/src/api/type/application.ts @@ -0,0 +1,10 @@ +interface ApplicationFormType { + name: string + desc: string + model_id: string + multiple_rounds_dialogue: boolean + prologue: string + example: string[] + dataset_id_list: string[] +} +export type { ApplicationFormType } diff --git a/ui/src/api/type/model.ts b/ui/src/api/type/model.ts new file mode 100644 index 000000000..e33c4bf32 --- /dev/null +++ b/ui/src/api/type/model.ts @@ -0,0 +1,6 @@ +interface modelRequest { + name: string + model_type: string + model_name: string +} +export type { modelRequest } diff --git a/ui/src/components/ai-dialog/index.vue b/ui/src/components/ai-dialog/index.vue index 2dbdacf64..ead74679a 100644 --- a/ui/src/components/ai-dialog/index.vue +++ b/ui/src/components/ai-dialog/index.vue @@ -1,65 +1,74 @@