mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: 新建应用
This commit is contained in:
parent
c97c97c6ab
commit
9cb0a4f27c
|
|
@ -0,0 +1,5 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
const prefix = '/application'
|
||||
|
||||
export default {}
|
||||
|
|
@ -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<Result<any>> = (
|
|||
return put(`${prefix}/${dataset_id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分段预览(上传文档)
|
||||
* @param 参数 file:file,limit:number,patterns:array,with_filter:boolean
|
||||
*/
|
||||
const postSplitDocument: (data: any) => Promise<Result<any>> = (data) => {
|
||||
return post(`${prefix}/document/split`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分段标识列表
|
||||
* @param loading 加载器
|
||||
* @returns 分段标识列表
|
||||
*/
|
||||
const listSplitPattern: (loading?: Ref<boolean>) => Promise<Result<Array<KeyValue<string, string>>>> = (
|
||||
loading
|
||||
) => {
|
||||
return get(`${prefix}/document/split_pattern`, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档列表
|
||||
* @param 参数 dataset_id, name
|
||||
*/
|
||||
|
||||
const getDocument: (dataset_id: string, name?: string) => Promise<Result<any>> = (
|
||||
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<Result<any>> = (
|
||||
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<Result<any>> = (
|
||||
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<Result<boolean>> = (
|
||||
dataset_id,
|
||||
document_id
|
||||
) => {
|
||||
return del(`${prefix}/${dataset_id}/document/${document_id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档详情
|
||||
* @param 参数 dataset_id
|
||||
*/
|
||||
const getDocumentDetail: (dataset_id: string, document_id: string) => Promise<Result<any>> = (
|
||||
dataset_id,
|
||||
document_id
|
||||
) => {
|
||||
return get(`${prefix}/${dataset_id}/document/${document_id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 段落列表
|
||||
* @param 参数 dataset_id
|
||||
*/
|
||||
const getParagraph: (dataset_id: string, document_id: string) => Promise<Result<any>> = (
|
||||
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<Result<boolean>> = (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<Result<any>> = (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<Result<any>> = (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<Result<any>> = (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<Result<any>> = (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<Result<boolean>> = (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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Result<any>> = (data) => {
|
||||
return post(`${prefix}/document/split`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分段标识列表
|
||||
* @param loading 加载器
|
||||
* @returns 分段标识列表
|
||||
*/
|
||||
const listSplitPattern: (loading?: Ref<boolean>) => Promise<Result<Array<KeyValue<string, string>>>> = (
|
||||
loading
|
||||
) => {
|
||||
return get(`${prefix}/document/split_pattern`, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档列表
|
||||
* @param 参数 dataset_id, name
|
||||
*/
|
||||
|
||||
const getDocument: (dataset_id: string, name?: string) => Promise<Result<any>> = (
|
||||
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<Result<any>> = (
|
||||
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<Result<any>> = (
|
||||
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<Result<boolean>> = (
|
||||
dataset_id,
|
||||
document_id
|
||||
) => {
|
||||
return del(`${prefix}/${dataset_id}/document/${document_id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档详情
|
||||
* @param 参数 dataset_id
|
||||
*/
|
||||
const getDocumentDetail: (dataset_id: string, document_id: string) => Promise<Result<any>> = (
|
||||
dataset_id,
|
||||
document_id
|
||||
) => {
|
||||
return get(`${prefix}/${dataset_id}/document/${document_id}`)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
postSplitDocument,
|
||||
getDocument,
|
||||
postDocument,
|
||||
putDocument,
|
||||
delDocument,
|
||||
getDocumentDetail,
|
||||
listSplitPattern
|
||||
}
|
||||
|
|
@ -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 {}
|
||||
|
|
@ -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<Result<any>> = (
|
||||
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<Result<boolean>> = (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<Result<any>> = (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<Result<any>> = (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<Result<any>> = (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<Result<any>> = (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<Result<boolean>> = (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,
|
||||
}
|
||||
|
|
@ -19,17 +19,15 @@
|
|||
<el-text type="info">{{ data?.prologue }}</el-text>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="always" class="dialog-card mt-12">
|
||||
<el-card shadow="always" class="dialog-card mt-12" v-if="data?.example?.length > 0">
|
||||
<h4 class="mb-8">您可以尝试输入以下问题:</h4>
|
||||
<el-space wrap>
|
||||
<div class="problem-button cursor ellipsis-2">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
DataEase支持哪些类型的数据源?
|
||||
</div>
|
||||
<div class="problem-button cursor ellipsis-2">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
DataEase支持哪些类型的数据源?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
</div>
|
||||
<template v-for="(item, index) in data?.example" :key="index">
|
||||
<div class="problem-button cursor ellipsis-2" v-if="item">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
{{ item }}
|
||||
</div>
|
||||
</template>
|
||||
</el-space>
|
||||
</el-card>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<LayoutContainer header="创建应用" back-to="-1" class="create-application">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<div class="p-24 mb-16" style="padding-bottom: 0;">
|
||||
<div class="p-24 mb-16" style="padding-bottom: 0">
|
||||
<h4 class="title-decoration-1">应用信息</h4>
|
||||
</div>
|
||||
<div class="scrollbar-height-left">
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
label-position="top"
|
||||
require-asterisk-position="right"
|
||||
class="p-24"
|
||||
style="padding-top: 0;"
|
||||
style="padding-top: 0"
|
||||
>
|
||||
<el-form-item label="应用名称" prop="name">
|
||||
<el-input
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择模型" prop="model_id">
|
||||
<el-select v-model="applicationForm.model_id" placeholder="请选择模型">
|
||||
<el-select v-model="applicationForm.model_id" placeholder="请选择模型" style="width: 100%;">
|
||||
<el-option label="Zone one" value="shanghai" />
|
||||
<el-option label="Zone two" value="beijing" />
|
||||
</el-select>
|
||||
|
|
@ -59,28 +59,13 @@
|
|||
<div class="w-full">
|
||||
<el-row :gutter="12">
|
||||
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mb-8">
|
||||
<el-card shadow="never">
|
||||
<el-card class="relate-dataset-card" shadow="never">
|
||||
<div class="flex-between">
|
||||
<div class="flex align-center">
|
||||
<AppAvatar class="mr-12" shape="square" :size="32">
|
||||
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
|
||||
</AppAvatar>
|
||||
<h4 class="ellipsis-1">DataEase 数据集</h4>
|
||||
</div>
|
||||
<el-button text>
|
||||
<el-icon><Close /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mb-8">
|
||||
<el-card shadow="never">
|
||||
<div class="flex-between">
|
||||
<div class="flex align-center">
|
||||
<AppAvatar class="mr-12" shape="square" :size="32">
|
||||
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
|
||||
</AppAvatar>
|
||||
<h4 class="ellipsis-1">DataEase 数据集</h4>
|
||||
<div class="ellipsis-1">DataEase 数据集</div>
|
||||
</div>
|
||||
<el-button text>
|
||||
<el-icon><Close /></el-icon>
|
||||
|
|
@ -129,7 +114,7 @@
|
|||
</LayoutContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import AiDialog from '@/components/ai-dialog/index.vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type { ApplicationFormType } from '@/api/application'
|
||||
|
|
@ -158,9 +143,17 @@ const rules = reactive<FormRules<ApplicationFormType>>({
|
|||
}
|
||||
]
|
||||
})
|
||||
|
||||
watch(exampleList.value, () => {
|
||||
applicationForm.example = exampleList.value.filter((v) => v)
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.create-application {
|
||||
.relate-dataset-card {
|
||||
color: var(--app-text-color);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.dialog-bg {
|
||||
border-radius: 8px;
|
||||
background: var(--dialog-bg-gradient-color);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ import StepFirst from './step/StepFirst.vue'
|
|||
import StepSecond from './step/StepSecond.vue'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import type { datasetData } from '@/api/type/dataset'
|
||||
import documentApi from '@/api/document'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { toThousands } from '@/utils/utils'
|
||||
import useStore from '@/stores'
|
||||
|
|
@ -123,7 +124,7 @@ function submit() {
|
|||
})
|
||||
const obj = { ...baseInfo.value, documents } as datasetData
|
||||
if (id) {
|
||||
datasetApi
|
||||
documentApi
|
||||
.postDocument(id, documents)
|
||||
.then((res) => {
|
||||
MsgSuccess('提交成功')
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, reactive, watch } from 'vue'
|
||||
import ParagraphPreview from '@/views/dataset/component/ParagraphPreview.vue'
|
||||
import DatasetApi from '@/api/dataset'
|
||||
import documentApi from '@/api/document'
|
||||
import useStore from '@/stores'
|
||||
import type { KeyValue } from '@/api/type/common'
|
||||
const { dataset } = useStore()
|
||||
|
|
@ -129,7 +129,7 @@ function splitDocument() {
|
|||
}
|
||||
})
|
||||
}
|
||||
DatasetApi.postSplitDocument(fd)
|
||||
documentApi.postSplitDocument(fd)
|
||||
.then((res: any) => {
|
||||
paragraphList.value = res.data
|
||||
loading.value = false
|
||||
|
|
@ -140,7 +140,7 @@ function splitDocument() {
|
|||
}
|
||||
|
||||
const initSplitPatternList = () => {
|
||||
DatasetApi.listSplitPattern(patternLoading).then((ok) => {
|
||||
documentApi.listSplitPattern(patternLoading).then((ok) => {
|
||||
splitPatternList.value = ok.data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import documentApi from '@/api/document'
|
||||
import { toThousands } from '@/utils/utils'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
|
|
@ -133,7 +133,7 @@ function rowClickHandle(row: any) {
|
|||
function creatQuickHandle(val: string) {
|
||||
loading.value = true
|
||||
const obj = { name: val }
|
||||
datasetApi
|
||||
documentApi
|
||||
.postDocument(datasetId, obj)
|
||||
.then((res) => {
|
||||
getList()
|
||||
|
|
@ -155,7 +155,7 @@ function deleteDocument(row: any) {
|
|||
)
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
documentApi
|
||||
.delDocument(datasetId, row.id)
|
||||
.then(() => {
|
||||
MsgSuccess('删除成功')
|
||||
|
|
@ -173,7 +173,7 @@ function deleteDocument(row: any) {
|
|||
*/
|
||||
function updateData(documentId: string, data: any) {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
documentApi
|
||||
.putDocument(datasetId, documentId, data)
|
||||
.then((res) => {
|
||||
const index = documentData.value.findIndex((v) => v.id === documentId)
|
||||
|
|
@ -216,7 +216,7 @@ function handleCurrentChange(val: number) {
|
|||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
documentApi
|
||||
.getDocument(datasetId as string, filterText.value)
|
||||
.then((res) => {
|
||||
documentData.value = res.data
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import { ref, watch, nextTick } from 'vue'
|
|||
import { useRoute } from 'vue-router'
|
||||
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
||||
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import paragraphApi from '@/api/paragraph'
|
||||
import useStore from '@/stores'
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -110,7 +110,7 @@ const submitHandle = async () => {
|
|||
...paragraphFormRef.value?.form
|
||||
}
|
||||
: paragraphFormRef.value?.form
|
||||
datasetApi
|
||||
paragraphApi
|
||||
.postParagraph(datasetId, documentId, obj)
|
||||
.then((res) => {
|
||||
emit('refresh')
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, nextTick, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import paragraphApi from '@/api/paragraph'
|
||||
|
||||
const props = defineProps({
|
||||
problemId: String
|
||||
|
|
@ -67,7 +67,7 @@ watch(
|
|||
function delProblemHandle(item: any, index: number) {
|
||||
loading.value = true
|
||||
if (item.id) {
|
||||
datasetApi
|
||||
paragraphApi
|
||||
.delProblem(datasetId, documentId, props.problemId || '', item.id)
|
||||
.then((res) => {
|
||||
getProblemList()
|
||||
|
|
@ -83,7 +83,7 @@ function delProblemHandle(item: any, index: number) {
|
|||
|
||||
function getProblemList() {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
paragraphApi
|
||||
.getProblem(datasetId, documentId, props.problemId || '')
|
||||
.then((res) => {
|
||||
problemList.value = res.data
|
||||
|
|
@ -107,7 +107,7 @@ function addProblemHandle(val: string) {
|
|||
}
|
||||
loading.value = true
|
||||
if (props.problemId) {
|
||||
datasetApi
|
||||
paragraphApi
|
||||
.postProblem(datasetId, documentId, props.problemId, obj)
|
||||
.then((res) => {
|
||||
getProblemList()
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import documentApi from '@/api/document'
|
||||
import paragraphApi from '@/api/paragraph'
|
||||
import ParagraphDialog from './component/ParagraphDialog.vue'
|
||||
import { numberFormat } from '@/utils/utils'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
|
|
@ -111,7 +112,7 @@ function deleteParagraph(row: any) {
|
|||
})
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
paragraphApi
|
||||
.delParagraph(datasetId, documentId, row.id)
|
||||
.then(() => {
|
||||
MsgSuccess('删除成功')
|
||||
|
|
@ -135,7 +136,7 @@ function editParagraph(row: any) {
|
|||
|
||||
function getDetail() {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
documentApi
|
||||
.getDocumentDetail(datasetId, documentId)
|
||||
.then((res) => {
|
||||
documentDetail.value = res.data
|
||||
|
|
@ -148,7 +149,7 @@ function getDetail() {
|
|||
|
||||
function getParagraphDetail() {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
paragraphApi
|
||||
.getParagraph(datasetId, documentId)
|
||||
.then((res) => {
|
||||
paragraphDetail.value = res.data
|
||||
|
|
|
|||
Loading…
Reference in New Issue