feat: 新建应用

This commit is contained in:
wangdan-fit2cloud 2023-11-22 18:37:08 +08:00
parent c97c97c6ab
commit 9cb0a4f27c
14 changed files with 301 additions and 283 deletions

View File

@ -0,0 +1,5 @@
import { Result } from '@/request/Result'
import { get, post, del, put } from '@/request/index'
const prefix = '/application'
export default {}

View File

@ -1,8 +1,6 @@
import { Result } from '@/request/Result' import { Result } from '@/request/Result'
import { get, post, del, put } from '@/request/index' import { get, post, del, put } from '@/request/index'
import type { datasetListRequest, datasetData } from '@/api/type/dataset' import type { datasetListRequest, datasetData } from '@/api/type/dataset'
import type { Ref } from 'vue'
import type { KeyValue } from '@/api/type/common'
const prefix = '/dataset' const prefix = '/dataset'
/** /**
@ -89,240 +87,11 @@ const putDateset: (dataset_id: string, data: any) => Promise<Result<any>> = (
return put(`${prefix}/${dataset_id}`, data) 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_iddocument_idparagraph_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 { export default {
getDateset, getDateset,
getAllDateset, getAllDateset,
delDateset, delDateset,
postDateset, postDateset,
getDatesetDetail, getDatesetDetail,
putDateset, putDateset
postSplitDocument,
getDocument,
postDocument,
putDocument,
delDocument,
getDocumentDetail,
getParagraph,
delParagraph,
putParagraph,
postParagraph,
getProblem,
postProblem,
delProblem,
listSplitPattern
} }

113
ui/src/api/document.ts Normal file
View File

@ -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
}

6
ui/src/api/model.ts Normal file
View File

@ -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 {}

132
ui/src/api/paragraph.ts Normal file
View File

@ -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_iddocument_idparagraph_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,
}

View File

@ -19,17 +19,15 @@
<el-text type="info">{{ data?.prologue }}</el-text> <el-text type="info">{{ data?.prologue }}</el-text>
</div> </div>
</el-card> </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> <h4 class="mb-8">您可以尝试输入以下问题</h4>
<el-space wrap> <el-space wrap>
<div class="problem-button cursor ellipsis-2"> <template v-for="(item, index) in data?.example" :key="index">
<el-icon><EditPen /></el-icon> <div class="problem-button cursor ellipsis-2" v-if="item">
DataEase支持哪些类型的数据源 <el-icon><EditPen /></el-icon>
</div> {{ item }}
<div class="problem-button cursor ellipsis-2"> </div>
<el-icon><EditPen /></el-icon> </template>
DataEase支持哪些类型的数据源XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
</div>
</el-space> </el-space>
</el-card> </el-card>
</div> </div>

View File

@ -1,5 +1,5 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import datasetApi from '@/api/dataset' import paragraphApi from '@/api/paragraph'
const useParagraphStore = defineStore({ const useParagraphStore = defineStore({
id: 'paragraph', id: 'paragraph',
@ -7,7 +7,7 @@ const useParagraphStore = defineStore({
actions: { actions: {
async asyncPutParagraph(datasetId: string, documentId: string, paragraphId: string, data: any) { async asyncPutParagraph(datasetId: string, documentId: string, paragraphId: string, data: any) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
datasetApi paragraphApi
.putParagraph(datasetId, documentId, paragraphId, data) .putParagraph(datasetId, documentId, paragraphId, data)
.then((data) => { .then((data) => {
resolve(data) resolve(data)

View File

@ -2,7 +2,7 @@
<LayoutContainer header="创建应用" back-to="-1" class="create-application"> <LayoutContainer header="创建应用" back-to="-1" class="create-application">
<el-row> <el-row>
<el-col :span="10"> <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> <h4 class="title-decoration-1">应用信息</h4>
</div> </div>
<div class="scrollbar-height-left"> <div class="scrollbar-height-left">
@ -14,7 +14,7 @@
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
class="p-24" class="p-24"
style="padding-top: 0;" style="padding-top: 0"
> >
<el-form-item label="应用名称" prop="name"> <el-form-item label="应用名称" prop="name">
<el-input <el-input
@ -35,7 +35,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="选择模型" prop="model_id"> <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 one" value="shanghai" />
<el-option label="Zone two" value="beijing" /> <el-option label="Zone two" value="beijing" />
</el-select> </el-select>
@ -59,28 +59,13 @@
<div class="w-full"> <div class="w-full">
<el-row :gutter="12"> <el-row :gutter="12">
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mb-8"> <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-between">
<div class="flex align-center"> <div class="flex align-center">
<AppAvatar class="mr-12" shape="square" :size="32"> <AppAvatar class="mr-12" shape="square" :size="32">
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" /> <img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
</AppAvatar> </AppAvatar>
<h4 class="ellipsis-1">DataEase 数据集</h4> <div class="ellipsis-1">DataEase 数据集</div>
</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> </div>
<el-button text> <el-button text>
<el-icon><Close /></el-icon> <el-icon><Close /></el-icon>
@ -129,7 +114,7 @@
</LayoutContainer> </LayoutContainer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref } from 'vue' import { reactive, ref, watch } from 'vue'
import AiDialog from '@/components/ai-dialog/index.vue' import AiDialog from '@/components/ai-dialog/index.vue'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import type { ApplicationFormType } from '@/api/application' 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.create-application { .create-application {
.relate-dataset-card {
color: var(--app-text-color);
border-radius: 4px;
}
.dialog-bg { .dialog-bg {
border-radius: 8px; border-radius: 8px;
background: var(--dialog-bg-gradient-color); background: var(--dialog-bg-gradient-color);

View File

@ -67,6 +67,7 @@ import StepFirst from './step/StepFirst.vue'
import StepSecond from './step/StepSecond.vue' import StepSecond from './step/StepSecond.vue'
import datasetApi from '@/api/dataset' import datasetApi from '@/api/dataset'
import type { datasetData } from '@/api/type/dataset' import type { datasetData } from '@/api/type/dataset'
import documentApi from '@/api/document'
import { MsgSuccess } from '@/utils/message' import { MsgSuccess } from '@/utils/message'
import { toThousands } from '@/utils/utils' import { toThousands } from '@/utils/utils'
import useStore from '@/stores' import useStore from '@/stores'
@ -123,7 +124,7 @@ function submit() {
}) })
const obj = { ...baseInfo.value, documents } as datasetData const obj = { ...baseInfo.value, documents } as datasetData
if (id) { if (id) {
datasetApi documentApi
.postDocument(id, documents) .postDocument(id, documents)
.then((res) => { .then((res) => {
MsgSuccess('提交成功') MsgSuccess('提交成功')

View File

@ -89,7 +89,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted, reactive, watch } from 'vue' import { ref, computed, onMounted, reactive, watch } from 'vue'
import ParagraphPreview from '@/views/dataset/component/ParagraphPreview.vue' import ParagraphPreview from '@/views/dataset/component/ParagraphPreview.vue'
import DatasetApi from '@/api/dataset' import documentApi from '@/api/document'
import useStore from '@/stores' import useStore from '@/stores'
import type { KeyValue } from '@/api/type/common' import type { KeyValue } from '@/api/type/common'
const { dataset } = useStore() const { dataset } = useStore()
@ -129,7 +129,7 @@ function splitDocument() {
} }
}) })
} }
DatasetApi.postSplitDocument(fd) documentApi.postSplitDocument(fd)
.then((res: any) => { .then((res: any) => {
paragraphList.value = res.data paragraphList.value = res.data
loading.value = false loading.value = false
@ -140,7 +140,7 @@ function splitDocument() {
} }
const initSplitPatternList = () => { const initSplitPatternList = () => {
DatasetApi.listSplitPattern(patternLoading).then((ok) => { documentApi.listSplitPattern(patternLoading).then((ok) => {
splitPatternList.value = ok.data splitPatternList.value = ok.data
}) })
} }

View File

@ -101,7 +101,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive } from 'vue' import { ref, onMounted, reactive } from 'vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import datasetApi from '@/api/dataset' import documentApi from '@/api/document'
import { toThousands } from '@/utils/utils' import { toThousands } from '@/utils/utils'
import { datetimeFormat } from '@/utils/time' import { datetimeFormat } from '@/utils/time'
import { MsgSuccess, MsgConfirm } from '@/utils/message' import { MsgSuccess, MsgConfirm } from '@/utils/message'
@ -133,7 +133,7 @@ function rowClickHandle(row: any) {
function creatQuickHandle(val: string) { function creatQuickHandle(val: string) {
loading.value = true loading.value = true
const obj = { name: val } const obj = { name: val }
datasetApi documentApi
.postDocument(datasetId, obj) .postDocument(datasetId, obj)
.then((res) => { .then((res) => {
getList() getList()
@ -155,7 +155,7 @@ function deleteDocument(row: any) {
) )
.then(() => { .then(() => {
loading.value = true loading.value = true
datasetApi documentApi
.delDocument(datasetId, row.id) .delDocument(datasetId, row.id)
.then(() => { .then(() => {
MsgSuccess('删除成功') MsgSuccess('删除成功')
@ -173,7 +173,7 @@ function deleteDocument(row: any) {
*/ */
function updateData(documentId: string, data: any) { function updateData(documentId: string, data: any) {
loading.value = true loading.value = true
datasetApi documentApi
.putDocument(datasetId, documentId, data) .putDocument(datasetId, documentId, data)
.then((res) => { .then((res) => {
const index = documentData.value.findIndex((v) => v.id === documentId) const index = documentData.value.findIndex((v) => v.id === documentId)
@ -216,7 +216,7 @@ function handleCurrentChange(val: number) {
function getList() { function getList() {
loading.value = true loading.value = true
datasetApi documentApi
.getDocument(datasetId as string, filterText.value) .getDocument(datasetId as string, filterText.value)
.then((res) => { .then((res) => {
documentData.value = res.data documentData.value = res.data

View File

@ -44,7 +44,7 @@ import { ref, watch, nextTick } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue' import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue' import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
import datasetApi from '@/api/dataset' import paragraphApi from '@/api/paragraph'
import useStore from '@/stores' import useStore from '@/stores'
const props = defineProps({ const props = defineProps({
@ -110,7 +110,7 @@ const submitHandle = async () => {
...paragraphFormRef.value?.form ...paragraphFormRef.value?.form
} }
: paragraphFormRef.value?.form : paragraphFormRef.value?.form
datasetApi paragraphApi
.postParagraph(datasetId, documentId, obj) .postParagraph(datasetId, documentId, obj)
.then((res) => { .then((res) => {
emit('refresh') emit('refresh')

View File

@ -34,7 +34,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, nextTick, onMounted, onUnmounted, watch } from 'vue' import { ref, nextTick, onMounted, onUnmounted, watch } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import datasetApi from '@/api/dataset' import paragraphApi from '@/api/paragraph'
const props = defineProps({ const props = defineProps({
problemId: String problemId: String
@ -67,7 +67,7 @@ watch(
function delProblemHandle(item: any, index: number) { function delProblemHandle(item: any, index: number) {
loading.value = true loading.value = true
if (item.id) { if (item.id) {
datasetApi paragraphApi
.delProblem(datasetId, documentId, props.problemId || '', item.id) .delProblem(datasetId, documentId, props.problemId || '', item.id)
.then((res) => { .then((res) => {
getProblemList() getProblemList()
@ -83,7 +83,7 @@ function delProblemHandle(item: any, index: number) {
function getProblemList() { function getProblemList() {
loading.value = true loading.value = true
datasetApi paragraphApi
.getProblem(datasetId, documentId, props.problemId || '') .getProblem(datasetId, documentId, props.problemId || '')
.then((res) => { .then((res) => {
problemList.value = res.data problemList.value = res.data
@ -107,7 +107,7 @@ function addProblemHandle(val: string) {
} }
loading.value = true loading.value = true
if (props.problemId) { if (props.problemId) {
datasetApi paragraphApi
.postProblem(datasetId, documentId, props.problemId, obj) .postProblem(datasetId, documentId, props.problemId, obj)
.then((res) => { .then((res) => {
getProblemList() getProblemList()

View File

@ -70,7 +70,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router' 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 ParagraphDialog from './component/ParagraphDialog.vue'
import { numberFormat } from '@/utils/utils' import { numberFormat } from '@/utils/utils'
import { MsgSuccess, MsgConfirm } from '@/utils/message' import { MsgSuccess, MsgConfirm } from '@/utils/message'
@ -111,7 +112,7 @@ function deleteParagraph(row: any) {
}) })
.then(() => { .then(() => {
loading.value = true loading.value = true
datasetApi paragraphApi
.delParagraph(datasetId, documentId, row.id) .delParagraph(datasetId, documentId, row.id)
.then(() => { .then(() => {
MsgSuccess('删除成功') MsgSuccess('删除成功')
@ -135,7 +136,7 @@ function editParagraph(row: any) {
function getDetail() { function getDetail() {
loading.value = true loading.value = true
datasetApi documentApi
.getDocumentDetail(datasetId, documentId) .getDocumentDetail(datasetId, documentId)
.then((res) => { .then((res) => {
documentDetail.value = res.data documentDetail.value = res.data
@ -148,7 +149,7 @@ function getDetail() {
function getParagraphDetail() { function getParagraphDetail() {
loading.value = true loading.value = true
datasetApi paragraphApi
.getParagraph(datasetId, documentId) .getParagraph(datasetId, documentId)
.then((res) => { .then((res) => {
paragraphDetail.value = res.data paragraphDetail.value = res.data