diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts new file mode 100644 index 00000000..53ec327c --- /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 3b4325ec..0a323983 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 00000000..f2f0afde --- /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 00000000..9d665c32 --- /dev/null +++ b/ui/src/api/model.ts @@ -0,0 +1,6 @@ +import { Result } from '@/request/Result' +import { get, post, del, put } from '@/request/index' +const prefix = '/model' +const prefix_provider = '/provider' + +export default {} diff --git a/ui/src/api/paragraph.ts b/ui/src/api/paragraph.ts new file mode 100644 index 00000000..178ca1e3 --- /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/components/ai-dialog/index.vue b/ui/src/components/ai-dialog/index.vue index 03b58771..ead74679 100644 --- a/ui/src/components/ai-dialog/index.vue +++ b/ui/src/components/ai-dialog/index.vue @@ -19,17 +19,15 @@ {{ data?.prologue }} - +

您可以尝试输入以下问题:

-
- - DataEase支持哪些类型的数据源? -
-
- - DataEase支持哪些类型的数据源?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -
+
diff --git a/ui/src/stores/modules/paragraph.ts b/ui/src/stores/modules/paragraph.ts index fddcac93..2bd8e824 100644 --- a/ui/src/stores/modules/paragraph.ts +++ b/ui/src/stores/modules/paragraph.ts @@ -1,5 +1,5 @@ import { defineStore } from 'pinia' -import datasetApi from '@/api/dataset' +import paragraphApi from '@/api/paragraph' const useParagraphStore = defineStore({ id: 'paragraph', @@ -7,7 +7,7 @@ const useParagraphStore = defineStore({ actions: { async asyncPutParagraph(datasetId: string, documentId: string, paragraphId: string, data: any) { return new Promise((resolve, reject) => { - datasetApi + paragraphApi .putParagraph(datasetId, documentId, paragraphId, data) .then((data) => { resolve(data) diff --git a/ui/src/views/application/CreateApplication.vue b/ui/src/views/application/CreateApplication.vue index 749f2dc0..9f135b3c 100644 --- a/ui/src/views/application/CreateApplication.vue +++ b/ui/src/views/application/CreateApplication.vue @@ -2,7 +2,7 @@ -
+

应用信息

@@ -14,7 +14,7 @@ label-position="top" require-asterisk-position="right" class="p-24" - style="padding-top: 0;" + style="padding-top: 0" > - + @@ -59,28 +59,13 @@
- +
-

DataEase 数据集

-
- - - -
-
-
- - -
-
- - - -

DataEase 数据集

+
DataEase 数据集
@@ -129,7 +114,7 @@