feat: paragraph
This commit is contained in:
parent
9ccb501a90
commit
c68e35e9da
@ -43,9 +43,9 @@ const getKnowledgeList: (
|
|||||||
* 获取全部知识库
|
* 获取全部知识库
|
||||||
* @param 参数
|
* @param 参数
|
||||||
*/
|
*/
|
||||||
// const getAllDataset: (loading?: Ref<boolean>) => Promise<Result<any[]>> = (loading) => {
|
const getAllKnowledge: (loading?: Ref<boolean>) => Promise<Result<any[]>> = (loading) => {
|
||||||
// return get(`${prefix}`, undefined, loading)
|
return get(`${prefix}`, undefined, loading)
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步知识库
|
* 同步知识库
|
||||||
@ -260,5 +260,6 @@ export default {
|
|||||||
getLarkDocumentList,
|
getLarkDocumentList,
|
||||||
importLarkDocument,
|
importLarkDocument,
|
||||||
generateRelated,
|
generateRelated,
|
||||||
delKnowledge
|
delKnowledge,
|
||||||
|
getAllKnowledge
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledg
|
|||||||
/**
|
/**
|
||||||
* 创建段落
|
* 创建段落
|
||||||
* @param 参数
|
* @param 参数
|
||||||
* dataset_id, document_id
|
* knowledge_id, document_id
|
||||||
* {
|
* {
|
||||||
"content": "string",
|
"content": "string",
|
||||||
"title": "string",
|
"title": "string",
|
||||||
@ -20,52 +20,83 @@ const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledg
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
const postParagraph: (
|
const postParagraph: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (dataset_id, document_id, data, loading) => {
|
) => Promise<Result<any>> = (knowledge_id, document_id, data, loading) => {
|
||||||
return post(`${prefix}/${dataset_id}/document/${document_id}/paragraph`, data, undefined, loading)
|
return post(
|
||||||
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph`,
|
||||||
|
data,
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 段落列表
|
* 段落列表
|
||||||
* @param 参数 dataset_id document_id
|
* @param 参数 knowledge_id document_id
|
||||||
* page {
|
|
||||||
"current_page": "string",
|
|
||||||
"page_size": "string",
|
|
||||||
}
|
|
||||||
* param {
|
* param {
|
||||||
"title": "string",
|
"title": "string",
|
||||||
"content": "string",
|
"content": "string",
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
const getParagraph: (
|
const getParagraph: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
page: pageRequest,
|
page: pageRequest,
|
||||||
param: any,
|
param: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (dataset_id, document_id, page, param, loading) => {
|
) => Promise<Result<any>> = (knowledge_id, document_id, page, param, loading) => {
|
||||||
return get(
|
return get(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${page.current_page}/${page.page_size}`,
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/${page.current_page}/${page.page_size}`,
|
||||||
param,
|
param,
|
||||||
loading,
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改段落
|
||||||
|
* @param 参数
|
||||||
|
* knowledge_id, document_id, paragraph_id
|
||||||
|
* {
|
||||||
|
"content": "string",
|
||||||
|
"title": "string",
|
||||||
|
"is_active": true,
|
||||||
|
"problem_list": [
|
||||||
|
{
|
||||||
|
"content": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const putParagraph: (
|
||||||
|
knowledge_id: string,
|
||||||
|
document_id: string,
|
||||||
|
paragraph_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (knowledge_id, document_id, paragraph_id, data, loading) => {
|
||||||
|
return put(
|
||||||
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
||||||
|
data,
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除段落
|
* 删除段落
|
||||||
* @param 参数 dataset_id, document_id, paragraph_id
|
* @param 参数 knowledge_id, document_id, paragraph_id
|
||||||
*/
|
*/
|
||||||
const delParagraph: (
|
const delParagraph: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
paragraph_id: string,
|
paragraph_id: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<boolean>> = (dataset_id, document_id, paragraph_id, loading) => {
|
) => Promise<Result<boolean>> = (knowledge_id, document_id, paragraph_id, loading) => {
|
||||||
return del(
|
return del(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
loading,
|
loading,
|
||||||
@ -73,50 +104,101 @@ const delParagraph: (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除段落
|
* 某段落问题列表
|
||||||
* @param 参数 dataset_id, document_id
|
* @param 参数 knowledge_id,document_id,paragraph_id
|
||||||
*/
|
*/
|
||||||
const delMulParagraph: (
|
const getParagraphProblem: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
data: any,
|
paragraph_id: string,
|
||||||
loading?: Ref<boolean>,
|
) => Promise<Result<any>> = (knowledge_id, document_id, paragraph_id: string) => {
|
||||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
return get(`${prefix}/${knowledge_id}/document/${document_id}/paragraph/${paragraph_id}/problem`)
|
||||||
return del(
|
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/_batch`,
|
|
||||||
undefined,
|
|
||||||
{ id_list: data },
|
|
||||||
loading,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改段落
|
* 给某段落创建问题
|
||||||
* @param 参数
|
* @param 参数
|
||||||
* dataset_id, document_id, paragraph_id
|
* knowledge_id, document_id, paragraph_id
|
||||||
* {
|
* {
|
||||||
"content": "string",
|
content": "string"
|
||||||
"title": "string",
|
|
||||||
"is_active": true,
|
|
||||||
"problem_list": [
|
|
||||||
{
|
|
||||||
"id": "string",
|
|
||||||
"content": "string"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
const putParagraph: (
|
const postParagraphProblem: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
paragraph_id: string,
|
paragraph_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, data, loading) => {
|
) => Promise<Result<any>> = (knowledge_id, document_id, paragraph_id, data: any, loading) => {
|
||||||
|
return post(
|
||||||
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/${paragraph_id}/problem`,
|
||||||
|
data,
|
||||||
|
{},
|
||||||
|
loading,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加某段落关联问题
|
||||||
|
* @param knowledge_id 数据集id
|
||||||
|
* @param document_id 文档id
|
||||||
|
* @param loading 加载器
|
||||||
|
* @query data {
|
||||||
|
* paragraph_id 段落id problem_id 问题id
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
const putAssociationProblem: (
|
||||||
|
knowledge_id: string,
|
||||||
|
document_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (knowledge_id, document_id, data, loading) => {
|
||||||
return put(
|
return put(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/association`,
|
||||||
|
{},
|
||||||
|
data,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除段落
|
||||||
|
* @param 参数 knowledge_id, document_id
|
||||||
|
*/
|
||||||
|
const putMulParagraph: (
|
||||||
|
knowledge_id: string,
|
||||||
|
document_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<boolean>> = (knowledge_id, document_id, data, loading) => {
|
||||||
|
return put(
|
||||||
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/batch_delete`,
|
||||||
|
{ id_list: data },
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量关联问题
|
||||||
|
* @param 参数 knowledge_id, document_id
|
||||||
|
* {
|
||||||
|
"paragraph_id_list": [
|
||||||
|
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
||||||
|
],
|
||||||
|
"model_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||||
|
"prompt": "string",
|
||||||
|
"document_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const putBatchGenerateRelated: (
|
||||||
|
knowledge_id: string,
|
||||||
|
document_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<boolean>> = (knowledge_id, document_id, data, loading) => {
|
||||||
|
return put(
|
||||||
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/batch_generate_related`,
|
||||||
data,
|
data,
|
||||||
undefined,
|
undefined,
|
||||||
loading,
|
loading,
|
||||||
@ -125,39 +207,25 @@ const putParagraph: (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量迁移段落
|
* 批量迁移段落
|
||||||
* @param 参数 dataset_id,target_dataset_id,
|
* @param 参数 knowledge_id,target_knowledge_id,
|
||||||
*/
|
*/
|
||||||
const putMigrateMulParagraph: (
|
const putMigrateMulParagraph: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
target_dataset_id: string,
|
target_knowledge_id: string,
|
||||||
target_document_id: string,
|
target_document_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<boolean>> = (
|
) => Promise<Result<boolean>> = (
|
||||||
dataset_id,
|
knowledge_id,
|
||||||
document_id,
|
document_id,
|
||||||
target_dataset_id,
|
target_knowledge_id,
|
||||||
target_document_id,
|
target_document_id,
|
||||||
data,
|
data,
|
||||||
loading,
|
loading,
|
||||||
) => {
|
) => {
|
||||||
return put(
|
return put(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/migrate/dataset/${target_dataset_id}/document/${target_document_id}`,
|
`${prefix}/${knowledge_id}/document/${document_id}/paragraph/migrate/dataset/${target_knowledge_id}/document/${target_document_id}`,
|
||||||
data,
|
|
||||||
undefined,
|
|
||||||
loading,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const batchGenerateRelated: (
|
|
||||||
dataset_id: string,
|
|
||||||
document_id: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
|
||||||
return put(
|
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/batch_generate_related`,
|
|
||||||
data,
|
data,
|
||||||
undefined,
|
undefined,
|
||||||
loading,
|
loading,
|
||||||
@ -165,36 +233,36 @@ const batchGenerateRelated: (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建问题
|
* 解除某段落关联问题
|
||||||
* @param 参数
|
* @param 参数 dataset_id, document_id,
|
||||||
* dataset_id, document_id, paragraph_id
|
* @query data {
|
||||||
* {
|
* paragraph_id 段落id problem_id 问题id
|
||||||
"id": "string",
|
* }
|
||||||
content": "string"
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
const postProblem: (
|
const putDisassociationProblem: (
|
||||||
dataset_id: string,
|
dataset_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
paragraph_id: string,
|
|
||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, data: any, loading) => {
|
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
||||||
return post(
|
return put(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`,
|
`${prefix}/${dataset_id}/document/${document_id}/paragraph/unassociation`,
|
||||||
data,
|
|
||||||
{},
|
{},
|
||||||
|
data,
|
||||||
loading,
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getParagraph,
|
|
||||||
delParagraph,
|
|
||||||
putParagraph,
|
|
||||||
postParagraph,
|
postParagraph,
|
||||||
delMulParagraph,
|
getParagraph,
|
||||||
|
putParagraph,
|
||||||
|
delParagraph,
|
||||||
|
getParagraphProblem,
|
||||||
|
postParagraphProblem,
|
||||||
|
putAssociationProblem,
|
||||||
|
putMulParagraph,
|
||||||
|
putBatchGenerateRelated,
|
||||||
putMigrateMulParagraph,
|
putMigrateMulParagraph,
|
||||||
batchGenerateRelated,
|
putDisassociationProblem
|
||||||
postProblem,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +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 { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import type { KeyValue } from '@/api/type/common'
|
|
||||||
import type { pageRequest } from '@/api/type/common'
|
import type { pageRequest } from '@/api/type/common'
|
||||||
|
|
||||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledge'
|
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledge'
|
||||||
@ -22,10 +21,6 @@ const postProblems: (
|
|||||||
/**
|
/**
|
||||||
* 问题分页列表
|
* 问题分页列表
|
||||||
* @param 参数 knowledge_id,
|
* @param 参数 knowledge_id,
|
||||||
* page {
|
|
||||||
"current_page": "string",
|
|
||||||
"page_size": "string",
|
|
||||||
}
|
|
||||||
* query {
|
* query {
|
||||||
"content": "string",
|
"content": "string",
|
||||||
}
|
}
|
||||||
@ -106,7 +101,7 @@ const putMulAssociationProblem: (
|
|||||||
* 批量删除问题
|
* 批量删除问题
|
||||||
* @param 参数 knowledge_id,
|
* @param 参数 knowledge_id,
|
||||||
* data: array[string]
|
* data: array[string]
|
||||||
*/
|
*/
|
||||||
const putMulProblem: (
|
const putMulProblem: (
|
||||||
knowledge_id: string,
|
knowledge_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
@ -116,11 +111,11 @@ const putMulProblem: (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getProblems,
|
|
||||||
postProblems,
|
postProblems,
|
||||||
delProblems,
|
getProblems,
|
||||||
putProblems,
|
putProblems,
|
||||||
|
delProblems,
|
||||||
getDetailProblems,
|
getDetailProblems,
|
||||||
putMulProblem,
|
|
||||||
putMulAssociationProblem,
|
putMulAssociationProblem,
|
||||||
|
putMulProblem,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="['document', 'dataset'].includes(apiType)"
|
v-if="['document', 'knowledge'].includes(apiType)"
|
||||||
:label="$t('components.selectParagraph.title')"
|
:label="$t('components.selectParagraph.title')"
|
||||||
prop="state"
|
prop="state"
|
||||||
>
|
>
|
||||||
@ -107,7 +107,7 @@ const stateMap = {
|
|||||||
error: ['0', '1', '3', '4', '5', 'n']
|
error: ['0', '1', '3', '4', '5', 'n']
|
||||||
}
|
}
|
||||||
const FormRef = ref()
|
const FormRef = ref()
|
||||||
const datasetId = ref<string>()
|
const knowledgeId = ref<string>()
|
||||||
const userId = user.userInfo?.id as string
|
const userId = user.userInfo?.id as string
|
||||||
const form = ref(prompt.get(userId))
|
const form = ref(prompt.get(userId))
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
@ -135,7 +135,7 @@ watch(dialogVisible, (bool) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const open = (ids: string[], type: string, _datasetId?: string) => {
|
const open = (ids: string[], type: string, _datasetId?: string) => {
|
||||||
datasetId.value = _datasetId
|
knowledgeId.value = _datasetId
|
||||||
getModel()
|
getModel()
|
||||||
idList.value = ids
|
idList.value = ids
|
||||||
apiType.value = type
|
apiType.value = type
|
||||||
@ -155,7 +155,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||||||
...form.value,
|
...form.value,
|
||||||
paragraph_id_list: idList.value
|
paragraph_id_list: idList.value
|
||||||
}
|
}
|
||||||
paragraphApi.batchGenerateRelated(id, documentId, data, loading).then(() => {
|
paragraphApi.putBatchGenerateRelated(id, documentId, data, loading).then(() => {
|
||||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
@ -171,12 +171,12 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||||||
emit('refresh')
|
emit('refresh')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
})
|
})
|
||||||
} else if (apiType.value === 'dataset') {
|
} else if (apiType.value === 'knowledge') {
|
||||||
const data = {
|
const data = {
|
||||||
...form.value,
|
...form.value,
|
||||||
state_list: stateMap[state.value]
|
state_list: stateMap[state.value]
|
||||||
}
|
}
|
||||||
knowledgeApi.generateRelated(id ? id : datasetId.value, data, loading).then(() => {
|
knowledgeApi.generateRelated(id ? id : knowledgeId.value, data, loading).then(() => {
|
||||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
})
|
})
|
||||||
@ -188,7 +188,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||||||
function getModel() {
|
function getModel() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
knowledgeApi
|
knowledgeApi
|
||||||
.getKnowledgeModel(id ? id : datasetId.value)
|
.getKnowledgeModel(id ? id : knowledgeId.value)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
modelOptions.value = groupBy(res?.data, 'provider')
|
modelOptions.value = groupBy(res?.data, 'provider')
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
|||||||
@ -142,7 +142,7 @@ import { isWorkFlow } from '@/utils/application'
|
|||||||
import { isAppIcon } from '@/utils/common'
|
import { isAppIcon } from '@/utils/common'
|
||||||
|
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
const { common, dataset, application } = useStore()
|
const { common, knowledge, application } = useStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const {
|
const {
|
||||||
@ -169,7 +169,7 @@ const isApplication = computed(() => {
|
|||||||
return activeMenu.includes('application')
|
return activeMenu.includes('application')
|
||||||
})
|
})
|
||||||
const isDataset = computed(() => {
|
const isDataset = computed(() => {
|
||||||
return activeMenu.includes('dataset')
|
return activeMenu.includes('knowledge')
|
||||||
})
|
})
|
||||||
|
|
||||||
function openCreateDialog() {
|
function openCreateDialog() {
|
||||||
@ -204,8 +204,8 @@ function changeMenu(id: string) {
|
|||||||
|
|
||||||
function getDataset() {
|
function getDataset() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
dataset
|
knowledge
|
||||||
.asyncGetAllDataset()
|
.asyncGetAllKnowledge()
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
list.value = res.data
|
list.value = res.data
|
||||||
common.saveBreadcrumb(list.value)
|
common.saveBreadcrumb(list.value)
|
||||||
|
|||||||
@ -11,10 +11,9 @@ import problem from './problem'
|
|||||||
import applicationOverview from './application-overview'
|
import applicationOverview from './application-overview'
|
||||||
import applicationWorkflow from './application-workflow'
|
import applicationWorkflow from './application-workflow'
|
||||||
import paragraph from './paragraph'
|
import paragraph from './paragraph'
|
||||||
|
import log from './log'
|
||||||
// import notFound from './404'
|
// import notFound from './404'
|
||||||
|
|
||||||
// import log from './log'
|
|
||||||
|
|
||||||
// import operateLog from './operate-log'
|
// import operateLog from './operate-log'
|
||||||
export default {
|
export default {
|
||||||
login,
|
login,
|
||||||
@ -30,9 +29,8 @@ export default {
|
|||||||
applicationOverview,
|
applicationOverview,
|
||||||
applicationWorkflow,
|
applicationWorkflow,
|
||||||
paragraph,
|
paragraph,
|
||||||
|
log,
|
||||||
// notFound,
|
// notFound,
|
||||||
|
|
||||||
// log,
|
|
||||||
|
|
||||||
// operateLog
|
// operateLog
|
||||||
}
|
}
|
||||||
|
|||||||
41
ui/src/locales/lang/zh-CN/views/log.ts
Normal file
41
ui/src/locales/lang/zh-CN/views/log.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
export default {
|
||||||
|
title: '对话日志',
|
||||||
|
delete: {
|
||||||
|
confirmTitle: '是否删除问题:',
|
||||||
|
confirmMessage1: '删除问题关联的',
|
||||||
|
confirmMessage2: '个分段会被取消关联,请谨慎操作。'
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
clearStrategy: '清除策略',
|
||||||
|
prev: '上一条',
|
||||||
|
next: '下一条'
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
abstract: '摘要',
|
||||||
|
chat_record_count: '对话提问数',
|
||||||
|
user: '用户',
|
||||||
|
feedback: {
|
||||||
|
label: '用户反馈',
|
||||||
|
star: '赞同',
|
||||||
|
trample: '反对'
|
||||||
|
},
|
||||||
|
mark: '改进标注',
|
||||||
|
recenTimes: '最近对话时间'
|
||||||
|
},
|
||||||
|
addToDataset: '添加至知识库',
|
||||||
|
daysText: '天之前的对话记录',
|
||||||
|
selectDataset: '选择知识库',
|
||||||
|
selectDatasetPlaceholder: '请选择知识库',
|
||||||
|
saveToDocument: '保存至文档',
|
||||||
|
documentPlaceholder: '请选择文档',
|
||||||
|
editContent: '修改内容',
|
||||||
|
editMark: '修改标注',
|
||||||
|
form: {
|
||||||
|
content: {
|
||||||
|
placeholder: '请输入内容'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
placeholder: '请给当前内容设置一个标题,以便管理查看'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -17,10 +17,10 @@ const useDocumentStore = defineStore('document', {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async asyncPostDocument(datasetId: string, data: any, loading?: Ref<boolean>) {
|
async asyncPostDocument(knowledgeId: string, data: any, loading?: Ref<boolean>) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
documentApi
|
documentApi
|
||||||
.postDocument(datasetId, data, loading)
|
.postDocument(knowledgeId, data, loading)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
resolve(data)
|
resolve(data)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -31,18 +31,18 @@ const useKnowledgeStore = defineStore('knowledge', {
|
|||||||
saveDocumentsFile(file: UploadUserFile[]) {
|
saveDocumentsFile(file: UploadUserFile[]) {
|
||||||
this.documentsFiles = file
|
this.documentsFiles = file
|
||||||
},
|
},
|
||||||
// async asyncGetAllDataset(loading?: Ref<boolean>) {
|
async asyncGetAllKnowledge(loading?: Ref<boolean>) {
|
||||||
// return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// knowledgeApi
|
knowledgeApi
|
||||||
// .getAllDataset(loading)
|
.getAllKnowledge(loading)
|
||||||
// .then((data) => {
|
.then((data) => {
|
||||||
// resolve(data)
|
resolve(data)
|
||||||
// })
|
})
|
||||||
// .catch((error) => {
|
.catch((error) => {
|
||||||
// reject(error)
|
reject(error)
|
||||||
// })
|
})
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
async asyncGetKnowledgeDetail(
|
async asyncGetKnowledgeDetail(
|
||||||
knowledge_id: string,
|
knowledge_id: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const useParagraphStore = defineStore('paragraph', {
|
|||||||
state: () => ({}),
|
state: () => ({}),
|
||||||
actions: {
|
actions: {
|
||||||
async asyncPutParagraph(
|
async asyncPutParagraph(
|
||||||
datasetId: string,
|
knowledgeId: string,
|
||||||
documentId: string,
|
documentId: string,
|
||||||
paragraphId: string,
|
paragraphId: string,
|
||||||
data: any,
|
data: any,
|
||||||
@ -14,7 +14,7 @@ const useParagraphStore = defineStore('paragraph', {
|
|||||||
) {
|
) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
paragraphApi
|
paragraphApi
|
||||||
.putParagraph(datasetId, documentId, paragraphId, data, loading)
|
.putParagraph(knowledgeId, documentId, paragraphId, data, loading)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
resolve(data)
|
resolve(data)
|
||||||
})
|
})
|
||||||
@ -25,14 +25,58 @@ const useParagraphStore = defineStore('paragraph', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async asyncDelParagraph(
|
async asyncDelParagraph(
|
||||||
datasetId: string,
|
knowledgeId: string,
|
||||||
documentId: string,
|
documentId: string,
|
||||||
paragraphId: string,
|
paragraphId: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) {
|
) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
paragraphApi
|
paragraphApi
|
||||||
.delParagraph(datasetId, documentId, paragraphId, loading)
|
.delParagraph(knowledgeId, documentId, paragraphId, loading)
|
||||||
|
.then((data) => {
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async asyncDisassociationProblem(
|
||||||
|
knowledgeId: string,
|
||||||
|
documentId: string,
|
||||||
|
paragraphId: string,
|
||||||
|
problemId: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const obj = {
|
||||||
|
paragraphId,
|
||||||
|
problemId,
|
||||||
|
}
|
||||||
|
paragraphApi
|
||||||
|
.putDisassociationProblem(knowledgeId, documentId, obj, loading)
|
||||||
|
.then((data) => {
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async asyncAssociationProblem(
|
||||||
|
knowledgeId: string,
|
||||||
|
documentId: string,
|
||||||
|
paragraphId: string,
|
||||||
|
problemId: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const obj = {
|
||||||
|
paragraphId,
|
||||||
|
problemId,
|
||||||
|
}
|
||||||
|
paragraphApi
|
||||||
|
.putAssociationProblem(knowledgeId, documentId, obj, loading)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
resolve(data)
|
resolve(data)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { type Ref } from 'vue'
|
import { type Ref } from 'vue'
|
||||||
import problemApi from '@/api/knowledge/problem'
|
import problemApi from '@/api/knowledge/problem'
|
||||||
import paragraphApi from '@/api/knowledge/paragraph'
|
|
||||||
import type { pageRequest } from '@/api/type/common'
|
import type { pageRequest } from '@/api/type/common'
|
||||||
|
|
||||||
const useProblemStore = defineStore('problem', {
|
const useProblemStore = defineStore('problem', {
|
||||||
state: () => ({}),
|
state: () => ({}),
|
||||||
actions: {
|
actions: {
|
||||||
async asyncPostProblem(datasetId: string, data: any, loading?: Ref<boolean>) {
|
async asyncPostProblem(knowledgeId: string, data: any, loading?: Ref<boolean>) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
problemApi
|
problemApi
|
||||||
.postProblems(datasetId, data, loading)
|
.postProblems(knowledgeId, data, loading)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
resolve(data)
|
resolve(data)
|
||||||
})
|
})
|
||||||
@ -20,50 +19,14 @@ const useProblemStore = defineStore('problem', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async asyncGetProblem(
|
async asyncGetProblem(
|
||||||
datasetId: string,
|
knowledgeId: string,
|
||||||
page: pageRequest,
|
page: pageRequest,
|
||||||
param: any,
|
param: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) {
|
) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
problemApi
|
problemApi
|
||||||
.getProblems(datasetId, page, param, loading)
|
.getProblems(knowledgeId, page, param, loading)
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncDisassociationProblem(
|
|
||||||
datasetId: string,
|
|
||||||
documentId: string,
|
|
||||||
paragraphId: string,
|
|
||||||
problemId: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
paragraphApi
|
|
||||||
.disassociationProblem(datasetId, documentId, paragraphId, problemId, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncAssociationProblem(
|
|
||||||
datasetId: string,
|
|
||||||
documentId: string,
|
|
||||||
paragraphId: string,
|
|
||||||
problemId: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
paragraphApi
|
|
||||||
.associationProblem(datasetId, documentId, paragraphId, problemId, loading)
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
resolve(data)
|
resolve(data)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -216,7 +216,7 @@
|
|||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="Setting"
|
icon="Setting"
|
||||||
@click.stop="router.push({ path: `/dataset/${item.id}/setting` })"
|
@click.stop="router.push({ path: `/knowledge/${item.id}/setting` })"
|
||||||
>
|
>
|
||||||
{{ $t('common.setting') }}</el-dropdown-item
|
{{ $t('common.setting') }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
|
|||||||
@ -77,7 +77,7 @@ import { useRoute } from 'vue-router'
|
|||||||
import documentApi from '@/api/knowledge/document'
|
import documentApi from '@/api/knowledge/document'
|
||||||
|
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
const { dataset } = useStore()
|
const { knowledge } = useStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: { id } // id为datasetID
|
params: { id } // id为datasetID
|
||||||
@ -115,7 +115,7 @@ const submitHandle = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDataset() {
|
function getDataset() {
|
||||||
dataset.asyncGetAllDataset(loading).then((res: any) => {
|
knowledge.asyncGetAllKnowledge(loading).then((res: any) => {
|
||||||
datasetList.value = res.data?.filter((v: any) => v.id !== id)
|
datasetList.value = res.data?.filter((v: any) => v.id !== id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -253,7 +253,7 @@ const isApplication = computed(() => {
|
|||||||
return activeMenu.includes('application')
|
return activeMenu.includes('application')
|
||||||
})
|
})
|
||||||
const isDataset = computed(() => {
|
const isDataset = computed(() => {
|
||||||
return activeMenu.includes('dataset')
|
return activeMenu.includes('knowledge')
|
||||||
})
|
})
|
||||||
|
|
||||||
function changeHandle(val: string) {
|
function changeHandle(val: string) {
|
||||||
|
|||||||
@ -140,14 +140,14 @@ import { MsgConfirm, MsgSuccess, MsgWarning } from '@/utils/message'
|
|||||||
import { getImgUrl } from '@/utils/utils'
|
import { getImgUrl } from '@/utils/utils'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import type Node from 'element-plus/es/components/tree/src/model/node'
|
import type Node from 'element-plus/es/components/tree/src/model/node'
|
||||||
import dataset from '@/api/dataset'
|
import knowledgeApi from '@/api/knowledge/knowledge'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
query: { id, folder_token } // id为datasetID,有id的是上传文档 folder_token为飞书文件夹token
|
query: { id, folder_token } // id为knowledgeID,有id的是上传文档 folder_token为飞书文件夹token
|
||||||
} = route
|
} = route
|
||||||
const datasetId = id as string
|
const knowledgeId = id as string
|
||||||
const folderToken = folder_token as string
|
const folderToken = folder_token as string
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@ -183,8 +183,8 @@ const props = {
|
|||||||
|
|
||||||
const loadNode = (node: Node, resolve: (nodeData: Tree[]) => void) => {
|
const loadNode = (node: Node, resolve: (nodeData: Tree[]) => void) => {
|
||||||
const token = node.level === 0 ? folderToken : node.data.token // 根节点使用 folder_token,其他节点使用 node.data.token
|
const token = node.level === 0 ? folderToken : node.data.token // 根节点使用 folder_token,其他节点使用 node.data.token
|
||||||
dataset
|
knowledgeApi
|
||||||
.getLarkDocumentList(datasetId, token, {}, loading)
|
.getLarkDocumentList(knowledgeId, token, {}, loading)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
const nodes = res.data.files as Tree[]
|
const nodes = res.data.files as Tree[]
|
||||||
resolve(nodes)
|
resolve(nodes)
|
||||||
@ -234,8 +234,8 @@ function submit() {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dataset
|
knowledge
|
||||||
.importLarkDocument(datasetId, newList, loading)
|
.importLarkDocument(knowledgeId, newList, loading)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
MsgSuccess(t('views.document.tip.importMessage'))
|
MsgSuccess(t('views.document.tip.importMessage'))
|
||||||
disabled.value = false
|
disabled.value = false
|
||||||
|
|||||||
@ -61,14 +61,14 @@ import documentApi from '@/api/document'
|
|||||||
import { MsgConfirm, MsgSuccess } from '@/utils/message'
|
import { MsgConfirm, MsgSuccess } from '@/utils/message'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
const { dataset, document } = useStore()
|
const { knowledge, document } = useStore()
|
||||||
const documentsFiles = computed(() => dataset.documentsFiles)
|
const documentsFiles = computed(() => knowledge.documentsFiles)
|
||||||
const documentsType = computed(() => dataset.documentsType)
|
const documentsType = computed(() => knowledge.documentsType)
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
query: { id } // id为datasetID,有id的是上传文档
|
query: { id } // id为knowledgeID,有id的是上传文档
|
||||||
} = route
|
} = route
|
||||||
|
|
||||||
const SetRulesRef = ref()
|
const SetRulesRef = ref()
|
||||||
@ -93,7 +93,7 @@ async function next() {
|
|||||||
documentApi.postQADocument(id as string, fd, loading).then((res) => {
|
documentApi.postQADocument(id as string, fd, loading).then((res) => {
|
||||||
MsgSuccess(t('common.submitSuccess'))
|
MsgSuccess(t('common.submitSuccess'))
|
||||||
clearStore()
|
clearStore()
|
||||||
router.push({ path: `/dataset/${id}/document` })
|
router.push({ path: `/knowledge/${id}/document` })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (documentsType.value === 'table') {
|
} else if (documentsType.value === 'table') {
|
||||||
@ -108,7 +108,7 @@ async function next() {
|
|||||||
documentApi.postTableDocument(id as string, fd, loading).then((res) => {
|
documentApi.postTableDocument(id as string, fd, loading).then((res) => {
|
||||||
MsgSuccess(t('common.submitSuccess'))
|
MsgSuccess(t('common.submitSuccess'))
|
||||||
clearStore()
|
clearStore()
|
||||||
router.push({ path: `/dataset/${id}/document` })
|
router.push({ path: `/knowledge/${id}/document` })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -123,8 +123,8 @@ const prev = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearStore() {
|
function clearStore() {
|
||||||
dataset.saveDocumentsFile([])
|
knowledge.saveDocumentsFile([])
|
||||||
dataset.saveDocumentsType('')
|
knowledge.saveDocumentsType('')
|
||||||
}
|
}
|
||||||
function submit() {
|
function submit() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -148,7 +148,7 @@ function submit() {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
MsgSuccess(t('common.submitSuccess'))
|
MsgSuccess(t('common.submitSuccess'))
|
||||||
clearStore()
|
clearStore()
|
||||||
router.push({ path: `/dataset/${id}/document` })
|
router.push({ path: `/knowledge/${id}/document` })
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<el-result icon="success" :title="`🎉 ${$t('views.dataset.ResultSuccess.title')} 🎉`">
|
<el-result icon="success" :title="`🎉 ${$t('views.knowledge.ResultSuccess.title')} 🎉`">
|
||||||
<template #sub-title>
|
<template #sub-title>
|
||||||
<div class="mt-8">
|
<div class="mt-8">
|
||||||
<span class="bold">{{ data?.document_list.length || 0 }}</span>
|
<span class="bold">{{ data?.document_list.length || 0 }}</span>
|
||||||
@ -8,7 +8,7 @@
|
|||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
<span class="bold">{{ paragraph_count || 0 }}</span>
|
<span class="bold">{{ paragraph_count || 0 }}</span>
|
||||||
<el-text type="info" class="ml-4">{{
|
<el-text type="info" class="ml-4">{{
|
||||||
$t('views.dataset.ResultSuccess.paragraph')
|
$t('views.knowledge.ResultSuccess.paragraph')
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
<span class="bold">{{ numberFormat(char_length) || 0 }}</span>
|
<span class="bold">{{ numberFormat(char_length) || 0 }}</span>
|
||||||
@ -16,16 +16,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<el-button @click="router.push({ path: `/dataset` })">{{
|
<el-button @click="router.push({ path: `/knowledge` })">{{
|
||||||
$t('views.dataset.ResultSuccess.buttons.toDataset')
|
$t('views.knowledge.ResultSuccess.buttons.toDataset')
|
||||||
}}</el-button>
|
}}</el-button>
|
||||||
<el-button type="primary" @click="router.push({ path: `/dataset/${data?.id}/${currentFolder.id}/document` })">{{
|
<el-button type="primary" @click="router.push({ path: `/knowledge/${data?.id}/${currentFolder.id}/document` })">{{
|
||||||
$t('views.dataset.ResultSuccess.buttons.toDocument')
|
$t('views.knowledge.ResultSuccess.buttons.toDocument')
|
||||||
}}</el-button>
|
}}</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-result>
|
</el-result>
|
||||||
<div class="result-success">
|
<div class="result-success">
|
||||||
<p class="bolder">{{ $t('views.dataset.ResultSuccess.documentList') }}</p>
|
<p class="bolder">{{ $t('views.knowledge.ResultSuccess.documentList') }}</p>
|
||||||
<el-card
|
<el-card
|
||||||
shadow="never"
|
shadow="never"
|
||||||
class="file-List-card mt-8"
|
class="file-List-card mt-8"
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-text type="info" class="mr-16"
|
<el-text type="info" class="mr-16"
|
||||||
>{{ item && item?.paragraph_count }}
|
>{{ item && item?.paragraph_count }}
|
||||||
{{ $t('views.dataset.ResultSuccess.paragraph_count') }}</el-text
|
{{ $t('views.knowledge.ResultSuccess.paragraph_count') }}</el-text
|
||||||
>
|
>
|
||||||
<el-text v-if="item.status === '1'">
|
<el-text v-if="item.status === '1'">
|
||||||
<el-icon class="success"><SuccessFilled /></el-icon>
|
<el-icon class="success"><SuccessFilled /></el-icon>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<el-icon class="danger"><CircleCloseFilled /></el-icon>
|
<el-icon class="danger"><CircleCloseFilled /></el-icon>
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-text v-else-if="item.status === '0'">
|
<el-text v-else-if="item.status === '0'">
|
||||||
<el-icon class="is-loading primary"><Loading /></el-icon> {{ $t('views.dataset.ResultSuccess.loading') }}...
|
<el-icon class="is-loading primary"><Loading /></el-icon> {{ $t('views.knowledge.ResultSuccess.loading') }}...
|
||||||
</el-text>
|
</el-text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -120,13 +120,13 @@
|
|||||||
</template>
|
</template>
|
||||||
<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/knowledge/component/ParagraphPreview.vue'
|
||||||
import { cutFilename } from '@/utils/utils'
|
import { cutFilename } from '@/utils/utils'
|
||||||
import documentApi from '@/api/document'
|
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 { knowledge } = useStore()
|
||||||
const documentsFiles = computed(() => dataset.documentsFiles)
|
const documentsFiles = computed(() => knowledge.documentsFiles)
|
||||||
const splitPatternList = ref<Array<KeyValue<string, string>>>([])
|
const splitPatternList = ref<Array<KeyValue<string, string>>>([])
|
||||||
|
|
||||||
const radio = ref('1')
|
const radio = ref('1')
|
||||||
|
|||||||
@ -202,9 +202,9 @@ import { MsgError } from '@/utils/message'
|
|||||||
import documentApi from '@/api/document'
|
import documentApi from '@/api/document'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
const { dataset } = useStore()
|
const { knowledge } = useStore()
|
||||||
const documentsFiles = computed(() => dataset.documentsFiles)
|
const documentsFiles = computed(() => knowledge.documentsFiles)
|
||||||
const documentsType = computed(() => dataset.documentsType)
|
const documentsType = computed(() => knowledge.documentsType)
|
||||||
const form = ref({
|
const form = ref({
|
||||||
fileType: 'txt',
|
fileType: 'txt',
|
||||||
fileList: [] as any
|
fileList: [] as any
|
||||||
@ -218,8 +218,8 @@ const rules = reactive({
|
|||||||
const FormRef = ref()
|
const FormRef = ref()
|
||||||
|
|
||||||
watch(form.value, (value) => {
|
watch(form.value, (value) => {
|
||||||
dataset.saveDocumentsType(value.fileType)
|
knowledge.saveDocumentsType(value.fileType)
|
||||||
dataset.saveDocumentsFile(value.fileList)
|
knowledge.saveDocumentsFile(value.fileList)
|
||||||
})
|
})
|
||||||
|
|
||||||
function downloadTemplate(type: string) {
|
function downloadTemplate(type: string) {
|
||||||
|
|||||||
@ -18,23 +18,23 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="$t('views.dataset.datasetForm.form.source_url.label')"
|
:label="$t('views.knowledge.form.source_url.label')"
|
||||||
prop="source_url"
|
prop="source_url"
|
||||||
v-if="datasetForm.type === '1'"
|
v-if="datasetForm.type === '1'"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="datasetForm.source_url"
|
v-model="datasetForm.source_url"
|
||||||
:placeholder="$t('views.dataset.datasetForm.form.source_url.placeholder')"
|
:placeholder="$t('views.knowledge.form.source_url.placeholder')"
|
||||||
@blur="datasetForm.source_url = datasetForm.source_url.trim()"
|
@blur="datasetForm.source_url = datasetForm.source_url.trim()"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="$t('views.dataset.datasetForm.form.selector.label')"
|
:label="$t('views.knowledge.form.selector.label')"
|
||||||
v-if="datasetForm.type === '1'"
|
v-if="datasetForm.type === '1'"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="datasetForm.selector"
|
v-model="datasetForm.selector"
|
||||||
:placeholder="$t('views.dataset.datasetForm.form.selector.placeholder')"
|
:placeholder="$t('views.knowledge.form.selector.placeholder')"
|
||||||
@blur="datasetForm.selector = datasetForm.selector.trim()"
|
@blur="datasetForm.selector = datasetForm.selector.trim()"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -119,7 +119,7 @@ const rules = reactive({
|
|||||||
source_url: [
|
source_url: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t('views.dataset.datasetForm.form.source_url.requiredMessage'),
|
message: t('views.knowledge.form.source_url.requiredMessage'),
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -147,14 +147,14 @@ const rules = reactive({
|
|||||||
user_id: [
|
user_id: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t('views.dataset.datasetForm.form.user_id.requiredMessage'),
|
message: t('views.knowledge.form.user_id.requiredMessage'),
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
token: [
|
token: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: t('views.dataset.datasetForm.form.token.requiredMessage'),
|
message: t('views.knowledge.form.token.requiredMessage'),
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -186,21 +186,21 @@ const submitHandle = async () => {
|
|||||||
}
|
}
|
||||||
knowledgeApi.postDataset(obj, loading).then((res) => {
|
knowledgeApi.postDataset(obj, loading).then((res) => {
|
||||||
MsgSuccess(t('common.createSuccess'))
|
MsgSuccess(t('common.createSuccess'))
|
||||||
router.push({ path: `/dataset/${res.data.id}/document` })
|
router.push({ path: `/knowledge/${res.data.id}/document` })
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
})
|
})
|
||||||
} else if (datasetForm.value.type === '1') {
|
} else if (datasetForm.value.type === '1') {
|
||||||
const obj = { ...BaseFormRef.value.form, ...datasetForm.value }
|
const obj = { ...BaseFormRef.value.form, ...datasetForm.value }
|
||||||
knowledgeApi.postWebDataset(obj, loading).then((res) => {
|
knowledgeApi.postWebDataset(obj, loading).then((res) => {
|
||||||
MsgSuccess(t('common.createSuccess'))
|
MsgSuccess(t('common.createSuccess'))
|
||||||
router.push({ path: `/dataset/${res.data.id}/document` })
|
router.push({ path: `/knowledge/${res.data.id}/document` })
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
})
|
})
|
||||||
} else if (datasetForm.value.type === '2') {
|
} else if (datasetForm.value.type === '2') {
|
||||||
const obj = { ...BaseFormRef.value.form, ...datasetForm.value }
|
const obj = { ...BaseFormRef.value.form, ...datasetForm.value }
|
||||||
knowledgeApi.postLarkDataset(obj, loading).then((res) => {
|
knowledgeApi.postLarkDataset(obj, loading).then((res) => {
|
||||||
MsgSuccess(t('common.createSuccess'))
|
MsgSuccess(t('common.createSuccess'))
|
||||||
router.push({ path: `/dataset/${res.data.id}/document` })
|
router.push({ path: `/knowledge/${res.data.id}/document` })
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -325,7 +325,7 @@ function openCreateDialog(data: any) {
|
|||||||
// if (res?.data) {
|
// if (res?.data) {
|
||||||
// CreateDatasetDialogRef.value.open()
|
// CreateDatasetDialogRef.value.open()
|
||||||
// } else if (res?.code === 400) {
|
// } else if (res?.code === 400) {
|
||||||
// MsgConfirm(t('common.tip'), t('views.dataset.tip.professionalMessage'), {
|
// MsgConfirm(t('common.tip'), t('views.knowledge.tip.professionalMessage'), {
|
||||||
// cancelButtonText: t('common.confirm'),
|
// cancelButtonText: t('common.confirm'),
|
||||||
// confirmButtonText: t('common.professional'),
|
// confirmButtonText: t('common.professional'),
|
||||||
// })
|
// })
|
||||||
@ -388,7 +388,7 @@ function openCreateFolder() {
|
|||||||
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||||
function openGenerateDialog(row: any) {
|
function openGenerateDialog(row: any) {
|
||||||
if (GenerateRelatedDialogRef.value) {
|
if (GenerateRelatedDialogRef.value) {
|
||||||
GenerateRelatedDialogRef.value.open([], 'dataset', row.id)
|
GenerateRelatedDialogRef.value.open([], 'knowledge', row.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@ function changeState(row: any) {
|
|||||||
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||||
function openGenerateDialog(row: any) {
|
function openGenerateDialog(row: any) {
|
||||||
if (GenerateRelatedDialogRef.value) {
|
if (GenerateRelatedDialogRef.value) {
|
||||||
GenerateRelatedDialogRef.value.open([], 'dataset', row.id)
|
GenerateRelatedDialogRef.value.open([], 'knowledge', row.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function openSelectDocumentDialog(row?: any) {
|
function openSelectDocumentDialog(row?: any) {
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
<ProblemComponent
|
<ProblemComponent
|
||||||
:problemId="problemId"
|
:problemId="problemId"
|
||||||
:docId="document_id"
|
:docId="document_id"
|
||||||
:datasetId="dataset_id"
|
:knowledgeId="dataset_id"
|
||||||
ref="ProblemRef"
|
ref="ProblemRef"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
@ -63,12 +63,12 @@ import useStore from '@/stores'
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
problemId: String,
|
problemId: String,
|
||||||
docId: String,
|
docId: String,
|
||||||
datasetId: String
|
knowledgeId: String,
|
||||||
})
|
})
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: { id, documentId } // id为datasetId
|
params: { id, documentId }, // id为knowledgeId
|
||||||
} = route as any
|
} = route as any
|
||||||
|
|
||||||
const { problem } = useStore()
|
const { problem } = useStore()
|
||||||
@ -90,19 +90,19 @@ watch(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true
|
immediate: true,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
function delProblemHandle(item: any, index: number) {
|
function delProblemHandle(item: any, index: number) {
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
problem
|
problem
|
||||||
.asyncDisassociationProblem(
|
.asyncDisassociationProblem(
|
||||||
props.datasetId || id,
|
props.knowledgeId || id,
|
||||||
documentId || props.docId,
|
documentId || props.docId,
|
||||||
props.problemId || '',
|
props.problemId || '',
|
||||||
item.id,
|
item.id,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
getProblemList()
|
getProblemList()
|
||||||
@ -115,7 +115,7 @@ function delProblemHandle(item: any, index: number) {
|
|||||||
function getProblemList() {
|
function getProblemList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
paragraphApi
|
paragraphApi
|
||||||
.getProblem(props.datasetId || id, documentId || props.docId, props.problemId || '')
|
.getParagraphProblem(props.knowledgeId || id, documentId || props.docId, props.problemId || '')
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
problemList.value = res.data
|
problemList.value = res.data
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@ -135,20 +135,20 @@ function addProblemHandle(val: string) {
|
|||||||
if (props.problemId) {
|
if (props.problemId) {
|
||||||
const api = problemOptions.value.some((option) => option.id === val)
|
const api = problemOptions.value.some((option) => option.id === val)
|
||||||
? problem.asyncAssociationProblem(
|
? problem.asyncAssociationProblem(
|
||||||
props.datasetId || id,
|
props.knowledgeId || id,
|
||||||
documentId || props.docId,
|
documentId || props.docId,
|
||||||
props.problemId,
|
props.problemId,
|
||||||
val,
|
val,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
: paragraphApi.postProblem(
|
: paragraphApi.postParagraphProblem(
|
||||||
props.datasetId || id,
|
props.knowledgeId || id,
|
||||||
documentId || props.docId,
|
documentId || props.docId,
|
||||||
props.problemId,
|
props.problemId,
|
||||||
{
|
{
|
||||||
content: val
|
content: val,
|
||||||
},
|
},
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
api.then(() => {
|
api.then(() => {
|
||||||
getProblemList()
|
getProblemList()
|
||||||
@ -174,10 +174,10 @@ const remoteMethod = (query: string) => {
|
|||||||
function getProblemOption(filterText?: string) {
|
function getProblemOption(filterText?: string) {
|
||||||
return problem
|
return problem
|
||||||
.asyncGetProblem(
|
.asyncGetProblem(
|
||||||
props.datasetId || (id as string),
|
props.knowledgeId || (id as string),
|
||||||
{ current_page: 1, page_size: 100 },
|
{ current_page: 1, page_size: 100 },
|
||||||
filterText && { content: filterText },
|
filterText && { content: filterText },
|
||||||
optionLoading
|
optionLoading,
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
problemOptions.value = res.data.records
|
problemOptions.value = res.data.records
|
||||||
@ -194,11 +194,7 @@ onUnmounted(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
problemList
|
problemList,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss"></style>
|
||||||
.question-tag {
|
|
||||||
// width: 217px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@ import type { FormInstance, FormRules } from 'element-plus'
|
|||||||
import paragraphApi from '@/api/knowledge/paragraph'
|
import paragraphApi from '@/api/knowledge/paragraph'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
const { dataset, document } = useStore()
|
const { knowledge, document } = useStore()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
@ -144,7 +144,7 @@ function getDocument(id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDataset() {
|
function getDataset() {
|
||||||
dataset.asyncGetAllDataset(loading).then((res: any) => {
|
knowledge.asyncGetAllKnowledge(loading).then((res: any) => {
|
||||||
datasetList.value = res.data
|
datasetList.value = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,13 +76,21 @@
|
|||||||
<VueDraggable
|
<VueDraggable
|
||||||
ref="el"
|
ref="el"
|
||||||
v-bind:modelValue="paragraphDetail"
|
v-bind:modelValue="paragraphDetail"
|
||||||
|
:disabled="isBatch === true"
|
||||||
handle=".handle"
|
handle=".handle"
|
||||||
:animation="150"
|
:animation="150"
|
||||||
ghostClass="ghost"
|
ghostClass="ghost"
|
||||||
@end="onEnd"
|
@end="onEnd"
|
||||||
>
|
>
|
||||||
|
<el-checkbox-group v-model="multipleSelection">
|
||||||
<template v-for="(item, index) in paragraphDetail" :key="item.id">
|
<template v-for="(item, index) in paragraphDetail" :key="item.id">
|
||||||
<div class="handle paragraph-card flex" :id="item.id">
|
<!-- 批量操作 -->
|
||||||
|
<div class="paragraph-card flex" :id="item.id" v-if="isBatch === true">
|
||||||
|
<el-checkbox :value="item.id" />
|
||||||
|
<ParagraphCard :data="item" class="mb-8 w-full" />
|
||||||
|
</div>
|
||||||
|
<!-- 非批量操作 -->
|
||||||
|
<div class="handle paragraph-card flex" :id="item.id" v-else>
|
||||||
<img
|
<img
|
||||||
src="@/assets/sort.svg"
|
src="@/assets/sort.svg"
|
||||||
alt=""
|
alt=""
|
||||||
@ -97,6 +105,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</el-checkbox-group>
|
||||||
</VueDraggable>
|
</VueDraggable>
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
</div>
|
</div>
|
||||||
@ -206,7 +215,7 @@ function deleteMulParagraph() {
|
|||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
paragraphApi
|
paragraphApi
|
||||||
.delMulParagraph(id, documentId, multipleSelection.value, changeStateloading)
|
.putMulParagraph(id, documentId, multipleSelection.value, changeStateloading)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
paragraphDetail.value = paragraphDetail.value.filter(
|
paragraphDetail.value = paragraphDetail.value.filter(
|
||||||
(v) => !multipleSelection.value.includes(v.id),
|
(v) => !multipleSelection.value.includes(v.id),
|
||||||
|
|||||||
@ -120,7 +120,7 @@ const { problem, document } = useStore()
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: { id }, // datasetId
|
params: { id }, // knowledgeId
|
||||||
} = route as any
|
} = route as any
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|||||||
@ -141,7 +141,7 @@ import { ref, computed, onMounted } from 'vue'
|
|||||||
import { relatedObject } from '@/utils/utils'
|
import { relatedObject } from '@/utils/utils'
|
||||||
import { SearchMode } from '@/enums/application'
|
import { SearchMode } from '@/enums/application'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
const { dataset, application, user } = useStore()
|
const { knowledge, application, user } = useStore()
|
||||||
const {
|
const {
|
||||||
params: { id }
|
params: { id }
|
||||||
} = app.config.globalProperties.$route as any
|
} = app.config.globalProperties.$route as any
|
||||||
@ -208,7 +208,7 @@ function getDataset() {
|
|||||||
datasetList.value = res.data
|
datasetList.value = res.data
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
dataset.asyncGetAllDataset(datasetLoading).then((res: any) => {
|
knowledge.asyncGetAllKnowledge(datasetLoading).then((res: any) => {
|
||||||
datasetList.value = res.data?.filter((v: any) => v.user_id === user.userInfo?.id)
|
datasetList.value = res.data?.filter((v: any) => v.user_id === user.userInfo?.id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user