feat: problem
This commit is contained in:
parent
2b097e5c97
commit
b1610a00bf
@ -160,7 +160,7 @@ const exportKnowledge: (
|
|||||||
knowledge_id: string,
|
knowledge_id: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<any> = (knowledge_name, knowledge_id, loading) => {
|
) => Promise<any> = (knowledge_name, knowledge_id, loading) => {
|
||||||
return exportExcel(knowledge_name + '.xlsx', `dataset/${knowledge_id}/export`, undefined, loading)
|
return exportExcel(knowledge_name + '.xlsx', `${prefix}/${knowledge_id}/knowledge/${knowledge_id}/export`, undefined, loading)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*导出Zip知识库
|
*导出Zip知识库
|
||||||
@ -176,7 +176,7 @@ const exportZipKnowledge: (
|
|||||||
) => Promise<any> = (knowledge_name, knowledge_id, loading) => {
|
) => Promise<any> = (knowledge_name, knowledge_id, loading) => {
|
||||||
return exportFile(
|
return exportFile(
|
||||||
knowledge_name + '.zip',
|
knowledge_name + '.zip',
|
||||||
`dataset/${knowledge_id}/export_zip`,
|
`${prefix}/${knowledge_id}/knowledge/${knowledge_id}/export_zip`,
|
||||||
undefined,
|
undefined,
|
||||||
loading,
|
loading,
|
||||||
)
|
)
|
||||||
@ -233,6 +233,17 @@ const generateRelated: (
|
|||||||
return put(`${prefix}/${knowledge_id}/generate_related`, data, null, loading)
|
return put(`${prefix}/${knowledge_id}/generate_related`, data, null, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除知识库
|
||||||
|
* @param 参数 knowledge_id
|
||||||
|
*/
|
||||||
|
const delKnowledge: (knowledge_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
|
||||||
|
knowledge_id,
|
||||||
|
loading
|
||||||
|
) => {
|
||||||
|
return del(`${prefix}/${knowledge_id}`, undefined, {}, loading)
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getKnowledgeByFolder,
|
getKnowledgeByFolder,
|
||||||
getKnowledgeList,
|
getKnowledgeList,
|
||||||
@ -249,4 +260,5 @@ export default {
|
|||||||
getLarkDocumentList,
|
getLarkDocumentList,
|
||||||
importLarkDocument,
|
importLarkDocument,
|
||||||
generateRelated,
|
generateRelated,
|
||||||
|
delKnowledge
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,13 +4,37 @@ import type { pageRequest } from '@/api/type/common'
|
|||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledge'
|
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledge'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建段落
|
||||||
|
* @param 参数
|
||||||
|
* dataset_id, document_id
|
||||||
|
* {
|
||||||
|
"content": "string",
|
||||||
|
"title": "string",
|
||||||
|
"is_active": true,
|
||||||
|
"problem_list": [
|
||||||
|
{
|
||||||
|
"content": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const postParagraph: (
|
||||||
|
dataset_id: string,
|
||||||
|
document_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (dataset_id, document_id, data, loading) => {
|
||||||
|
return post(`${prefix}/${dataset_id}/document/${document_id}/paragraph`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 段落列表
|
* 段落列表
|
||||||
* @param 参数 dataset_id document_id
|
* @param 参数 dataset_id document_id
|
||||||
* page {
|
* page {
|
||||||
"current_page": "string",
|
"current_page": "string",
|
||||||
"page_size": "string",
|
"page_size": "string",
|
||||||
}
|
}
|
||||||
* param {
|
* param {
|
||||||
"title": "string",
|
"title": "string",
|
||||||
"content": "string",
|
"content": "string",
|
||||||
@ -21,12 +45,12 @@ const getParagraph: (
|
|||||||
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>> = (dataset_id, document_id, page, param, loading) => {
|
||||||
return get(
|
return get(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${page.current_page}/${page.page_size}`,
|
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${page.current_page}/${page.page_size}`,
|
||||||
param,
|
param,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,13 +62,13 @@ const delParagraph: (
|
|||||||
dataset_id: string,
|
dataset_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>> = (dataset_id, document_id, paragraph_id, loading) => {
|
||||||
return del(
|
return del(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,40 +80,17 @@ const delMulParagraph: (
|
|||||||
dataset_id: string,
|
dataset_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
||||||
return del(
|
return del(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/_batch`,
|
`${prefix}/${dataset_id}/document/${document_id}/paragraph/_batch`,
|
||||||
undefined,
|
undefined,
|
||||||
{ id_list: data },
|
{ id_list: data },
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建段落
|
|
||||||
* @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,
|
|
||||||
loading?: Ref<boolean>
|
|
||||||
) => Promise<Result<any>> = (dataset_id, document_id, data, loading) => {
|
|
||||||
return post(`${prefix}/${dataset_id}/document/${document_id}/paragraph`, data, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改段落
|
* 修改段落
|
||||||
@ -112,13 +113,13 @@ const putParagraph: (
|
|||||||
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>> = (dataset_id, document_id, paragraph_id, data, loading) => {
|
||||||
return put(
|
return put(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
||||||
data,
|
data,
|
||||||
undefined,
|
undefined,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,33 +133,35 @@ const putMigrateMulParagraph: (
|
|||||||
target_dataset_id: string,
|
target_dataset_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,
|
dataset_id,
|
||||||
document_id,
|
document_id,
|
||||||
target_dataset_id,
|
target_dataset_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}/${dataset_id}/document/${document_id}/paragraph/migrate/dataset/${target_dataset_id}/document/${target_document_id}`,
|
||||||
data,
|
data,
|
||||||
undefined,
|
undefined,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const batchGenerateRelated: (
|
||||||
* 问题列表
|
|
||||||
* @param 参数 dataset_id,document_id,paragraph_id
|
|
||||||
*/
|
|
||||||
const getProblem: (
|
|
||||||
dataset_id: string,
|
dataset_id: string,
|
||||||
document_id: string,
|
document_id: string,
|
||||||
paragraph_id: string
|
data: any,
|
||||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id: string) => {
|
loading?: Ref<boolean>,
|
||||||
return get(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`)
|
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
||||||
|
return put(
|
||||||
|
`${prefix}/${dataset_id}/document/${document_id}/paragraph/batch_generate_related`,
|
||||||
|
data,
|
||||||
|
undefined,
|
||||||
|
loading,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,82 +178,23 @@ const postProblem: (
|
|||||||
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: any, loading) => {
|
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, data: any, loading) => {
|
||||||
return post(
|
return post(
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`,
|
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`,
|
||||||
data,
|
data,
|
||||||
{},
|
{},
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param dataset_id 数据集id
|
|
||||||
* @param document_id 文档id
|
|
||||||
* @param paragraph_id 段落id
|
|
||||||
* @param problem_id 问题id
|
|
||||||
* @param loading 加载器
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const associationProblem: (
|
|
||||||
dataset_id: string,
|
|
||||||
document_id: string,
|
|
||||||
paragraph_id: string,
|
|
||||||
problem_id: string,
|
|
||||||
loading?: Ref<boolean>
|
|
||||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, problem_id, loading) => {
|
|
||||||
return put(
|
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem/${problem_id}/association`,
|
|
||||||
{},
|
|
||||||
{},
|
|
||||||
loading
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 解除关联问题
|
|
||||||
* @param 参数 dataset_id, document_id, paragraph_id,problem_id
|
|
||||||
*/
|
|
||||||
const disassociationProblem: (
|
|
||||||
dataset_id: string,
|
|
||||||
document_id: string,
|
|
||||||
paragraph_id: string,
|
|
||||||
problem_id: string,
|
|
||||||
loading?: Ref<boolean>
|
|
||||||
) => Promise<Result<boolean>> = (dataset_id, document_id, paragraph_id, problem_id, loading) => {
|
|
||||||
return put(
|
|
||||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem/${problem_id}/un_association`,
|
|
||||||
{},
|
|
||||||
{},
|
|
||||||
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,
|
|
||||||
undefined,
|
|
||||||
loading
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getParagraph,
|
getParagraph,
|
||||||
delParagraph,
|
delParagraph,
|
||||||
putParagraph,
|
putParagraph,
|
||||||
postParagraph,
|
postParagraph,
|
||||||
getProblem,
|
|
||||||
postProblem,
|
|
||||||
disassociationProblem,
|
|
||||||
associationProblem,
|
|
||||||
delMulParagraph,
|
delMulParagraph,
|
||||||
putMigrateMulParagraph,
|
putMigrateMulParagraph,
|
||||||
batchGenerateRelated
|
batchGenerateRelated,
|
||||||
|
postProblem,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,27 @@
|
|||||||
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 { 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'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建问题
|
||||||
|
* @param 参数 knowledge_id
|
||||||
|
* data: array[string]
|
||||||
|
*/
|
||||||
|
const postProblems: (
|
||||||
|
knowledge_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<any>> = (knowledge_id, data, loading) => {
|
||||||
|
return post(`${prefix}/${knowledge_id}/problem`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 问题分页列表
|
* 问题分页列表
|
||||||
* @param 参数 dataset_id,
|
* @param 参数 knowledge_id,
|
||||||
* page {
|
* page {
|
||||||
"current_page": "string",
|
"current_page": "string",
|
||||||
"page_size": "string",
|
"page_size": "string",
|
||||||
@ -19,99 +32,87 @@ const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledg
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const getProblems: (
|
const getProblems: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
page: pageRequest,
|
page: pageRequest,
|
||||||
param: any,
|
param: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (dataset_id, page, param, loading) => {
|
) => Promise<Result<any>> = (knowledge_id, page, param, loading) => {
|
||||||
return get(
|
return get(
|
||||||
`${prefix}/${dataset_id}/problem/${page.current_page}/${page.page_size}`,
|
`${prefix}/${knowledge_id}/problem/${page.current_page}/${page.page_size}`,
|
||||||
param,
|
param,
|
||||||
loading,
|
loading,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建问题
|
|
||||||
* @param 参数 dataset_id
|
|
||||||
* data: array[string]
|
|
||||||
*/
|
|
||||||
const postProblems: (
|
|
||||||
dataset_id: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (dataset_id, data, loading) => {
|
|
||||||
return post(`${prefix}/${dataset_id}/problem`, data, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除问题
|
|
||||||
* @param 参数 dataset_id, problem_id,
|
|
||||||
*/
|
|
||||||
const delProblems: (
|
|
||||||
dataset_id: string,
|
|
||||||
problem_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<boolean>> = (dataset_id, problem_id, loading) => {
|
|
||||||
return del(`${prefix}/${dataset_id}/problem/${problem_id}`, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除问题
|
|
||||||
* @param 参数 dataset_id,
|
|
||||||
*/
|
|
||||||
const delMulProblem: (
|
|
||||||
dataset_id: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
|
|
||||||
return del(`${prefix}/${dataset_id}/problem/_batch`, undefined, data, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改问题
|
* 修改问题
|
||||||
* @param 参数
|
* @param 参数
|
||||||
* dataset_id, problem_id,
|
* knowledge_id, problem_id,
|
||||||
* {
|
* {
|
||||||
"content": "string",
|
"content": "string",
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
const putProblems: (
|
const putProblems: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
problem_id: string,
|
problem_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (dataset_id, problem_id, data: any, loading) => {
|
) => Promise<Result<any>> = (knowledge_id, problem_id, data: any, loading) => {
|
||||||
return put(`${prefix}/${dataset_id}/problem/${problem_id}`, data, undefined, loading)
|
return put(`${prefix}/${knowledge_id}/problem/${problem_id}`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除问题
|
||||||
|
* @param 参数 knowledge_id, problem_id,
|
||||||
|
*/
|
||||||
|
const delProblems: (
|
||||||
|
knowledge_id: string,
|
||||||
|
problem_id: string,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<boolean>> = (knowledge_id, problem_id, loading) => {
|
||||||
|
return del(`${prefix}/${knowledge_id}/problem/${problem_id}`, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 问题详情
|
* 问题详情
|
||||||
* @param 参数
|
* @param 参数
|
||||||
* dataset_id, problem_id,
|
* knowledge_id, problem_id,
|
||||||
*/
|
*/
|
||||||
const getDetailProblems: (
|
const getDetailProblems: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
problem_id: string,
|
problem_id: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (dataset_id, problem_id, loading) => {
|
) => Promise<Result<any>> = (knowledge_id, problem_id, loading) => {
|
||||||
return get(`${prefix}/${dataset_id}/problem/${problem_id}/paragraph`, undefined, loading)
|
return get(`${prefix}/${knowledge_id}/problem/${problem_id}/paragraph`, undefined, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量关联段落
|
* 批量关联段落
|
||||||
* @param 参数 dataset_id,
|
* @param 参数 knowledge_id,
|
||||||
* {
|
* {
|
||||||
"problem_id_list": "Array",
|
"problem_id_list": "Array",
|
||||||
"paragraph_list": "Array",
|
"paragraph_list": "Array",
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
const postMulAssociationProblem: (
|
const putMulAssociationProblem: (
|
||||||
dataset_id: string,
|
knowledge_id: string,
|
||||||
data: any,
|
data: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
|
) => Promise<Result<boolean>> = (knowledge_id, data, loading) => {
|
||||||
return post(`${prefix}/${dataset_id}/problem/_batch`, data, undefined, loading)
|
return put(`${prefix}/${knowledge_id}/problem/batch_association`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除问题
|
||||||
|
* @param 参数 knowledge_id,
|
||||||
|
* data: array[string]
|
||||||
|
*/
|
||||||
|
const putMulProblem: (
|
||||||
|
knowledge_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>,
|
||||||
|
) => Promise<Result<boolean>> = (knowledge_id, data, loading) => {
|
||||||
|
return put(`${prefix}/${knowledge_id}/problem/batch_delete`, data, undefined, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -120,6 +121,6 @@ export default {
|
|||||||
delProblems,
|
delProblems,
|
||||||
putProblems,
|
putProblems,
|
||||||
getDetailProblems,
|
getDetailProblems,
|
||||||
delMulProblem,
|
putMulProblem,
|
||||||
postMulAssociationProblem,
|
putMulAssociationProblem,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
export enum SearchMode {
|
export enum SearchMode {
|
||||||
embedding = 'views.application.applicationForm.dialog.vectorSearch',
|
embedding = 'views.application.form.dialog.vectorSearch',
|
||||||
keywords = 'views.application.applicationForm.dialog.fullTextSearch',
|
keywords = 'views.application.form.dialog.fullTextSearch',
|
||||||
blend = 'views.application.applicationForm.dialog.hybridSearch'
|
blend = 'views.application.form.dialog.hybridSearch'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum WorkflowType {
|
export enum WorkflowType {
|
||||||
|
|||||||
@ -83,8 +83,8 @@ const menuIcon = computed(() => {
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: none;
|
background: var(--app-text-color-light-1);
|
||||||
color: var(--el-color-primary);
|
color: var(--el-menu-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
:deep(.el-sub-menu__title) {
|
:deep(.el-sub-menu__title) {
|
||||||
|
|||||||
@ -49,13 +49,6 @@ const activeMenu = computed(() => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
border: none;
|
||||||
background: none;
|
background: none;
|
||||||
.el-menu-item {
|
|
||||||
&:hover {
|
|
||||||
background: var(--app-text-color-light-1);
|
|
||||||
color: var(--el-menu-text-color);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import useModelStore from './modules/model'
|
|||||||
import usePromptStore from './modules/prompt'
|
import usePromptStore from './modules/prompt'
|
||||||
import useProblemStore from './modules/problem'
|
import useProblemStore from './modules/problem'
|
||||||
import useParagraphStore from './modules/paragraph'
|
import useParagraphStore from './modules/paragraph'
|
||||||
|
import useDocumentStore from './modules/document'
|
||||||
|
|
||||||
const useStore = () => ({
|
const useStore = () => ({
|
||||||
common: useCommonStore(),
|
common: useCommonStore(),
|
||||||
@ -20,6 +21,7 @@ const useStore = () => ({
|
|||||||
prompt: usePromptStore(),
|
prompt: usePromptStore(),
|
||||||
problem: useProblemStore(),
|
problem: useProblemStore(),
|
||||||
paragraph: useParagraphStore(),
|
paragraph: useParagraphStore(),
|
||||||
|
document: useDocumentStore(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export default useStore
|
export default useStore
|
||||||
|
|||||||
35
ui/src/stores/modules/document.ts
Normal file
35
ui/src/stores/modules/document.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import documentApi from '@/api/knowledge/document'
|
||||||
|
import { type Ref } from 'vue'
|
||||||
|
|
||||||
|
const useDocumentStore = defineStore('document', {
|
||||||
|
state: () => ({}),
|
||||||
|
actions: {
|
||||||
|
async asyncGetAllDocument(id: string, loading?: Ref<boolean>) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
documentApi
|
||||||
|
.getAllDocument(id, loading)
|
||||||
|
.then((res) => {
|
||||||
|
resolve(res)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async asyncPostDocument(datasetId: string, data: any, loading?: Ref<boolean>) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
documentApi
|
||||||
|
.postDocument(datasetId, data, loading)
|
||||||
|
.then((data) => {
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export default useDocumentStore
|
||||||
@ -43,7 +43,7 @@ const useKnowledgeStore = defineStore('knowledge', {
|
|||||||
// })
|
// })
|
||||||
// })
|
// })
|
||||||
// },
|
// },
|
||||||
async asyncGetDatasetDetail(
|
async asyncGetKnowledgeDetail(
|
||||||
knowledge_id: string,
|
knowledge_id: string,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -450,6 +450,12 @@ h5 {
|
|||||||
border-color: #d6e2ff;
|
border-color: #d6e2ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 蓝色提示框
|
||||||
|
.update-info {
|
||||||
|
background: #d6e2ff;
|
||||||
|
line-height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
内容部分 自适应高度
|
内容部分 自适应高度
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -121,3 +121,32 @@
|
|||||||
color: var(--app-text-color);
|
color: var(--app-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.card__radio {
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
line-height: 22px;
|
||||||
|
.el-radio {
|
||||||
|
white-space: break-spaces;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
line-height: 22px;
|
||||||
|
color: var(--app-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-radio__label) {
|
||||||
|
padding-left: 30px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
:deep(.el-radio__input) {
|
||||||
|
position: absolute;
|
||||||
|
top: 16px;
|
||||||
|
}
|
||||||
|
.active {
|
||||||
|
border: 1px solid var(--el-color-primary);
|
||||||
|
}
|
||||||
|
.el-card__body {
|
||||||
|
padding: calc(var(--app-base-px) + 4px) calc(var(--app-base-px) * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
--el-card-padding: calc(var(--app-base-px) * 2);
|
--el-card-padding: calc(var(--app-base-px) * 2);
|
||||||
--el-card-border-radius: 6px;
|
--el-card-border-radius: 6px;
|
||||||
box-shadow: 0px 2px 4px 0px rgba(31, 35, 41, 0.12) !important;
|
box-shadow: 0px 2px 4px 0px rgba(31, 35, 41, 0.12) !important;
|
||||||
border: none;
|
|
||||||
&.is-never-shadow {
|
&.is-never-shadow {
|
||||||
border: 1px solid var(--el-card-border-color);
|
border: 1px solid var(--el-card-border-color);
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
{{ $t('common.setting') }}
|
{{ $t('common.setting') }}
|
||||||
</h3>
|
</h3>
|
||||||
<el-button type="primary" @click="submit(applicationFormRef)" :disabled="loading">
|
<el-button type="primary" @click="submit(applicationFormRef)" :disabled="loading">
|
||||||
{{ $t('views.application.applicationForm.buttons.publish') }}
|
{{ $t('views.application.form.buttons.publish') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -427,7 +427,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="14" class="p-24 border-l">
|
<el-col :span="14" class="p-24 border-l">
|
||||||
<h4 class="title-decoration-1 mb-16">
|
<h4 class="title-decoration-1 mb-16">
|
||||||
{{ $t('views.application.applicationForm.title.appTest') }}
|
{{ $t('views.application.form.title.appTest') }}
|
||||||
</h4>
|
</h4>
|
||||||
<div class="dialog-bg">
|
<div class="dialog-bg">
|
||||||
<div class="flex align-center p-16 mb-8">
|
<div class="flex align-center p-16 mb-8">
|
||||||
@ -524,11 +524,11 @@ const defaultPrompt = t('views.application.form.prompt.defaultPrompt', {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const optimizationPrompt =
|
const optimizationPrompt =
|
||||||
t('views.application.applicationForm.dialog.defaultPrompt1', {
|
t('views.application.form.dialog.defaultPrompt1', {
|
||||||
question: '{question}'
|
question: '{question}'
|
||||||
}) +
|
}) +
|
||||||
'<data></data>' +
|
'<data></data>' +
|
||||||
t('views.application.applicationForm.dialog.defaultPrompt2')
|
t('views.application.form.dialog.defaultPrompt2')
|
||||||
|
|
||||||
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
|
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
|
||||||
const ReasoningParamSettingDialogRef = ref<InstanceType<typeof ReasoningParamSettingDialog>>()
|
const ReasoningParamSettingDialogRef = ref<InstanceType<typeof ReasoningParamSettingDialog>>()
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:title="$t('views.application.applicationForm.dialog.addDataset')"
|
:title="$t('views.application.form.dialog.addDataset')"
|
||||||
v-model="dialogVisible"
|
v-model="dialogVisible"
|
||||||
width="600"
|
width="600"
|
||||||
append-to-body
|
append-to-body
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<template #header="{ titleId, titleClass }">
|
<template #header="{ titleId, titleClass }">
|
||||||
<div class="flex-between mb-8">
|
<div class="flex-between mb-8">
|
||||||
<h4 :id="titleId" :class="titleClass">
|
<h4 :id="titleId" :class="titleClass">
|
||||||
{{ $t('views.application.applicationForm.dialog.addDataset') }}
|
{{ $t('views.application.form.dialog.addDataset') }}
|
||||||
</h4>
|
</h4>
|
||||||
<div class="flex align-center mr-8">
|
<div class="flex align-center mr-8">
|
||||||
<el-button link class="ml-16" @click="refresh">
|
<el-button link class="ml-16" @click="refresh">
|
||||||
@ -23,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex-between">
|
<div class="flex-between">
|
||||||
<el-text type="info" class="color-secondary">
|
<el-text type="info" class="color-secondary">
|
||||||
{{ $t('views.application.applicationForm.dialog.addDatasetPlaceholder') }}
|
{{ $t('views.application.form.dialog.addDatasetPlaceholder') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="searchValue"
|
v-model="searchValue"
|
||||||
@ -49,8 +49,8 @@
|
|||||||
<div class="flex-between">
|
<div class="flex-between">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<el-text type="info" class="color-secondary mr-8" v-if="checkList.length > 0">
|
<el-text type="info" class="color-secondary mr-8" v-if="checkList.length > 0">
|
||||||
{{ $t('views.application.applicationForm.dialog.selected') }} {{ checkList.length }}
|
{{ $t('views.application.form.dialog.selected') }} {{ checkList.length }}
|
||||||
{{ $t('views.application.applicationForm.dialog.countDataset') }}
|
{{ $t('views.application.form.dialog.countDataset') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-button link type="primary" v-if="checkList.length > 0" @click="clearCheck">
|
<el-button link type="primary" v-if="checkList.length > 0" @click="clearCheck">
|
||||||
{{ $t('common.clear') }}
|
{{ $t('common.clear') }}
|
||||||
|
|||||||
@ -136,7 +136,7 @@ watch(dialogVisible, (bool) => {
|
|||||||
const open = (data: any) => {
|
const open = (data: any) => {
|
||||||
const obj = cloneDeep(data)
|
const obj = cloneDeep(data)
|
||||||
delete obj['id']
|
delete obj['id']
|
||||||
obj['name'] = obj['name'] + ` ${t('views.application.applicationForm.title.copy')}`
|
obj['name'] = obj['name'] + ` ${t('views.application.form.title.copy')}`
|
||||||
applicationForm.value = obj
|
applicationForm.value = obj
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
<el-scrollbar max-height="550">
|
<el-scrollbar max-height="550">
|
||||||
<div class="p-16">
|
<div class="p-16">
|
||||||
<el-form label-position="top" ref="paramFormRef" :model="form" v-loading="loading">
|
<el-form label-position="top" ref="paramFormRef" :model="form" v-loading="loading">
|
||||||
<el-form-item :label="$t('views.application.applicationForm.dialog.selectSearchMode')">
|
<el-form-item :label="$t('views.application.dialog.selectSearchMode')">
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-model="form.dataset_setting.search_mode"
|
v-model="form.dataset_setting.search_mode"
|
||||||
class="card__radio"
|
class="card__radio"
|
||||||
@ -25,10 +25,10 @@
|
|||||||
>
|
>
|
||||||
<el-radio value="embedding" size="large">
|
<el-radio value="embedding" size="large">
|
||||||
<p class="mb-4">
|
<p class="mb-4">
|
||||||
{{ $t('views.application.applicationForm.dialog.vectorSearch') }}
|
{{ $t('views.application.dialog.vectorSearch') }}
|
||||||
</p>
|
</p>
|
||||||
<el-text type="info">{{
|
<el-text type="info">{{
|
||||||
$t('views.application.applicationForm.dialog.vectorSearchTooltip')
|
$t('views.application.dialog.vectorSearchTooltip')
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -39,10 +39,10 @@
|
|||||||
>
|
>
|
||||||
<el-radio value="keywords" size="large">
|
<el-radio value="keywords" size="large">
|
||||||
<p class="mb-4">
|
<p class="mb-4">
|
||||||
{{ $t('views.application.applicationForm.dialog.fullTextSearch') }}
|
{{ $t('views.application.dialog.fullTextSearch') }}
|
||||||
</p>
|
</p>
|
||||||
<el-text type="info">{{
|
<el-text type="info">{{
|
||||||
$t('views.application.applicationForm.dialog.fullTextSearchTooltip')
|
$t('views.application.dialog.fullTextSearchTooltip')
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -52,10 +52,10 @@
|
|||||||
>
|
>
|
||||||
<el-radio value="blend" size="large">
|
<el-radio value="blend" size="large">
|
||||||
<p class="mb-4">
|
<p class="mb-4">
|
||||||
{{ $t('views.application.applicationForm.dialog.hybridSearch') }}
|
{{ $t('views.application.dialog.hybridSearch') }}
|
||||||
</p>
|
</p>
|
||||||
<el-text type="info">{{
|
<el-text type="info">{{
|
||||||
$t('views.application.applicationForm.dialog.hybridSearchTooltip')
|
$t('views.application.dialog.hybridSearchTooltip')
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -67,11 +67,11 @@
|
|||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex align-center">
|
<div class="flex align-center">
|
||||||
<span class="mr-4">{{
|
<span class="mr-4">{{
|
||||||
$t('views.application.applicationForm.dialog.similarityThreshold')
|
$t('views.application.dialog.similarityThreshold')
|
||||||
}}</span>
|
}}</span>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
effect="dark"
|
effect="dark"
|
||||||
:content="$t('views.application.applicationForm.dialog.similarityTooltip')"
|
:content="$t('views.application.dialog.similarityTooltip')"
|
||||||
placement="right"
|
placement="right"
|
||||||
>
|
>
|
||||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||||
@ -91,7 +91,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item :label="$t('views.application.applicationForm.dialog.topReferences')">
|
<el-form-item :label="$t('views.application.dialog.topReferences')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="form.dataset_setting.top_n"
|
v-model="form.dataset_setting.top_n"
|
||||||
:min="1"
|
:min="1"
|
||||||
@ -104,7 +104,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-form-item :label="$t('views.application.applicationForm.dialog.maxCharacters')">
|
<el-form-item :label="$t('views.application.dialog.maxCharacters')">
|
||||||
<el-slider
|
<el-slider
|
||||||
v-model="form.dataset_setting.max_paragraph_char_number"
|
v-model="form.dataset_setting.max_paragraph_char_number"
|
||||||
show-input
|
show-input
|
||||||
@ -117,7 +117,7 @@
|
|||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="!isWorkflowType"
|
v-if="!isWorkflowType"
|
||||||
:label="$t('views.application.applicationForm.dialog.noReferencesAction')"
|
:label="$t('views.application.dialog.noReferencesAction')"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
label-position="top"
|
label-position="top"
|
||||||
@ -133,12 +133,12 @@
|
|||||||
>
|
>
|
||||||
<el-radio value="ai_questioning">
|
<el-radio value="ai_questioning">
|
||||||
<p>
|
<p>
|
||||||
{{ $t('views.application.applicationForm.dialog.continueQuestioning') }}
|
{{ $t('views.application.dialog.continueQuestioning') }}
|
||||||
</p>
|
</p>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
|
|
||||||
<el-radio value="designated_answer">
|
<el-radio value="designated_answer">
|
||||||
<p>{{ $t('views.application.applicationForm.dialog.provideAnswer') }}</p>
|
<p>{{ $t('views.application.dialog.provideAnswer') }}</p>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="form.dataset_setting.no_references_setting.status === 'designated_answer'"
|
v-if="form.dataset_setting.no_references_setting.status === 'designated_answer'"
|
||||||
prop="designated_answer"
|
prop="designated_answer"
|
||||||
@ -205,15 +205,15 @@ const noReferencesformRef = ref()
|
|||||||
const defaultValue = {
|
const defaultValue = {
|
||||||
ai_questioning: '{question}',
|
ai_questioning: '{question}',
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
designated_answer: t('views.application.applicationForm.dialog.designated_answer')
|
designated_answer: t('views.application.dialog.designated_answer')
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultPrompt =
|
const defaultPrompt =
|
||||||
t('views.application.applicationForm.dialog.defaultPrompt1', {
|
t('views.application.dialog.defaultPrompt1', {
|
||||||
question: '{question}'
|
question: '{question}'
|
||||||
}) +
|
}) +
|
||||||
'<data></data>' +
|
'<data></data>' +
|
||||||
t('views.application.applicationForm.dialog.defaultPrompt2')
|
t('views.application.dialog.defaultPrompt2')
|
||||||
|
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
dataset_setting: {
|
dataset_setting: {
|
||||||
|
|||||||
@ -250,6 +250,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {onMounted, ref, reactive, computed} from 'vue'
|
import {onMounted, ref, reactive, computed} from 'vue'
|
||||||
import CreateApplicationDialog from '@/views/application/component/CreateApplicationDialog.vue'
|
import CreateApplicationDialog from '@/views/application/component/CreateApplicationDialog.vue'
|
||||||
|
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
||||||
import ApplicaitonApi from '@/api/application/application'
|
import ApplicaitonApi from '@/api/application/application'
|
||||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
|||||||
@ -939,7 +939,7 @@ function getList(bool?: boolean) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDetail() {
|
function getDetail() {
|
||||||
knowledge.asyncGetDatasetDetail(id, loading).then((res: any) => {
|
knowledge.asyncGetKnowledgeDetail(id, loading).then((res: any) => {
|
||||||
datasetDetail.value = res.data
|
datasetDetail.value = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<div class="mb-16">
|
<div class="mb-16">
|
||||||
<div class="title mb-8">
|
<div class="title mb-8">
|
||||||
{{ $t('views.application.applicationForm.dialog.selectSearchMode') }}
|
{{ $t('views.application.dialog.selectSearchMode') }}
|
||||||
</div>
|
</div>
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-model="cloneForm.search_mode"
|
v-model="cloneForm.search_mode"
|
||||||
@ -105,10 +105,10 @@
|
|||||||
>
|
>
|
||||||
<el-radio value="embedding" size="large">
|
<el-radio value="embedding" size="large">
|
||||||
<p class="mb-4">
|
<p class="mb-4">
|
||||||
{{ $t('views.application.applicationForm.dialog.vectorSearch') }}
|
{{ $t('views.application.dialog.vectorSearch') }}
|
||||||
</p>
|
</p>
|
||||||
<el-text type="info">{{
|
<el-text type="info">{{
|
||||||
$t('views.application.applicationForm.dialog.vectorSearchTooltip')
|
$t('views.application.dialog.vectorSearchTooltip')
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -119,10 +119,10 @@
|
|||||||
>
|
>
|
||||||
<el-radio value="keywords" size="large">
|
<el-radio value="keywords" size="large">
|
||||||
<p class="mb-4">
|
<p class="mb-4">
|
||||||
{{ $t('views.application.applicationForm.dialog.fullTextSearch') }}
|
{{ $t('views.application.dialog.fullTextSearch') }}
|
||||||
</p>
|
</p>
|
||||||
<el-text type="info">{{
|
<el-text type="info">{{
|
||||||
$t('views.application.applicationForm.dialog.fullTextSearchTooltip')
|
$t('views.application.dialog.fullTextSearchTooltip')
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -133,10 +133,10 @@
|
|||||||
>
|
>
|
||||||
<el-radio value="blend" size="large">
|
<el-radio value="blend" size="large">
|
||||||
<p class="mb-4">
|
<p class="mb-4">
|
||||||
{{ $t('views.application.applicationForm.dialog.hybridSearch') }}
|
{{ $t('views.application.dialog.hybridSearch') }}
|
||||||
</p>
|
</p>
|
||||||
<el-text type="info">{{
|
<el-text type="info">{{
|
||||||
$t('views.application.applicationForm.dialog.hybridSearchTooltip')
|
$t('views.application.dialog.hybridSearchTooltip')
|
||||||
}}</el-text>
|
}}</el-text>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -146,7 +146,7 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<div class="mb-16">
|
<div class="mb-16">
|
||||||
<div class="title mb-8">
|
<div class="title mb-8">
|
||||||
{{ $t('views.application.applicationForm.dialog.similarityThreshold') }}
|
{{ $t('views.application.dialog.similarityThreshold') }}
|
||||||
</div>
|
</div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="cloneForm.similarity"
|
v-model="cloneForm.similarity"
|
||||||
@ -163,7 +163,7 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<div class="mb-16">
|
<div class="mb-16">
|
||||||
<div class="title mb-8">
|
<div class="title mb-8">
|
||||||
{{ $t('views.application.applicationForm.dialog.topReferences') }}
|
{{ $t('views.application.dialog.topReferences') }}
|
||||||
</div>
|
</div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="cloneForm.top_number"
|
v-model="cloneForm.top_number"
|
||||||
|
|||||||
@ -169,8 +169,6 @@ const webFormRef = ref()
|
|||||||
const BaseFormRef = ref()
|
const BaseFormRef = ref()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const detail = ref<any>({})
|
const detail = ref<any>({})
|
||||||
const application_list = ref<Array<ApplicationFormType>>([])
|
|
||||||
const application_id_list = ref([])
|
|
||||||
const cloneModelId = ref('')
|
const cloneModelId = ref('')
|
||||||
|
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
@ -217,14 +215,12 @@ async function submit() {
|
|||||||
await webFormRef.value.validate((valid: any) => {
|
await webFormRef.value.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const obj =
|
const obj =
|
||||||
detail.value.type === '1' || detail.value.type === '2'
|
detail.value.type === 1 || detail.value.type === 2
|
||||||
? {
|
? {
|
||||||
application_id_list: application_id_list.value,
|
|
||||||
meta: form.value,
|
meta: form.value,
|
||||||
...BaseFormRef.value.form,
|
...BaseFormRef.value.form,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
application_id_list: application_id_list.value,
|
|
||||||
...BaseFormRef.value.form,
|
...BaseFormRef.value.form,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,14 +230,14 @@ async function submit() {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (detail.value.type === 2) {
|
if (detail.value.type === 2) {
|
||||||
KnowledgeApi.putLarkDataset(id, obj, loading).then((res) => {
|
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||||
KnowledgeApi.putReEmbeddingDataset(id).then(() => {
|
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||||
MsgSuccess(t('common.saveSuccess'))
|
MsgSuccess(t('common.saveSuccess'))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||||
KnowledgeApi.putReEmbeddingDataset(id).then(() => {
|
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||||
MsgSuccess(t('common.saveSuccess'))
|
MsgSuccess(t('common.saveSuccess'))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -250,8 +246,8 @@ async function submit() {
|
|||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
} else {
|
} else {
|
||||||
if (detail.value.type === 2) {
|
if (detail.value.type === 2) {
|
||||||
KnowledgeApi.putLarkDataset(id, obj, loading).then((res) => {
|
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||||
KnowledgeApi.putReEmbeddingDataset(id).then(() => {
|
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||||
MsgSuccess(t('common.saveSuccess'))
|
MsgSuccess(t('common.saveSuccess'))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -267,16 +263,12 @@ async function submit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDetail() {
|
function getDetail() {
|
||||||
knowledge.asyncGetDatasetDetail(id, loading).then((res: any) => {
|
knowledge.asyncGetKnowledgeDetail(id, loading).then((res: any) => {
|
||||||
detail.value = res.data
|
detail.value = res.data
|
||||||
cloneModelId.value = res.data?.embedding_mode_id
|
cloneModelId.value = res.data?.embedding_mode_id
|
||||||
if (detail.value.type === '1' || detail.value.type === '2') {
|
if (detail.value.type === '1' || detail.value.type === '2') {
|
||||||
form.value = res.data.meta
|
form.value = res.data.meta
|
||||||
}
|
}
|
||||||
application_id_list.value = res.data?.application_id_list
|
|
||||||
KnowledgeApi.listUsableApplication(id, loading).then((ok) => {
|
|
||||||
application_list.value = ok.data
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -220,38 +220,41 @@
|
|||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="Refresh"
|
icon="Refresh"
|
||||||
@click.stop="syncDataset(item)"
|
@click.stop="syncKnowledge(item)"
|
||||||
v-if="item.type === 1"
|
v-if="item.type === 1"
|
||||||
>{{ $t('views.knowledge.setting.sync') }}
|
>{{ $t('views.knowledge.setting.sync') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.stop="reEmbeddingDataset(item)">
|
<el-dropdown-item @click.stop="reEmbeddingKnowledge(item)">
|
||||||
<AppIcon iconName="app-vectorization"></AppIcon>
|
<AppIcon iconName="app-vectorization"></AppIcon>
|
||||||
{{ $t('views.knowledge.setting.vectorization') }}
|
{{ $t('views.knowledge.setting.vectorization') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<!--
|
|
||||||
|
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="Connection"
|
icon="Connection"
|
||||||
@click.stop="openGenerateDialog(item)"
|
@click.stop="openGenerateDialog(item)"
|
||||||
>{{ $t('views.document.generateQuestion.title') }}</el-dropdown-item
|
>{{ $t('views.document.generateQuestion.title') }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="Setting"
|
icon="Setting"
|
||||||
@click.stop="router.push({ path: `/dataset/${item.id}/setting` })"
|
@click.stop="
|
||||||
>
|
router.push({
|
||||||
{{ $t('common.setting') }}</el-dropdown-item
|
path: `/knowledge/${item.id}/${currentFolder.value}/setting`,
|
||||||
>
|
})
|
||||||
<el-dropdown-item @click.stop="export_dataset(item)">
|
"
|
||||||
<AppIcon iconName="app-export"></AppIcon
|
>
|
||||||
>{{ $t('views.document.setting.export') }} Excel</el-dropdown-item
|
{{ $t('common.setting') }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item @click.stop="export_zip_dataset(item)">
|
<el-dropdown-item @click.stop="exportKnowledge(item)">
|
||||||
<AppIcon iconName="app-export"></AppIcon
|
<AppIcon iconName="app-export"></AppIcon
|
||||||
>{{ $t('views.document.setting.export') }} ZIP</el-dropdown-item
|
>{{ $t('views.document.setting.export') }} Excel</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item icon="Delete" @click.stop="deleteDataset(item)">{{
|
<el-dropdown-item @click.stop="exportZipKnowledge(item)">
|
||||||
$t('common.delete')
|
<AppIcon iconName="app-export"></AppIcon
|
||||||
}}</el-dropdown-item> -->
|
>{{ $t('views.document.setting.export') }} ZIP</el-dropdown-item
|
||||||
|
>
|
||||||
|
<el-dropdown-item icon="Delete" @click.stop="deleteKnowledge(item)">{{
|
||||||
|
$t('common.delete')
|
||||||
|
}}</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
@ -268,6 +271,7 @@
|
|||||||
|
|
||||||
<component :is="currentCreateDialog" ref="CreateKnowledgeDialogRef" />
|
<component :is="currentCreateDialog" ref="CreateKnowledgeDialogRef" />
|
||||||
<CreateFolderDialog ref="CreateFolderDialogRef" @refresh="refreshFolder" />
|
<CreateFolderDialog ref="CreateFolderDialogRef" @refresh="refreshFolder" />
|
||||||
|
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" />
|
||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -277,6 +281,7 @@ import KnowledgeIcon from '@/views/knowledge/component/KnowledgeIcon.vue'
|
|||||||
import CreateKnowledgeDialog from './create-component/CreateKnowledgeDialog.vue'
|
import CreateKnowledgeDialog from './create-component/CreateKnowledgeDialog.vue'
|
||||||
import CreateWebKnowledgeDialog from './create-component/CreateWebKnowledgeDialog.vue'
|
import CreateWebKnowledgeDialog from './create-component/CreateWebKnowledgeDialog.vue'
|
||||||
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
|
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
|
||||||
|
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
||||||
import KnowledgeApi from '@/api/knowledge/knowledge'
|
import KnowledgeApi from '@/api/knowledge/knowledge'
|
||||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
@ -332,7 +337,7 @@ function openCreateDialog(data: any) {
|
|||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
function reEmbeddingDataset(row: any) {
|
function reEmbeddingKnowledge(row: any) {
|
||||||
KnowledgeApi.putReEmbeddingKnowledge(row.id).then(() => {
|
KnowledgeApi.putReEmbeddingKnowledge(row.id).then(() => {
|
||||||
MsgSuccess(t('common.submitSuccess'))
|
MsgSuccess(t('common.submitSuccess'))
|
||||||
})
|
})
|
||||||
@ -340,7 +345,7 @@ function reEmbeddingDataset(row: any) {
|
|||||||
|
|
||||||
const SyncWebDialogRef = ref()
|
const SyncWebDialogRef = ref()
|
||||||
|
|
||||||
function syncDataset(row: any) {
|
function syncKnowledge(row: any) {
|
||||||
SyncWebDialogRef.value.open(row.id)
|
SyncWebDialogRef.value.open(row.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,6 +385,44 @@ function openCreateFolder() {
|
|||||||
CreateFolderDialogRef.value.open('KNOWLEDGE', currentFolder.value.parent_id)
|
CreateFolderDialogRef.value.open('KNOWLEDGE', currentFolder.value.parent_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||||
|
function openGenerateDialog(row: any) {
|
||||||
|
if (GenerateRelatedDialogRef.value) {
|
||||||
|
GenerateRelatedDialogRef.value.open([], 'dataset', row.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const exportKnowledge = (item: any) => {
|
||||||
|
KnowledgeApi.exportKnowledge(item.name, item.id, loading).then((ok) => {
|
||||||
|
MsgSuccess(t('common.exportSuccess'))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const exportZipKnowledge = (item: any) => {
|
||||||
|
KnowledgeApi.exportZipKnowledge(item.name, item.id, loading).then((ok) => {
|
||||||
|
MsgSuccess(t('common.exportSuccess'))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteKnowledge(row: any) {
|
||||||
|
MsgConfirm(
|
||||||
|
`${t('views.knowledge.delete.confirmTitle')}${row.name} ?`,
|
||||||
|
`${t('views.knowledge.delete.confirmMessage1')} ${row.application_mapping_count} ${t('views.knowledge.delete.confirmMessage2')}`,
|
||||||
|
{
|
||||||
|
confirmButtonText: t('common.confirm'),
|
||||||
|
confirmButtonClass: 'danger'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
KnowledgeApi.delKnowledge(row.id, loading).then(() => {
|
||||||
|
const index = knowledgeList.value.findIndex((v) => v.id === row.id)
|
||||||
|
knowledgeList.value.splice(index, 1)
|
||||||
|
MsgSuccess(t('common.deleteSuccess'))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function refreshFolder() {
|
function refreshFolder() {
|
||||||
getFolder()
|
getFolder()
|
||||||
getList()
|
getList()
|
||||||
|
|||||||
@ -52,7 +52,6 @@
|
|||||||
import { ref, watch, nextTick } from 'vue'
|
import { ref, watch, nextTick } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { cloneDeep, debounce } from 'lodash'
|
import { cloneDeep, debounce } from 'lodash'
|
||||||
|
|
||||||
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 paragraphApi from '@/api/knowledge/paragraph'
|
import paragraphApi from '@/api/knowledge/paragraph'
|
||||||
|
|||||||
@ -120,7 +120,7 @@ const { problem, document } = useStore()
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: { id } // datasetId
|
params: { id }, // datasetId
|
||||||
} = route as any
|
} = route as any
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
@ -147,7 +147,7 @@ const isMul = ref(false)
|
|||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 50,
|
page_size: 50,
|
||||||
total: 0
|
total: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
function mulAssociation() {
|
function mulAssociation() {
|
||||||
@ -155,10 +155,10 @@ function mulAssociation() {
|
|||||||
problem_id_list: currentMulProblemId.value,
|
problem_id_list: currentMulProblemId.value,
|
||||||
paragraph_list: associationParagraph.value.map((item) => ({
|
paragraph_list: associationParagraph.value.map((item) => ({
|
||||||
paragraph_id: item.id,
|
paragraph_id: item.id,
|
||||||
document_id: item.document_id
|
document_id: item.document_id,
|
||||||
}))
|
})),
|
||||||
}
|
}
|
||||||
problemApi.postMulAssociationProblem(id, data, loading).then(() => {
|
problemApi.putMulAssociationProblem(id, data, loading).then(() => {
|
||||||
MsgSuccess(t('views.problem.tip.relatedSuccess'))
|
MsgSuccess(t('views.problem.tip.relatedSuccess'))
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
})
|
})
|
||||||
@ -179,7 +179,7 @@ function associationClick(item: any) {
|
|||||||
item.document_id,
|
item.document_id,
|
||||||
item.id,
|
item.id,
|
||||||
currentProblemId.value as string,
|
currentProblemId.value as string,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getRecord(currentProblemId.value)
|
getRecord(currentProblemId.value)
|
||||||
@ -191,7 +191,7 @@ function associationClick(item: any) {
|
|||||||
item.document_id,
|
item.document_id,
|
||||||
item.id,
|
item.id,
|
||||||
currentProblemId.value as string,
|
currentProblemId.value as string,
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getRecord(currentProblemId.value)
|
getRecord(currentProblemId.value)
|
||||||
@ -229,7 +229,7 @@ function getParagraphList(documentId: string) {
|
|||||||
(documentId || currentDocument.value) as string,
|
(documentId || currentDocument.value) as string,
|
||||||
paginationConfig,
|
paginationConfig,
|
||||||
search.value && { [searchType.value]: search.value },
|
search.value && { [searchType.value]: search.value },
|
||||||
loading
|
loading,
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
paragraphList.value = [...paragraphList.value, ...res.data.records]
|
paragraphList.value = [...paragraphList.value, ...res.data.records]
|
||||||
@ -291,6 +291,35 @@ defineExpose({ open })
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.paragraph-card {
|
.paragraph-card {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
// card 选中样式
|
||||||
|
&.selected {
|
||||||
|
border: 1px solid var(--el-color-primary) !important;
|
||||||
|
&:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
border: 14px solid var(--el-color-primary);
|
||||||
|
border-bottom-color: transparent;
|
||||||
|
border-left-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: '';
|
||||||
|
width: 3px;
|
||||||
|
height: 6px;
|
||||||
|
position: absolute;
|
||||||
|
right: 5px;
|
||||||
|
top: 2px;
|
||||||
|
border: 2px solid #fff;
|
||||||
|
border-top-color: transparent;
|
||||||
|
border-left-color: transparent;
|
||||||
|
transform: rotate(35deg);
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
border: 1px solid var(--el-color-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.paragraph-badge {
|
.paragraph-badge {
|
||||||
.el-badge__content {
|
.el-badge__content {
|
||||||
|
|||||||
@ -6,17 +6,14 @@
|
|||||||
<div class="p-24">
|
<div class="p-24">
|
||||||
<div class="flex-between">
|
<div class="flex-between">
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" @click="createProblem">{{
|
<el-button type="primary" @click="createProblem"
|
||||||
$t('views.problem.createProblem')
|
>{{ $t('views.problem.createProblem') }}
|
||||||
}}
|
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="relateProblem()" :disabled="multipleSelection.length === 0">{{
|
<el-button @click="relateProblem()" :disabled="multipleSelection.length === 0"
|
||||||
$t('views.problem.relateParagraph.title')
|
>{{ $t('views.problem.relateParagraph.title') }}
|
||||||
}}
|
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0">{{
|
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0"
|
||||||
$t('views.problem.setting.batchDelete')
|
>{{ $t('views.problem.setting.batchDelete') }}
|
||||||
}}
|
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -49,7 +46,7 @@
|
|||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:row-key="(row: any) => row.id"
|
:row-key="(row: any) => row.id"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" :reserve-selection="true"/>
|
<el-table-column type="selection" width="55" :reserve-selection="true" />
|
||||||
<el-table-column prop="content" :label="$t('views.problem.title')" min-width="280">
|
<el-table-column prop="content" :label="$t('views.problem.title')" min-width="280">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<ReadWrite
|
<ReadWrite
|
||||||
@ -103,14 +100,14 @@
|
|||||||
placement="top"
|
placement="top"
|
||||||
>
|
>
|
||||||
<el-button type="primary" text @click.stop="relateProblem(row)">
|
<el-button type="primary" text @click.stop="relateProblem(row)">
|
||||||
<el-icon><Connection/></el-icon>
|
<el-icon><Connection /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
||||||
<el-button type="primary" text @click.stop="deleteProblem(row)">
|
<el-button type="primary" text @click.stop="deleteProblem(row)">
|
||||||
<el-icon><Delete/></el-icon>
|
<el-icon><Delete /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
@ -121,7 +118,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<CreateProblemDialog ref="CreateProblemDialogRef" @refresh="refresh"/>
|
<CreateProblemDialog ref="CreateProblemDialogRef" @refresh="refresh" />
|
||||||
<DetailProblemDrawer
|
<DetailProblemDrawer
|
||||||
:next="nextChatRecord"
|
:next="nextChatRecord"
|
||||||
:pre="preChatRecord"
|
:pre="preChatRecord"
|
||||||
@ -132,29 +129,29 @@
|
|||||||
:next_disable="next_disable"
|
:next_disable="next_disable"
|
||||||
@refresh="refreshRelate"
|
@refresh="refreshRelate"
|
||||||
/>
|
/>
|
||||||
<RelateProblemDialog ref="RelateProblemDialogRef" @refresh="refreshRelate"/>
|
<RelateProblemDialog ref="RelateProblemDialogRef" @refresh="refreshRelate" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, onMounted, reactive, onBeforeUnmount, computed} from 'vue'
|
import { ref, onMounted, reactive, onBeforeUnmount, computed } from 'vue'
|
||||||
import {useRouter, useRoute} from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import {ElTable} from 'element-plus'
|
import { ElTable } from 'element-plus'
|
||||||
import problemApi from '@/api/knowledge/problem'
|
import problemApi from '@/api/knowledge/problem'
|
||||||
import CreateProblemDialog from './component/CreateProblemDialog.vue'
|
import CreateProblemDialog from './component/CreateProblemDialog.vue'
|
||||||
import DetailProblemDrawer from './component/DetailProblemDrawer.vue'
|
import DetailProblemDrawer from './component/DetailProblemDrawer.vue'
|
||||||
import RelateProblemDialog from './component/RelateProblemDialog.vue'
|
import RelateProblemDialog from './component/RelateProblemDialog.vue'
|
||||||
import {datetimeFormat} from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
import {MsgSuccess, MsgConfirm, MsgError} from '@/utils/message'
|
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
|
||||||
import type {Dict} from '@/api/type/common'
|
import type { Dict } from '@/api/type/common'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import {t} from '@/locales'
|
import { t } from '@/locales'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: {id}, // 知识库id
|
params: { id }, // 知识库id
|
||||||
} = route as any
|
} = route as any
|
||||||
|
|
||||||
const {problem} = useStore()
|
const { problem } = useStore()
|
||||||
|
|
||||||
const RelateProblemDialogRef = ref()
|
const RelateProblemDialogRef = ref()
|
||||||
const DetailProblemRef = ref()
|
const DetailProblemRef = ref()
|
||||||
@ -180,7 +177,7 @@ const problemIndexMap = computed<Dict<number>>(() => {
|
|||||||
.map((row, index) => ({
|
.map((row, index) => ({
|
||||||
[row.id]: index,
|
[row.id]: index,
|
||||||
}))
|
}))
|
||||||
.reduce((pre, next) => ({...pre, ...next}), {})
|
.reduce((pre, next) => ({ ...pre, ...next }), {})
|
||||||
})
|
})
|
||||||
|
|
||||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
||||||
@ -233,7 +230,7 @@ function deleteMulDocument() {
|
|||||||
arr.push(v.id)
|
arr.push(v.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
problemApi.delMulProblem(id, arr, loading).then(() => {
|
problemApi.putMulProblem(id, arr, loading).then(() => {
|
||||||
MsgSuccess(t('views.document.delete.successMessage'))
|
MsgSuccess(t('views.document.delete.successMessage'))
|
||||||
multipleTableRef.value?.clearSelection()
|
multipleTableRef.value?.clearSelection()
|
||||||
getList()
|
getList()
|
||||||
@ -255,8 +252,7 @@ function deleteProblem(row: any) {
|
|||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function editName(val: string, problemId: string) {
|
function editName(val: string, problemId: string) {
|
||||||
@ -314,7 +310,7 @@ const next_disable = computed(() => {
|
|||||||
return (
|
return (
|
||||||
index >= problemData.value.length &&
|
index >= problemData.value.length &&
|
||||||
index + (paginationConfig.current_page - 1) * paginationConfig.page_size >=
|
index + (paginationConfig.current_page - 1) * paginationConfig.page_size >=
|
||||||
paginationConfig.total - 1
|
paginationConfig.total - 1
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
@ -350,7 +346,7 @@ function rowClickHandle(row: any, column?: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const setRowClass = ({row}: any) => {
|
const setRowClass = ({ row }: any) => {
|
||||||
return currentClickId.value === row?.id ? 'highlight' : ''
|
return currentClickId.value === row?.id ? 'highlight' : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +360,7 @@ function getList() {
|
|||||||
.asyncGetProblem(
|
.asyncGetProblem(
|
||||||
id as string,
|
id as string,
|
||||||
paginationConfig,
|
paginationConfig,
|
||||||
filterText.value && {content: filterText.value},
|
filterText.value && { content: filterText.value },
|
||||||
loading,
|
loading,
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
@ -387,7 +383,6 @@ onMounted(() => {
|
|||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {})
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item :label="$t('views.application.applicationForm.dialog.topReferences')">
|
<el-form-item :label="$t('views.application.form.dialog.topReferences')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="form.top_n"
|
v-model="form.top_n"
|
||||||
:min="1"
|
:min="1"
|
||||||
@ -56,7 +56,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-form-item :label="$t('views.application.applicationForm.dialog.maxCharacters')">
|
<el-form-item :label="$t('views.application.form.dialog.maxCharacters')">
|
||||||
<el-slider
|
<el-slider
|
||||||
v-model="form.max_paragraph_char_number"
|
v-model="form.max_paragraph_char_number"
|
||||||
show-input
|
show-input
|
||||||
|
|||||||
@ -70,7 +70,7 @@
|
|||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12" class="color-secondary lighter">{{
|
<el-col :span="12" class="color-secondary lighter">{{
|
||||||
$t('views.application.applicationForm.dialog.selectSearchMode')
|
$t('views.application.form.dialog.selectSearchMode')
|
||||||
}}</el-col>
|
}}</el-col>
|
||||||
<el-col :span="12" class="lighter">
|
<el-col :span="12" class="lighter">
|
||||||
{{
|
{{
|
||||||
@ -78,17 +78,17 @@
|
|||||||
}}</el-col
|
}}</el-col
|
||||||
>
|
>
|
||||||
<el-col :span="12" class="color-secondary lighter">
|
<el-col :span="12" class="color-secondary lighter">
|
||||||
{{ $t('views.application.applicationForm.dialog.similarityThreshold') }}</el-col
|
{{ $t('views.application.form.dialog.similarityThreshold') }}</el-col
|
||||||
>
|
>
|
||||||
<el-col :span="12" class="lighter">
|
<el-col :span="12" class="lighter">
|
||||||
{{ form_data.dataset_setting.similarity?.toFixed(3) }}</el-col
|
{{ form_data.dataset_setting.similarity?.toFixed(3) }}</el-col
|
||||||
>
|
>
|
||||||
<el-col :span="12" class="color-secondary lighter">{{
|
<el-col :span="12" class="color-secondary lighter">{{
|
||||||
$t('views.application.applicationForm.dialog.topReferences')
|
$t('views.application.form.dialog.topReferences')
|
||||||
}}</el-col>
|
}}</el-col>
|
||||||
<el-col :span="12" class="lighter"> {{ form_data.dataset_setting.top_n }}</el-col>
|
<el-col :span="12" class="lighter"> {{ form_data.dataset_setting.top_n }}</el-col>
|
||||||
<el-col :span="12" class="color-secondary lighter">
|
<el-col :span="12" class="color-secondary lighter">
|
||||||
{{ $t('views.application.applicationForm.dialog.maxCharacters') }}</el-col
|
{{ $t('views.application.form.dialog.maxCharacters') }}</el-col
|
||||||
>
|
>
|
||||||
<el-col :span="12" class="lighter">
|
<el-col :span="12" class="lighter">
|
||||||
{{ form_data.dataset_setting.max_paragraph_char_number }}</el-col
|
{{ form_data.dataset_setting.max_paragraph_char_number }}</el-col
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user