mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: problem
This commit is contained in:
parent
2b097e5c97
commit
b1610a00bf
|
|
@ -160,7 +160,7 @@ const exportKnowledge: (
|
|||
knowledge_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => 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知识库
|
||||
|
|
@ -176,7 +176,7 @@ const exportZipKnowledge: (
|
|||
) => Promise<any> = (knowledge_name, knowledge_id, loading) => {
|
||||
return exportFile(
|
||||
knowledge_name + '.zip',
|
||||
`dataset/${knowledge_id}/export_zip`,
|
||||
`${prefix}/${knowledge_id}/knowledge/${knowledge_id}/export_zip`,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -233,6 +233,17 @@ const generateRelated: (
|
|||
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 {
|
||||
getKnowledgeByFolder,
|
||||
getKnowledgeList,
|
||||
|
|
@ -249,4 +260,5 @@ export default {
|
|||
getLarkDocumentList,
|
||||
importLarkDocument,
|
||||
generateRelated,
|
||||
delKnowledge
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,37 @@ import type { pageRequest } from '@/api/type/common'
|
|||
import type { Ref } from 'vue'
|
||||
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
|
||||
* page {
|
||||
"current_page": "string",
|
||||
"page_size": "string",
|
||||
}
|
||||
"current_page": "string",
|
||||
"page_size": "string",
|
||||
}
|
||||
* param {
|
||||
"title": "string",
|
||||
"content": "string",
|
||||
|
|
@ -21,12 +45,12 @@ const getParagraph: (
|
|||
document_id: string,
|
||||
page: pageRequest,
|
||||
param: any,
|
||||
loading?: Ref<boolean>
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (dataset_id, document_id, page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -38,13 +62,13 @@ const delParagraph: (
|
|||
dataset_id: string,
|
||||
document_id: string,
|
||||
paragraph_id: string,
|
||||
loading?: Ref<boolean>
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, paragraph_id, loading) => {
|
||||
return del(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
||||
undefined,
|
||||
{},
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -56,40 +80,17 @@ const delMulParagraph: (
|
|||
dataset_id: string,
|
||||
document_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => {
|
||||
return del(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/_batch`,
|
||||
undefined,
|
||||
{ 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,
|
||||
paragraph_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, data, loading) => {
|
||||
return put(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`,
|
||||
data,
|
||||
undefined,
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -132,33 +133,35 @@ const putMigrateMulParagraph: (
|
|||
target_dataset_id: string,
|
||||
target_document_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (
|
||||
dataset_id,
|
||||
document_id,
|
||||
target_dataset_id,
|
||||
target_document_id,
|
||||
data,
|
||||
loading
|
||||
loading,
|
||||
) => {
|
||||
return put(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/migrate/dataset/${target_dataset_id}/document/${target_document_id}`,
|
||||
data,
|
||||
undefined,
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 问题列表
|
||||
* @param 参数 dataset_id,document_id,paragraph_id
|
||||
*/
|
||||
const getProblem: (
|
||||
const batchGenerateRelated: (
|
||||
dataset_id: string,
|
||||
document_id: string,
|
||||
paragraph_id: string
|
||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id: string) => {
|
||||
return get(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`)
|
||||
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,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -175,82 +178,23 @@ const postProblem: (
|
|||
document_id: string,
|
||||
paragraph_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, data: any, loading) => {
|
||||
return post(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`,
|
||||
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 {
|
||||
getParagraph,
|
||||
delParagraph,
|
||||
putParagraph,
|
||||
postParagraph,
|
||||
getProblem,
|
||||
postProblem,
|
||||
disassociationProblem,
|
||||
associationProblem,
|
||||
delMulParagraph,
|
||||
putMigrateMulParagraph,
|
||||
batchGenerateRelated
|
||||
batchGenerateRelated,
|
||||
postProblem,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,27 @@
|
|||
import {Result} from '@/request/Result'
|
||||
import {get, post, del, put} from '@/request/index'
|
||||
import type {Ref} from 'vue'
|
||||
import type {KeyValue} from '@/api/type/common'
|
||||
import type {pageRequest} from '@/api/type/common'
|
||||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
import type { Ref } from 'vue'
|
||||
import type { KeyValue } from '@/api/type/common'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
|
||||
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 {
|
||||
"current_page": "string",
|
||||
"page_size": "string",
|
||||
|
|
@ -19,99 +32,87 @@ const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledg
|
|||
*/
|
||||
|
||||
const getProblems: (
|
||||
dataset_id: string,
|
||||
knowledge_id: string,
|
||||
page: pageRequest,
|
||||
param: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (dataset_id, page, param, loading) => {
|
||||
) => Promise<Result<any>> = (knowledge_id, page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${dataset_id}/problem/${page.current_page}/${page.page_size}`,
|
||||
`${prefix}/${knowledge_id}/problem/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
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 参数
|
||||
* dataset_id, problem_id,
|
||||
* knowledge_id, problem_id,
|
||||
* {
|
||||
"content": "string",
|
||||
}
|
||||
*/
|
||||
const putProblems: (
|
||||
dataset_id: string,
|
||||
knowledge_id: string,
|
||||
problem_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (dataset_id, problem_id, data: any, loading) => {
|
||||
return put(`${prefix}/${dataset_id}/problem/${problem_id}`, data, undefined, loading)
|
||||
) => Promise<Result<any>> = (knowledge_id, problem_id, data: any, 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 参数
|
||||
* dataset_id, problem_id,
|
||||
* knowledge_id, problem_id,
|
||||
*/
|
||||
const getDetailProblems: (
|
||||
dataset_id: string,
|
||||
knowledge_id: string,
|
||||
problem_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (dataset_id, problem_id, loading) => {
|
||||
return get(`${prefix}/${dataset_id}/problem/${problem_id}/paragraph`, undefined, loading)
|
||||
) => Promise<Result<any>> = (knowledge_id, problem_id, loading) => {
|
||||
return get(`${prefix}/${knowledge_id}/problem/${problem_id}/paragraph`, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量关联段落
|
||||
* @param 参数 dataset_id,
|
||||
* @param 参数 knowledge_id,
|
||||
* {
|
||||
"problem_id_list": "Array",
|
||||
"paragraph_list": "Array",
|
||||
}
|
||||
"problem_id_list": "Array",
|
||||
"paragraph_list": "Array",
|
||||
}
|
||||
*/
|
||||
const postMulAssociationProblem: (
|
||||
dataset_id: string,
|
||||
const putMulAssociationProblem: (
|
||||
knowledge_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
|
||||
return post(`${prefix}/${dataset_id}/problem/_batch`, data, undefined, loading)
|
||||
) => Promise<Result<boolean>> = (knowledge_id, data, 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 {
|
||||
|
|
@ -120,6 +121,6 @@ export default {
|
|||
delProblems,
|
||||
putProblems,
|
||||
getDetailProblems,
|
||||
delMulProblem,
|
||||
postMulAssociationProblem,
|
||||
putMulProblem,
|
||||
putMulAssociationProblem,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export enum SearchMode {
|
||||
embedding = 'views.application.applicationForm.dialog.vectorSearch',
|
||||
keywords = 'views.application.applicationForm.dialog.fullTextSearch',
|
||||
blend = 'views.application.applicationForm.dialog.hybridSearch'
|
||||
embedding = 'views.application.form.dialog.vectorSearch',
|
||||
keywords = 'views.application.form.dialog.fullTextSearch',
|
||||
blend = 'views.application.form.dialog.hybridSearch'
|
||||
}
|
||||
|
||||
export enum WorkflowType {
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ const menuIcon = computed(() => {
|
|||
font-weight: 500;
|
||||
border-radius: 4px;
|
||||
&:hover {
|
||||
background: none;
|
||||
color: var(--el-color-primary);
|
||||
background: var(--app-text-color-light-1);
|
||||
color: var(--el-menu-text-color);
|
||||
}
|
||||
}
|
||||
:deep(.el-sub-menu__title) {
|
||||
|
|
|
|||
|
|
@ -49,13 +49,6 @@ const activeMenu = computed(() => {
|
|||
height: 100%;
|
||||
border: none;
|
||||
background: none;
|
||||
.el-menu-item {
|
||||
&:hover {
|
||||
background: var(--app-text-color-light-1);
|
||||
color: var(--el-menu-text-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import useModelStore from './modules/model'
|
|||
import usePromptStore from './modules/prompt'
|
||||
import useProblemStore from './modules/problem'
|
||||
import useParagraphStore from './modules/paragraph'
|
||||
import useDocumentStore from './modules/document'
|
||||
|
||||
const useStore = () => ({
|
||||
common: useCommonStore(),
|
||||
|
|
@ -20,6 +21,7 @@ const useStore = () => ({
|
|||
prompt: usePromptStore(),
|
||||
problem: useProblemStore(),
|
||||
paragraph: useParagraphStore(),
|
||||
document: useDocumentStore(),
|
||||
})
|
||||
|
||||
export default useStore
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
loading?: Ref<boolean>,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -450,6 +450,12 @@ h5 {
|
|||
border-color: #d6e2ff;
|
||||
}
|
||||
|
||||
// 蓝色提示框
|
||||
.update-info {
|
||||
background: #d6e2ff;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
/*
|
||||
内容部分 自适应高度
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -121,3 +121,32 @@
|
|||
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-border-radius: 6px;
|
||||
box-shadow: 0px 2px 4px 0px rgba(31, 35, 41, 0.12) !important;
|
||||
border: none;
|
||||
&.is-never-shadow {
|
||||
border: 1px solid var(--el-card-border-color);
|
||||
box-shadow: none !important;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
{{ $t('common.setting') }}
|
||||
</h3>
|
||||
<el-button type="primary" @click="submit(applicationFormRef)" :disabled="loading">
|
||||
{{ $t('views.application.applicationForm.buttons.publish') }}
|
||||
{{ $t('views.application.form.buttons.publish') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -427,7 +427,7 @@
|
|||
</el-col>
|
||||
<el-col :span="14" class="p-24 border-l">
|
||||
<h4 class="title-decoration-1 mb-16">
|
||||
{{ $t('views.application.applicationForm.title.appTest') }}
|
||||
{{ $t('views.application.form.title.appTest') }}
|
||||
</h4>
|
||||
<div class="dialog-bg">
|
||||
<div class="flex align-center p-16 mb-8">
|
||||
|
|
@ -524,11 +524,11 @@ const defaultPrompt = t('views.application.form.prompt.defaultPrompt', {
|
|||
})
|
||||
|
||||
const optimizationPrompt =
|
||||
t('views.application.applicationForm.dialog.defaultPrompt1', {
|
||||
t('views.application.form.dialog.defaultPrompt1', {
|
||||
question: '{question}'
|
||||
}) +
|
||||
'<data></data>' +
|
||||
t('views.application.applicationForm.dialog.defaultPrompt2')
|
||||
t('views.application.form.dialog.defaultPrompt2')
|
||||
|
||||
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
|
||||
const ReasoningParamSettingDialogRef = ref<InstanceType<typeof ReasoningParamSettingDialog>>()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="$t('views.application.applicationForm.dialog.addDataset')"
|
||||
:title="$t('views.application.form.dialog.addDataset')"
|
||||
v-model="dialogVisible"
|
||||
width="600"
|
||||
append-to-body
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<template #header="{ titleId, titleClass }">
|
||||
<div class="flex-between mb-8">
|
||||
<h4 :id="titleId" :class="titleClass">
|
||||
{{ $t('views.application.applicationForm.dialog.addDataset') }}
|
||||
{{ $t('views.application.form.dialog.addDataset') }}
|
||||
</h4>
|
||||
<div class="flex align-center mr-8">
|
||||
<el-button link class="ml-16" @click="refresh">
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
<div class="flex-between">
|
||||
<el-text type="info" class="color-secondary">
|
||||
{{ $t('views.application.applicationForm.dialog.addDatasetPlaceholder') }}
|
||||
{{ $t('views.application.form.dialog.addDatasetPlaceholder') }}
|
||||
</el-text>
|
||||
<el-input
|
||||
v-model="searchValue"
|
||||
|
|
@ -49,8 +49,8 @@
|
|||
<div class="flex-between">
|
||||
<div class="flex">
|
||||
<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.applicationForm.dialog.countDataset') }}
|
||||
{{ $t('views.application.form.dialog.selected') }} {{ checkList.length }}
|
||||
{{ $t('views.application.form.dialog.countDataset') }}
|
||||
</el-text>
|
||||
<el-button link type="primary" v-if="checkList.length > 0" @click="clearCheck">
|
||||
{{ $t('common.clear') }}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ watch(dialogVisible, (bool) => {
|
|||
const open = (data: any) => {
|
||||
const obj = cloneDeep(data)
|
||||
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
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<el-scrollbar max-height="550">
|
||||
<div class="p-16">
|
||||
<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
|
||||
v-model="form.dataset_setting.search_mode"
|
||||
class="card__radio"
|
||||
|
|
@ -25,10 +25,10 @@
|
|||
>
|
||||
<el-radio value="embedding" size="large">
|
||||
<p class="mb-4">
|
||||
{{ $t('views.application.applicationForm.dialog.vectorSearch') }}
|
||||
{{ $t('views.application.dialog.vectorSearch') }}
|
||||
</p>
|
||||
<el-text type="info">{{
|
||||
$t('views.application.applicationForm.dialog.vectorSearchTooltip')
|
||||
$t('views.application.dialog.vectorSearchTooltip')
|
||||
}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
|
@ -39,10 +39,10 @@
|
|||
>
|
||||
<el-radio value="keywords" size="large">
|
||||
<p class="mb-4">
|
||||
{{ $t('views.application.applicationForm.dialog.fullTextSearch') }}
|
||||
{{ $t('views.application.dialog.fullTextSearch') }}
|
||||
</p>
|
||||
<el-text type="info">{{
|
||||
$t('views.application.applicationForm.dialog.fullTextSearchTooltip')
|
||||
$t('views.application.dialog.fullTextSearchTooltip')
|
||||
}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
|
@ -52,10 +52,10 @@
|
|||
>
|
||||
<el-radio value="blend" size="large">
|
||||
<p class="mb-4">
|
||||
{{ $t('views.application.applicationForm.dialog.hybridSearch') }}
|
||||
{{ $t('views.application.dialog.hybridSearch') }}
|
||||
</p>
|
||||
<el-text type="info">{{
|
||||
$t('views.application.applicationForm.dialog.hybridSearchTooltip')
|
||||
$t('views.application.dialog.hybridSearchTooltip')
|
||||
}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
|
@ -67,11 +67,11 @@
|
|||
<template #label>
|
||||
<div class="flex align-center">
|
||||
<span class="mr-4">{{
|
||||
$t('views.application.applicationForm.dialog.similarityThreshold')
|
||||
$t('views.application.dialog.similarityThreshold')
|
||||
}}</span>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="$t('views.application.applicationForm.dialog.similarityTooltip')"
|
||||
:content="$t('views.application.dialog.similarityTooltip')"
|
||||
placement="right"
|
||||
>
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<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
|
||||
v-model="form.dataset_setting.top_n"
|
||||
:min="1"
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item :label="$t('views.application.applicationForm.dialog.maxCharacters')">
|
||||
<el-form-item :label="$t('views.application.dialog.maxCharacters')">
|
||||
<el-slider
|
||||
v-model="form.dataset_setting.max_paragraph_char_number"
|
||||
show-input
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
|
||||
<el-form-item
|
||||
v-if="!isWorkflowType"
|
||||
:label="$t('views.application.applicationForm.dialog.noReferencesAction')"
|
||||
:label="$t('views.application.dialog.noReferencesAction')"
|
||||
>
|
||||
<el-form
|
||||
label-position="top"
|
||||
|
|
@ -133,12 +133,12 @@
|
|||
>
|
||||
<el-radio value="ai_questioning">
|
||||
<p>
|
||||
{{ $t('views.application.applicationForm.dialog.continueQuestioning') }}
|
||||
{{ $t('views.application.dialog.continueQuestioning') }}
|
||||
</p>
|
||||
</el-radio>
|
||||
|
||||
<el-radio value="designated_answer">
|
||||
<p>{{ $t('views.application.applicationForm.dialog.provideAnswer') }}</p>
|
||||
<p>{{ $t('views.application.dialog.provideAnswer') }}</p>
|
||||
<el-form-item
|
||||
v-if="form.dataset_setting.no_references_setting.status === 'designated_answer'"
|
||||
prop="designated_answer"
|
||||
|
|
@ -205,15 +205,15 @@ const noReferencesformRef = ref()
|
|||
const defaultValue = {
|
||||
ai_questioning: '{question}',
|
||||
// @ts-ignore
|
||||
designated_answer: t('views.application.applicationForm.dialog.designated_answer')
|
||||
designated_answer: t('views.application.dialog.designated_answer')
|
||||
}
|
||||
|
||||
const defaultPrompt =
|
||||
t('views.application.applicationForm.dialog.defaultPrompt1', {
|
||||
t('views.application.dialog.defaultPrompt1', {
|
||||
question: '{question}'
|
||||
}) +
|
||||
'<data></data>' +
|
||||
t('views.application.applicationForm.dialog.defaultPrompt2')
|
||||
t('views.application.dialog.defaultPrompt2')
|
||||
|
||||
const form = ref<any>({
|
||||
dataset_setting: {
|
||||
|
|
|
|||
|
|
@ -250,6 +250,7 @@
|
|||
<script lang="ts" setup>
|
||||
import {onMounted, ref, reactive, computed} from '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 {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
import useStore from '@/stores'
|
||||
|
|
|
|||
|
|
@ -939,7 +939,7 @@ function getList(bool?: boolean) {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
knowledge.asyncGetDatasetDetail(id, loading).then((res: any) => {
|
||||
knowledge.asyncGetKnowledgeDetail(id, loading).then((res: any) => {
|
||||
datasetDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
</template>
|
||||
<div class="mb-16">
|
||||
<div class="title mb-8">
|
||||
{{ $t('views.application.applicationForm.dialog.selectSearchMode') }}
|
||||
{{ $t('views.application.dialog.selectSearchMode') }}
|
||||
</div>
|
||||
<el-radio-group
|
||||
v-model="cloneForm.search_mode"
|
||||
|
|
@ -105,10 +105,10 @@
|
|||
>
|
||||
<el-radio value="embedding" size="large">
|
||||
<p class="mb-4">
|
||||
{{ $t('views.application.applicationForm.dialog.vectorSearch') }}
|
||||
{{ $t('views.application.dialog.vectorSearch') }}
|
||||
</p>
|
||||
<el-text type="info">{{
|
||||
$t('views.application.applicationForm.dialog.vectorSearchTooltip')
|
||||
$t('views.application.dialog.vectorSearchTooltip')
|
||||
}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
|
@ -119,10 +119,10 @@
|
|||
>
|
||||
<el-radio value="keywords" size="large">
|
||||
<p class="mb-4">
|
||||
{{ $t('views.application.applicationForm.dialog.fullTextSearch') }}
|
||||
{{ $t('views.application.dialog.fullTextSearch') }}
|
||||
</p>
|
||||
<el-text type="info">{{
|
||||
$t('views.application.applicationForm.dialog.fullTextSearchTooltip')
|
||||
$t('views.application.dialog.fullTextSearchTooltip')
|
||||
}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
|
@ -133,10 +133,10 @@
|
|||
>
|
||||
<el-radio value="blend" size="large">
|
||||
<p class="mb-4">
|
||||
{{ $t('views.application.applicationForm.dialog.hybridSearch') }}
|
||||
{{ $t('views.application.dialog.hybridSearch') }}
|
||||
</p>
|
||||
<el-text type="info">{{
|
||||
$t('views.application.applicationForm.dialog.hybridSearchTooltip')
|
||||
$t('views.application.dialog.hybridSearchTooltip')
|
||||
}}</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
|
@ -146,7 +146,7 @@
|
|||
<el-col :span="12">
|
||||
<div class="mb-16">
|
||||
<div class="title mb-8">
|
||||
{{ $t('views.application.applicationForm.dialog.similarityThreshold') }}
|
||||
{{ $t('views.application.dialog.similarityThreshold') }}
|
||||
</div>
|
||||
<el-input-number
|
||||
v-model="cloneForm.similarity"
|
||||
|
|
@ -163,7 +163,7 @@
|
|||
<el-col :span="12">
|
||||
<div class="mb-16">
|
||||
<div class="title mb-8">
|
||||
{{ $t('views.application.applicationForm.dialog.topReferences') }}
|
||||
{{ $t('views.application.dialog.topReferences') }}
|
||||
</div>
|
||||
<el-input-number
|
||||
v-model="cloneForm.top_number"
|
||||
|
|
|
|||
|
|
@ -169,8 +169,6 @@ const webFormRef = ref()
|
|||
const BaseFormRef = ref()
|
||||
const loading = ref(false)
|
||||
const detail = ref<any>({})
|
||||
const application_list = ref<Array<ApplicationFormType>>([])
|
||||
const application_id_list = ref([])
|
||||
const cloneModelId = ref('')
|
||||
|
||||
const form = ref<any>({
|
||||
|
|
@ -217,14 +215,12 @@ async function submit() {
|
|||
await webFormRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
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,
|
||||
...BaseFormRef.value.form,
|
||||
}
|
||||
: {
|
||||
application_id_list: application_id_list.value,
|
||||
...BaseFormRef.value.form,
|
||||
}
|
||||
|
||||
|
|
@ -234,14 +230,14 @@ async function submit() {
|
|||
})
|
||||
.then(() => {
|
||||
if (detail.value.type === 2) {
|
||||
KnowledgeApi.putLarkDataset(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingDataset(id).then(() => {
|
||||
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
} else {
|
||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingDataset(id).then(() => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
|
|
@ -250,8 +246,8 @@ async function submit() {
|
|||
.catch(() => {})
|
||||
} else {
|
||||
if (detail.value.type === 2) {
|
||||
KnowledgeApi.putLarkDataset(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingDataset(id).then(() => {
|
||||
KnowledgeApi.putLarkKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
|
|
@ -267,16 +263,12 @@ async function submit() {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
knowledge.asyncGetDatasetDetail(id, loading).then((res: any) => {
|
||||
knowledge.asyncGetKnowledgeDetail(id, loading).then((res: any) => {
|
||||
detail.value = res.data
|
||||
cloneModelId.value = res.data?.embedding_mode_id
|
||||
if (detail.value.type === '1' || detail.value.type === '2') {
|
||||
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-item
|
||||
icon="Refresh"
|
||||
@click.stop="syncDataset(item)"
|
||||
@click.stop="syncKnowledge(item)"
|
||||
v-if="item.type === 1"
|
||||
>{{ $t('views.knowledge.setting.sync') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.stop="reEmbeddingDataset(item)">
|
||||
<el-dropdown-item @click.stop="reEmbeddingKnowledge(item)">
|
||||
<AppIcon iconName="app-vectorization"></AppIcon>
|
||||
{{ $t('views.knowledge.setting.vectorization') }}
|
||||
</el-dropdown-item>
|
||||
<!--
|
||||
|
||||
<el-dropdown-item
|
||||
icon="Connection"
|
||||
@click.stop="openGenerateDialog(item)"
|
||||
>{{ $t('views.document.generateQuestion.title') }}</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
icon="Setting"
|
||||
@click.stop="router.push({ path: `/dataset/${item.id}/setting` })"
|
||||
>
|
||||
{{ $t('common.setting') }}</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click.stop="export_dataset(item)">
|
||||
<AppIcon iconName="app-export"></AppIcon
|
||||
>{{ $t('views.document.setting.export') }} Excel</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click.stop="export_zip_dataset(item)">
|
||||
<AppIcon iconName="app-export"></AppIcon
|
||||
>{{ $t('views.document.setting.export') }} ZIP</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item icon="Delete" @click.stop="deleteDataset(item)">{{
|
||||
$t('common.delete')
|
||||
}}</el-dropdown-item> -->
|
||||
<el-dropdown-item
|
||||
icon="Connection"
|
||||
@click.stop="openGenerateDialog(item)"
|
||||
>{{ $t('views.document.generateQuestion.title') }}</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
icon="Setting"
|
||||
@click.stop="
|
||||
router.push({
|
||||
path: `/knowledge/${item.id}/${currentFolder.value}/setting`,
|
||||
})
|
||||
"
|
||||
>
|
||||
{{ $t('common.setting') }}</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click.stop="exportKnowledge(item)">
|
||||
<AppIcon iconName="app-export"></AppIcon
|
||||
>{{ $t('views.document.setting.export') }} Excel</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click.stop="exportZipKnowledge(item)">
|
||||
<AppIcon iconName="app-export"></AppIcon
|
||||
>{{ $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>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
|
@ -268,6 +271,7 @@
|
|||
|
||||
<component :is="currentCreateDialog" ref="CreateKnowledgeDialogRef" />
|
||||
<CreateFolderDialog ref="CreateFolderDialogRef" @refresh="refreshFolder" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" />
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
|
||||
|
|
@ -277,6 +281,7 @@ import KnowledgeIcon from '@/views/knowledge/component/KnowledgeIcon.vue'
|
|||
import CreateKnowledgeDialog from './create-component/CreateKnowledgeDialog.vue'
|
||||
import CreateWebKnowledgeDialog from './create-component/CreateWebKnowledgeDialog.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 { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
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(() => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
})
|
||||
|
|
@ -340,7 +345,7 @@ function reEmbeddingDataset(row: any) {
|
|||
|
||||
const SyncWebDialogRef = ref()
|
||||
|
||||
function syncDataset(row: any) {
|
||||
function syncKnowledge(row: any) {
|
||||
SyncWebDialogRef.value.open(row.id)
|
||||
}
|
||||
|
||||
|
|
@ -380,6 +385,44 @@ function openCreateFolder() {
|
|||
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() {
|
||||
getFolder()
|
||||
getList()
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@
|
|||
import { ref, watch, nextTick } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { cloneDeep, debounce } from 'lodash'
|
||||
|
||||
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
||||
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
||||
import paragraphApi from '@/api/knowledge/paragraph'
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ const { problem, document } = useStore()
|
|||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id } // datasetId
|
||||
params: { id }, // datasetId
|
||||
} = route as any
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
|
@ -147,7 +147,7 @@ const isMul = ref(false)
|
|||
const paginationConfig = reactive({
|
||||
current_page: 1,
|
||||
page_size: 50,
|
||||
total: 0
|
||||
total: 0,
|
||||
})
|
||||
|
||||
function mulAssociation() {
|
||||
|
|
@ -155,10 +155,10 @@ function mulAssociation() {
|
|||
problem_id_list: currentMulProblemId.value,
|
||||
paragraph_list: associationParagraph.value.map((item) => ({
|
||||
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'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
|
|
@ -179,7 +179,7 @@ function associationClick(item: any) {
|
|||
item.document_id,
|
||||
item.id,
|
||||
currentProblemId.value as string,
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
.then(() => {
|
||||
getRecord(currentProblemId.value)
|
||||
|
|
@ -191,7 +191,7 @@ function associationClick(item: any) {
|
|||
item.document_id,
|
||||
item.id,
|
||||
currentProblemId.value as string,
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
.then(() => {
|
||||
getRecord(currentProblemId.value)
|
||||
|
|
@ -229,7 +229,7 @@ function getParagraphList(documentId: string) {
|
|||
(documentId || currentDocument.value) as string,
|
||||
paginationConfig,
|
||||
search.value && { [searchType.value]: search.value },
|
||||
loading
|
||||
loading,
|
||||
)
|
||||
.then((res) => {
|
||||
paragraphList.value = [...paragraphList.value, ...res.data.records]
|
||||
|
|
@ -291,6 +291,35 @@ defineExpose({ open })
|
|||
<style lang="scss" scoped>
|
||||
.paragraph-card {
|
||||
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 {
|
||||
.el-badge__content {
|
||||
|
|
|
|||
|
|
@ -6,17 +6,14 @@
|
|||
<div class="p-24">
|
||||
<div class="flex-between">
|
||||
<div>
|
||||
<el-button type="primary" @click="createProblem">{{
|
||||
$t('views.problem.createProblem')
|
||||
}}
|
||||
<el-button type="primary" @click="createProblem"
|
||||
>{{ $t('views.problem.createProblem') }}
|
||||
</el-button>
|
||||
<el-button @click="relateProblem()" :disabled="multipleSelection.length === 0">{{
|
||||
$t('views.problem.relateParagraph.title')
|
||||
}}
|
||||
<el-button @click="relateProblem()" :disabled="multipleSelection.length === 0"
|
||||
>{{ $t('views.problem.relateParagraph.title') }}
|
||||
</el-button>
|
||||
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0">{{
|
||||
$t('views.problem.setting.batchDelete')
|
||||
}}
|
||||
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0"
|
||||
>{{ $t('views.problem.setting.batchDelete') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
|
|
@ -49,7 +46,7 @@
|
|||
v-loading="loading"
|
||||
: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">
|
||||
<template #default="{ row }">
|
||||
<ReadWrite
|
||||
|
|
@ -103,14 +100,14 @@
|
|||
placement="top"
|
||||
>
|
||||
<el-button type="primary" text @click.stop="relateProblem(row)">
|
||||
<el-icon><Connection/></el-icon>
|
||||
<el-icon><Connection /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span>
|
||||
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
||||
<el-button type="primary" text @click.stop="deleteProblem(row)">
|
||||
<el-icon><Delete/></el-icon>
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
|
|
@ -121,7 +118,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<CreateProblemDialog ref="CreateProblemDialogRef" @refresh="refresh"/>
|
||||
<CreateProblemDialog ref="CreateProblemDialogRef" @refresh="refresh" />
|
||||
<DetailProblemDrawer
|
||||
:next="nextChatRecord"
|
||||
:pre="preChatRecord"
|
||||
|
|
@ -132,29 +129,29 @@
|
|||
:next_disable="next_disable"
|
||||
@refresh="refreshRelate"
|
||||
/>
|
||||
<RelateProblemDialog ref="RelateProblemDialogRef" @refresh="refreshRelate"/>
|
||||
<RelateProblemDialog ref="RelateProblemDialogRef" @refresh="refreshRelate" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref, onMounted, reactive, onBeforeUnmount, computed} from 'vue'
|
||||
import {useRouter, useRoute} from 'vue-router'
|
||||
import {ElTable} from 'element-plus'
|
||||
import { ref, onMounted, reactive, onBeforeUnmount, computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { ElTable } from 'element-plus'
|
||||
import problemApi from '@/api/knowledge/problem'
|
||||
import CreateProblemDialog from './component/CreateProblemDialog.vue'
|
||||
import DetailProblemDrawer from './component/DetailProblemDrawer.vue'
|
||||
import RelateProblemDialog from './component/RelateProblemDialog.vue'
|
||||
import {datetimeFormat} from '@/utils/time'
|
||||
import {MsgSuccess, MsgConfirm, MsgError} from '@/utils/message'
|
||||
import type {Dict} from '@/api/type/common'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
|
||||
import type { Dict } from '@/api/type/common'
|
||||
import useStore from '@/stores'
|
||||
import {t} from '@/locales'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: {id}, // 知识库id
|
||||
params: { id }, // 知识库id
|
||||
} = route as any
|
||||
|
||||
const {problem} = useStore()
|
||||
const { problem } = useStore()
|
||||
|
||||
const RelateProblemDialogRef = ref()
|
||||
const DetailProblemRef = ref()
|
||||
|
|
@ -180,7 +177,7 @@ const problemIndexMap = computed<Dict<number>>(() => {
|
|||
.map((row, index) => ({
|
||||
[row.id]: index,
|
||||
}))
|
||||
.reduce((pre, next) => ({...pre, ...next}), {})
|
||||
.reduce((pre, next) => ({ ...pre, ...next }), {})
|
||||
})
|
||||
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
||||
|
|
@ -233,7 +230,7 @@ function deleteMulDocument() {
|
|||
arr.push(v.id)
|
||||
}
|
||||
})
|
||||
problemApi.delMulProblem(id, arr, loading).then(() => {
|
||||
problemApi.putMulProblem(id, arr, loading).then(() => {
|
||||
MsgSuccess(t('views.document.delete.successMessage'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
getList()
|
||||
|
|
@ -255,8 +252,7 @@ function deleteProblem(row: any) {
|
|||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
function editName(val: string, problemId: string) {
|
||||
|
|
@ -314,7 +310,7 @@ const next_disable = computed(() => {
|
|||
return (
|
||||
index >= problemData.value.length &&
|
||||
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' : ''
|
||||
}
|
||||
|
||||
|
|
@ -364,7 +360,7 @@ function getList() {
|
|||
.asyncGetProblem(
|
||||
id as string,
|
||||
paginationConfig,
|
||||
filterText.value && {content: filterText.value},
|
||||
filterText.value && { content: filterText.value },
|
||||
loading,
|
||||
)
|
||||
.then((res: any) => {
|
||||
|
|
@ -387,7 +383,6 @@ onMounted(() => {
|
|||
getList()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
})
|
||||
onBeforeUnmount(() => {})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<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
|
||||
v-model="form.top_n"
|
||||
:min="1"
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item :label="$t('views.application.applicationForm.dialog.maxCharacters')">
|
||||
<el-form-item :label="$t('views.application.form.dialog.maxCharacters')">
|
||||
<el-slider
|
||||
v-model="form.max_paragraph_char_number"
|
||||
show-input
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
<div class="w-full">
|
||||
<el-row>
|
||||
<el-col :span="12" class="color-secondary lighter">{{
|
||||
$t('views.application.applicationForm.dialog.selectSearchMode')
|
||||
$t('views.application.form.dialog.selectSearchMode')
|
||||
}}</el-col>
|
||||
<el-col :span="12" class="lighter">
|
||||
{{
|
||||
|
|
@ -78,17 +78,17 @@
|
|||
}}</el-col
|
||||
>
|
||||
<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">
|
||||
{{ form_data.dataset_setting.similarity?.toFixed(3) }}</el-col
|
||||
>
|
||||
<el-col :span="12" class="color-secondary lighter">{{
|
||||
$t('views.application.applicationForm.dialog.topReferences')
|
||||
$t('views.application.form.dialog.topReferences')
|
||||
}}</el-col>
|
||||
<el-col :span="12" class="lighter"> {{ form_data.dataset_setting.top_n }}</el-col>
|
||||
<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">
|
||||
{{ form_data.dataset_setting.max_paragraph_char_number }}</el-col
|
||||
|
|
|
|||
Loading…
Reference in New Issue