mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: ui
This commit is contained in:
parent
e9d7decef8
commit
9c205048d4
|
|
@ -1,17 +1,17 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, postStream, del, put, request, download, exportFile } from '@/request/index'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
import type { ApplicationFormType } from '@/api/type/application'
|
||||
import { type Ref } from 'vue'
|
||||
import type { FormField } from '@/components/dynamics-form/type'
|
||||
import {Result} from '@/request/Result'
|
||||
import {get, post, postStream, del, put, request, download, exportFile} from '@/request/index'
|
||||
import type {pageRequest} from '@/api/type/common'
|
||||
import type {ApplicationFormType} from '@/api/type/application'
|
||||
import {type Ref} from 'vue'
|
||||
import type {FormField} from '@/components/dynamics-form/type'
|
||||
|
||||
const prefix = '/workspace'
|
||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/application'
|
||||
|
||||
/**
|
||||
* 获取全部应用
|
||||
* @param 参数
|
||||
*/
|
||||
const getAllAppilcation: () => Promise<Result<any[]>> = () => {
|
||||
const getAllApplication: () => Promise<Result<any[]>> = () => {
|
||||
return get(`${prefix}`)
|
||||
}
|
||||
|
||||
|
|
@ -22,13 +22,12 @@ const getAllAppilcation: () => Promise<Result<any[]>> = () => {
|
|||
}
|
||||
*/
|
||||
const getApplication: (
|
||||
wordspace_id: string,
|
||||
page: pageRequest,
|
||||
param: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, page, param, loading) => {
|
||||
) => Promise<Result<any>> = (page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${wordspace_id}/application/${page.current_page}/${page.page_size}`,
|
||||
`${prefix}/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -39,11 +38,10 @@ const getApplication: (
|
|||
* @param 参数
|
||||
*/
|
||||
const postApplication: (
|
||||
wordspace_id: string,
|
||||
data: ApplicationFormType,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, data, loading) => {
|
||||
return post(`${prefix}/${wordspace_id}/application`, data, undefined, loading)
|
||||
) => Promise<Result<any>> = (data, loading) => {
|
||||
return post(`${prefix}`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,7 +129,7 @@ const postAppAuthentication: (
|
|||
) => Promise<any> = (access_token, loading, authentication_value) => {
|
||||
return post(
|
||||
`${prefix}/authentication`,
|
||||
{ access_token: access_token, authentication_value },
|
||||
{access_token: access_token, authentication_value},
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -257,7 +255,7 @@ const getApplicationRerankerModel: (
|
|||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'RERANKER' }, loading)
|
||||
return get(`${prefix}/${application_id}/model`, {model_type: 'RERANKER'}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -271,7 +269,7 @@ const getApplicationSTTModel: (
|
|||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'STT' }, loading)
|
||||
return get(`${prefix}/${application_id}/model`, {model_type: 'STT'}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -285,21 +283,21 @@ const getApplicationTTSModel: (
|
|||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'TTS' }, loading)
|
||||
return get(`${prefix}/${application_id}/model`, {model_type: 'TTS'}, loading)
|
||||
}
|
||||
|
||||
const getApplicationImageModel: (
|
||||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'IMAGE' }, loading)
|
||||
return get(`${prefix}/${application_id}/model`, {model_type: 'IMAGE'}, loading)
|
||||
}
|
||||
|
||||
const getApplicationTTIModel: (
|
||||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'TTI' }, loading)
|
||||
return get(`${prefix}/${application_id}/model`, {model_type: 'TTI'}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -542,7 +540,7 @@ const importApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<a
|
|||
return post(`${prefix}/import`, data, undefined, loading)
|
||||
}
|
||||
export default {
|
||||
getAllAppilcation,
|
||||
getAllAppilcation: getAllApplication,
|
||||
getApplication,
|
||||
postApplication,
|
||||
putApplication,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
import { type Ref } from 'vue'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
const prefix = '/workspace'
|
||||
import {Result} from '@/request/Result'
|
||||
import {get, post, del, put} from '@/request/index'
|
||||
import {type Ref} from 'vue'
|
||||
import type {pageRequest} from '@/api/type/common'
|
||||
|
||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id')
|
||||
|
||||
/**
|
||||
* 获得文件夹列表
|
||||
|
|
@ -11,31 +12,29 @@ const prefix = '/workspace'
|
|||
* data : {name: string}
|
||||
*/
|
||||
const getFolder: (
|
||||
wordspace_id: string,
|
||||
source: string,
|
||||
data?: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (wordspace_id, source, data, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/${source}/folder`, data, loading)
|
||||
) => Promise<Result<Array<any>>> = (source, data, loading) => {
|
||||
return get(`${prefix}/${source}/folder`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文件夹
|
||||
* @params 参数
|
||||
* source : APPLICATION, KNOWLEDGE, TOOL
|
||||
{
|
||||
"name": "string",
|
||||
"desc": "string",
|
||||
"parent_id": "root"
|
||||
}
|
||||
{
|
||||
"name": "string",
|
||||
"desc": "string",
|
||||
"parent_id": "root"
|
||||
}
|
||||
*/
|
||||
const postFolder: (
|
||||
wordspace_id: string,
|
||||
source: string,
|
||||
data?: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (wordspace_id, source, data, loading) => {
|
||||
return post(`${prefix}/${wordspace_id}/${source}/folder`, data, loading)
|
||||
) => Promise<Result<Array<any>>> = (source, data, loading) => {
|
||||
return post(`${prefix}/${source}/folder`, data, loading)
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put, exportExcel, exportFile } 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, exportExcel, exportFile} 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'
|
||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledge'
|
||||
|
||||
/**
|
||||
* 文档分页列表
|
||||
|
|
@ -19,14 +19,13 @@ const prefix = '/workspace'
|
|||
*/
|
||||
|
||||
const getDocument: (
|
||||
wordspace_id: string,
|
||||
knowledge_id: string,
|
||||
page: pageRequest,
|
||||
param: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, knowledge_id, page, param, loading) => {
|
||||
) => Promise<Result<any>> = (knowledge_id, page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${wordspace_id}/knowledge/${knowledge_id}/document/${page.current_page}/${page.page_size}`,
|
||||
`${prefix}/${knowledge_id}/document/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -124,7 +123,7 @@ const delMulDocument: (
|
|||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
|
||||
return del(`${prefix}/${dataset_id}/document/_bach`, undefined, { id_list: data }, loading)
|
||||
return del(`${prefix}/${dataset_id}/document/_bach`, undefined, {id_list: data}, loading)
|
||||
}
|
||||
|
||||
const batchRefresh: (
|
||||
|
|
@ -135,7 +134,7 @@ const batchRefresh: (
|
|||
) => Promise<Result<boolean>> = (dataset_id, data, stateList, loading) => {
|
||||
return put(
|
||||
`${prefix}/${dataset_id}/document/batch_refresh`,
|
||||
{ id_list: data, state_list: stateList },
|
||||
{id_list: data, state_list: stateList},
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -164,7 +163,7 @@ const putDocumentRefresh: (
|
|||
) => Promise<Result<any>> = (dataset_id, document_id, state_list, loading) => {
|
||||
return put(
|
||||
`${prefix}/${dataset_id}/document/${document_id}/refresh`,
|
||||
{ state_list },
|
||||
{state_list},
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -204,14 +203,14 @@ const delMulSyncDocument: (
|
|||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
|
||||
return put(`${prefix}/${dataset_id}/document/_bach`, { id_list: data }, undefined, loading)
|
||||
return put(`${prefix}/${dataset_id}/document/_bach`, {id_list: data}, undefined, loading)
|
||||
}
|
||||
const delMulLarkSyncDocument: (
|
||||
dataset_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
|
||||
return put(`${prefix}/lark/${dataset_id}/_batch`, { id_list: data }, undefined, loading)
|
||||
return put(`${prefix}/lark/${dataset_id}/_batch`, {id_list: data}, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -302,7 +301,7 @@ const exportQATemplate: (fileName: string, type: string, loading?: Ref<boolean>)
|
|||
type,
|
||||
loading,
|
||||
) => {
|
||||
return exportExcel(fileName, `${prefix}/document/template/export`, { type }, loading)
|
||||
return exportExcel(fileName, `${prefix}/document/template/export`, {type}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -314,7 +313,7 @@ const exportTableTemplate: (fileName: string, type: string, loading?: Ref<boolea
|
|||
type,
|
||||
loading,
|
||||
) => {
|
||||
return exportExcel(fileName, `${prefix}/document/table_template/export`, { type }, loading)
|
||||
return exportExcel(fileName, `${prefix}/document/table_template/export`, {type}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
import { type Ref } from 'vue'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
import type { knowledgeData } from '@/api/type/knowledge'
|
||||
const prefix = '/workspace'
|
||||
import {Result} from '@/request/Result'
|
||||
import {get, post, del, put} from '@/request/index'
|
||||
import {type Ref} from 'vue'
|
||||
import type {pageRequest} from '@/api/type/common'
|
||||
import type {knowledgeData} from '@/api/type/knowledge'
|
||||
|
||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id')
|
||||
|
||||
/**
|
||||
* 获得知识库文件夹列表
|
||||
|
|
@ -14,31 +15,29 @@ const prefix = '/workspace'
|
|||
* desc: string,}
|
||||
*/
|
||||
const getKnowledgeByFolder: (
|
||||
wordspace_id: string,
|
||||
data?: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (wordspace_id, data, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/knowledge`, data, loading)
|
||||
) => Promise<Result<Array<any>>> = (data, loading) => {
|
||||
return get(`${prefix}/knowledge`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 知识库分页列表
|
||||
* @param 参数
|
||||
* param {
|
||||
"folder_id": "string",
|
||||
"name": "string",
|
||||
"tool_type": "string",
|
||||
desc: string,
|
||||
}
|
||||
* param {
|
||||
"folder_id": "string",
|
||||
"name": "string",
|
||||
"tool_type": "string",
|
||||
desc: string,
|
||||
}
|
||||
*/
|
||||
const getKnowledgeList: (
|
||||
wordspace_id: string,
|
||||
page: pageRequest,
|
||||
param?: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, page, param, loading) => {
|
||||
) => Promise<Result<any>> = (page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${wordspace_id}/knowledge/${page.current_page}/${page.page_size}`,
|
||||
`${prefix}/knowledge/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -58,15 +57,14 @@ const getKnowledgeList: (
|
|||
* @query 参数 sync_type // 同步类型->replace:替换同步,complete:完整同步
|
||||
*/
|
||||
const putSyncWebKnowledge: (
|
||||
wordspace_id: string,
|
||||
knowledge_id: string,
|
||||
sync_type: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, knowledge_id, sync_type, loading) => {
|
||||
) => Promise<Result<any>> = (knowledge_id, sync_type, loading) => {
|
||||
return put(
|
||||
`${prefix}/${wordspace_id}/knowledge/${knowledge_id}/sync`,
|
||||
`${prefix}/knowledge/${knowledge_id}/sync`,
|
||||
undefined,
|
||||
{ sync_type },
|
||||
{sync_type},
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
|
@ -76,12 +74,11 @@ const putSyncWebKnowledge: (
|
|||
* @param 参数 knowledge_id
|
||||
*/
|
||||
const putReEmbeddingKnowledge: (
|
||||
wordspace_id: string,
|
||||
knowledge_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, knowledge_id, loading) => {
|
||||
) => Promise<Result<any>> = (knowledge_id, loading) => {
|
||||
return put(
|
||||
`${prefix}/${wordspace_id}/knowledge/${knowledge_id}/embedding`,
|
||||
`${prefix}/knowledge/${knowledge_id}/embedding`,
|
||||
undefined,
|
||||
undefined,
|
||||
loading,
|
||||
|
|
@ -93,29 +90,27 @@ const putReEmbeddingKnowledge: (
|
|||
* @param 参数 knowledge_id
|
||||
*/
|
||||
const getKnowledgeDetail: (
|
||||
wordspace_id: string,
|
||||
knowledge_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, knowledge_id, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/knowledge/${knowledge_id}`, undefined, loading)
|
||||
) => Promise<Result<any>> = (knowledge_id, loading) => {
|
||||
return get(`${prefix}/knowledge/${knowledge_id}`, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建知识库
|
||||
* @param 参数
|
||||
* {
|
||||
"name": "string",
|
||||
"folder_id": "string",
|
||||
"desc": "string",
|
||||
"embedding": "string"
|
||||
"name": "string",
|
||||
"folder_id": "string",
|
||||
"desc": "string",
|
||||
"embedding": "string"
|
||||
}
|
||||
*/
|
||||
const postKnowledge: (
|
||||
wordspace_id: string,
|
||||
data: knowledgeData,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, data, loading) => {
|
||||
return post(`${prefix}/${wordspace_id}/knowledge/base`, data, undefined, loading, 1000 * 60 * 5)
|
||||
) => Promise<Result<any>> = (data, loading) => {
|
||||
return post(`${prefix}/knowledge/base`, data, undefined, loading, 1000 * 60 * 5)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -123,19 +118,18 @@ const postKnowledge: (
|
|||
* @param 参数
|
||||
* {
|
||||
"name": "string",
|
||||
"folder_id": "string",
|
||||
"desc": "string",
|
||||
"embedding": "string",
|
||||
"source_url": "string",
|
||||
"selector": "string"
|
||||
"folder_id": "string",
|
||||
"desc": "string",
|
||||
"embedding": "string",
|
||||
"source_url": "string",
|
||||
"selector": "string"
|
||||
}
|
||||
*/
|
||||
const postWebKnowledge: (
|
||||
wordspace_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, data, loading) => {
|
||||
return post(`${prefix}/${wordspace_id}/knowledge/web`, data, undefined, loading)
|
||||
) => Promise<Result<any>> = (data, loading) => {
|
||||
return post(`${prefix}/knowledge/web`, data, undefined, loading)
|
||||
}
|
||||
/**
|
||||
* 修改知识库信息
|
||||
|
|
@ -147,12 +141,11 @@ const postWebKnowledge: (
|
|||
}
|
||||
*/
|
||||
const putKnowledge: (
|
||||
wordspace_id: string,
|
||||
knowledge_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, knowledge_id, data, loading) => {
|
||||
return put(`${prefix}/${wordspace_id}/knowledge/${knowledge_id}`, data, undefined, loading)
|
||||
) => Promise<Result<any>> = (knowledge_id, data, loading) => {
|
||||
return put(`${prefix}/knowledge/${knowledge_id}`, data, undefined, loading)
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { Result } from '@/request/Result'
|
|||
import { get, post, del, put } from '@/request/index'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
import type { Ref } from 'vue'
|
||||
const prefix = '/dataset'
|
||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/knowledge'
|
||||
|
||||
/**
|
||||
* 段落列表
|
||||
|
|
@ -68,7 +68,7 @@ const delMulParagraph: (
|
|||
|
||||
/**
|
||||
* 创建段落
|
||||
* @param 参数
|
||||
* @param 参数
|
||||
* dataset_id, document_id
|
||||
* {
|
||||
"content": "string",
|
||||
|
|
@ -93,7 +93,7 @@ const postParagraph: (
|
|||
|
||||
/**
|
||||
* 修改段落
|
||||
* @param 参数
|
||||
* @param 参数
|
||||
* dataset_id, document_id, paragraph_id
|
||||
* {
|
||||
"content": "string",
|
||||
|
|
@ -163,7 +163,7 @@ const getProblem: (
|
|||
|
||||
/**
|
||||
* 创建问题
|
||||
* @param 参数
|
||||
* @param 参数
|
||||
* dataset_id, document_id, paragraph_id
|
||||
* {
|
||||
"id": "string",
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
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'
|
||||
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 参数 dataset_id,
|
||||
* page {
|
||||
"current_page": "string",
|
||||
"page_size": "string",
|
||||
}
|
||||
* query {
|
||||
"content": "string",
|
||||
}
|
||||
"current_page": "string",
|
||||
"page_size": "string",
|
||||
}
|
||||
* query {
|
||||
"content": "string",
|
||||
}
|
||||
*/
|
||||
|
||||
const getProblems: (
|
||||
workspace_id: string,
|
||||
dataset_id: string,
|
||||
page: pageRequest,
|
||||
param: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, dataset_id, page, param, loading) => {
|
||||
) => Promise<Result<any>> = (dataset_id, page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${wordspace_id}/knowledge/${dataset_id}/problem/${page.current_page}/${page.page_size}`,
|
||||
`${prefix}/${dataset_id}/problem/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -73,8 +73,8 @@ const delMulProblem: (
|
|||
* @param 参数
|
||||
* dataset_id, problem_id,
|
||||
* {
|
||||
"content": "string",
|
||||
}
|
||||
"content": "string",
|
||||
}
|
||||
*/
|
||||
const putProblems: (
|
||||
dataset_id: string,
|
||||
|
|
@ -102,9 +102,9 @@ const getDetailProblems: (
|
|||
* 批量关联段落
|
||||
* @param 参数 dataset_id,
|
||||
* {
|
||||
"problem_id_list": "Array",
|
||||
"paragraph_list": "Array",
|
||||
}
|
||||
"problem_id_list": "Array",
|
||||
"paragraph_list": "Array",
|
||||
}
|
||||
*/
|
||||
const postMulAssociationProblem: (
|
||||
dataset_id: string,
|
||||
|
|
|
|||
|
|
@ -1,26 +1,25 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
import { type Ref } from 'vue'
|
||||
import {Result} from '@/request/Result'
|
||||
import {get, post, del, put} from '@/request/index'
|
||||
import {type Ref} from 'vue'
|
||||
import type {
|
||||
ListModelRequest,
|
||||
Model,
|
||||
CreateModelRequest,
|
||||
EditModelRequest,
|
||||
} from '@/api/type/model'
|
||||
import type { FormField } from '@/components/dynamics-form/type'
|
||||
import type {FormField} from '@/components/dynamics-form/type'
|
||||
|
||||
const prefix = '/workspace'
|
||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id')
|
||||
|
||||
/**
|
||||
* 获得模型列表
|
||||
* @params 参数 name, model_type, model_name
|
||||
*/
|
||||
const getModel: (
|
||||
wordspace_id: string,
|
||||
request?: ListModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<Model>>> = (wordspace_id, data, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/model`, data, loading)
|
||||
) => Promise<Result<Array<Model>>> = (data, loading) => {
|
||||
return get(`${prefix}/model`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -30,11 +29,10 @@ const getModel: (
|
|||
* @returns
|
||||
*/
|
||||
const getModelParamsForm: (
|
||||
wordspace_id: string,
|
||||
model_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<FormField>>> = (wordspace_id, model_id, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/model/${model_id}/model_params_form`, {}, loading)
|
||||
) => Promise<Result<Array<FormField>>> = (model_id, loading) => {
|
||||
return get(`${prefix}/model/${model_id}/model_params_form`, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -44,11 +42,10 @@ const getModelParamsForm: (
|
|||
* @returns
|
||||
*/
|
||||
const createModel: (
|
||||
wordspace_id: string,
|
||||
request: CreateModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (wordspace_id, request, loading) => {
|
||||
return post(`${prefix}/${wordspace_id}/model`, request, {}, loading)
|
||||
) => Promise<Result<Model>> = (request, loading) => {
|
||||
return post(`${prefix}/model`, request, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,12 +55,11 @@ const createModel: (
|
|||
* @returns
|
||||
*/
|
||||
const updateModel: (
|
||||
wordspace_id: string,
|
||||
model_id: string,
|
||||
request: EditModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (wordspace_id, model_id, request, loading) => {
|
||||
return put(`${prefix}/${wordspace_id}/model/${model_id}`, request, {}, loading)
|
||||
) => Promise<Result<Model>> = (model_id, request, loading) => {
|
||||
return put(`${prefix}/model/${model_id}`, request, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,12 +69,11 @@ const updateModel: (
|
|||
* @returns
|
||||
*/
|
||||
const updateModelParamsForm: (
|
||||
wordspace_id: string,
|
||||
model_id: string,
|
||||
request: any[],
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (wordspace_id, model_id, request, loading) => {
|
||||
return put(`${prefix}/${wordspace_id}/model/${model_id}/model_params_form`, request, {}, loading)
|
||||
) => Promise<Result<Model>> = (model_id, request, loading) => {
|
||||
return put(`${prefix}/model/${model_id}/model_params_form`, request, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -88,11 +83,10 @@ const updateModelParamsForm: (
|
|||
* @returns
|
||||
*/
|
||||
const getModelById: (
|
||||
wordspace_id: string,
|
||||
model_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (wordspace_id, model_id, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/model/${model_id}`, {}, loading)
|
||||
) => Promise<Result<Model>> = (model_id, loading) => {
|
||||
return get(`${prefix}/model/${model_id}`, {}, loading)
|
||||
}
|
||||
/**
|
||||
* 获取模型信息不包括认证信息根据模型id
|
||||
|
|
@ -101,11 +95,10 @@ const getModelById: (
|
|||
* @returns
|
||||
*/
|
||||
const getModelMetaById: (
|
||||
wordspace_id: string,
|
||||
model_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (wordspace_id, model_id, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/model/${model_id}/meta`, {}, loading)
|
||||
) => Promise<Result<Model>> = (model_id, loading) => {
|
||||
return get(`${prefix}/model/${model_id}/meta`, {}, loading)
|
||||
}
|
||||
/**
|
||||
* 暂停下载
|
||||
|
|
@ -114,18 +107,16 @@ const getModelMetaById: (
|
|||
* @returns
|
||||
*/
|
||||
const pauseDownload: (
|
||||
wordspace_id: string,
|
||||
model_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (wordspace_id, model_id, loading) => {
|
||||
return put(`${prefix}/${wordspace_id}/model/${model_id}/pause_download`, undefined, {}, loading)
|
||||
) => Promise<Result<boolean>> = (model_id, loading) => {
|
||||
return put(`${prefix}/model/${model_id}/pause_download`, undefined, {}, loading)
|
||||
}
|
||||
const deleteModel: (
|
||||
wordspace_id: string,
|
||||
model_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (wordspace_id, model_id, loading) => {
|
||||
return del(`${prefix}/${wordspace_id}/model/${model_id}`, undefined, {}, loading)
|
||||
) => Promise<Result<boolean>> = (model_id, loading) => {
|
||||
return del(`${prefix}/model/${model_id}`, undefined, {}, loading)
|
||||
}
|
||||
export default {
|
||||
getModel,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post } from '@/request/index'
|
||||
import type { Ref } from 'vue'
|
||||
import type { Provider, BaseModel } from '@/api/type/model'
|
||||
import type { FormField } from '@/components/dynamics-form/type'
|
||||
import type { KeyValue } from '../type/common'
|
||||
import {Result} from '@/request/Result'
|
||||
import {get, post} from '@/request/index'
|
||||
import type {Ref} from 'vue'
|
||||
import type {Provider, BaseModel} from '@/api/type/model'
|
||||
import type {FormField} from '@/components/dynamics-form/type'
|
||||
import type {KeyValue} from '../type/common'
|
||||
|
||||
const prefix_provider = '/provider'
|
||||
/**
|
||||
* 获得供应商列表
|
||||
|
|
@ -19,7 +20,7 @@ const getProviderByModelType: (
|
|||
model_type: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<Provider>>> = (model_type, loading) => {
|
||||
return get(`${prefix_provider}`, { model_type }, loading)
|
||||
return get(`${prefix_provider}`, {model_type}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -36,7 +37,7 @@ const getModelCreateForm: (
|
|||
model_name: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<FormField>>> = (provider, model_type, model_name, loading) => {
|
||||
return get(`${prefix_provider}/model_form`, { provider, model_type, model_name }, loading)
|
||||
return get(`${prefix_provider}/model_form`, {provider, model_type, model_name}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -49,7 +50,7 @@ const listModelType: (
|
|||
provider: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<KeyValue<string, string>>>> = (provider, loading?: Ref<boolean>) => {
|
||||
return get(`${prefix_provider}/model_type_list`, { provider }, loading)
|
||||
return get(`${prefix_provider}/model_type_list`, {provider}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -64,7 +65,7 @@ const listBaseModel: (
|
|||
model_type: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<BaseModel>>> = (provider, model_type, loading) => {
|
||||
return get(`${prefix_provider}/model_list`, { provider, model_type }, loading)
|
||||
return get(`${prefix_provider}/model_list`, {provider, model_type}, loading)
|
||||
}
|
||||
|
||||
const listBaseModelParamsForm: (
|
||||
|
|
@ -73,7 +74,7 @@ const listBaseModelParamsForm: (
|
|||
model_name: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<BaseModel>>> = (provider, model_type, model_name, loading) => {
|
||||
return get(`${prefix_provider}/model_params_form`, { provider, model_type, model_name }, loading)
|
||||
return get(`${prefix_provider}/model_params_form`, {provider, model_type, model_name}, loading)
|
||||
}
|
||||
export default {
|
||||
getProvider,
|
||||
|
|
|
|||
|
|
@ -1,39 +1,39 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
import { type Ref } from 'vue'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
import type { toolData } from '@/api/type/tool'
|
||||
const prefix = '/workspace'
|
||||
import {Result} from '@/request/Result'
|
||||
import {get, post, del, put} from '@/request/index'
|
||||
import {type Ref} from 'vue'
|
||||
import type {pageRequest} from '@/api/type/common'
|
||||
import type {toolData} from '@/api/type/tool'
|
||||
|
||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id')
|
||||
|
||||
|
||||
/**
|
||||
* 获得工具文件夹列表
|
||||
* @params 参数 {folder_id: string}
|
||||
*/
|
||||
const getToolByFolder: (
|
||||
wordspace_id: string,
|
||||
data?: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (wordspace_id, data, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/tool`, data, loading)
|
||||
) => Promise<Result<Array<any>>> = (data, loading) => {
|
||||
return get(`${prefix}/tool`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具列表
|
||||
* @param 参数
|
||||
* param {
|
||||
"folder_id": "string",
|
||||
"name": "string",
|
||||
"tool_type": "string",
|
||||
}
|
||||
* param {
|
||||
"folder_id": "string",
|
||||
"name": "string",
|
||||
"tool_type": "string",
|
||||
}
|
||||
*/
|
||||
const getToolList: (
|
||||
wordspace_id: string,
|
||||
page: pageRequest,
|
||||
param?: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, page, param, loading) => {
|
||||
) => Promise<Result<any>> = (page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${wordspace_id}/tool/${page.current_page}/${page.page_size}`,
|
||||
`${prefix}/tool/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -44,11 +44,10 @@ const getToolList: (
|
|||
* @param 参数
|
||||
*/
|
||||
const postTool: (
|
||||
wordspace_id: string,
|
||||
data: toolData,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, data, loading) => {
|
||||
return post(`${prefix}/${wordspace_id}/tool`, data, undefined, loading)
|
||||
) => Promise<Result<any>> = (data, loading) => {
|
||||
return post(`${prefix}/tool`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -57,12 +56,11 @@ const postTool: (
|
|||
|
||||
*/
|
||||
const putTool: (
|
||||
wordspace_id: string,
|
||||
tool_id: string,
|
||||
data: toolData,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, tool_id, data, loading) => {
|
||||
return put(`${prefix}/${wordspace_id}/tool/${tool_id}`, data, undefined, loading)
|
||||
) => Promise<Result<any>> = (tool_id, data, loading) => {
|
||||
return put(`${prefix}/tool/${tool_id}`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,19 +70,17 @@ const putTool: (
|
|||
* @returns 函数详情
|
||||
*/
|
||||
const getToolById: (
|
||||
wordspace_id: string,
|
||||
tool_id: String,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, tool_id, loading) => {
|
||||
return get(`${prefix}/${wordspace_id}/tool/${tool_id}`, undefined, loading)
|
||||
) => Promise<Result<any>> = (tool_id, loading) => {
|
||||
return get(`${prefix}/tool/${tool_id}`, undefined, loading)
|
||||
}
|
||||
|
||||
const postPylint: (
|
||||
wordspace_id: string,
|
||||
code: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (wordspace_id, code, loading) => {
|
||||
return post(`${prefix}/${wordspace_id}/tool/pylint`, { code }, {}, loading)
|
||||
) => Promise<Result<any>> = (code, loading) => {
|
||||
return post(`${prefix}/tool/pylint`, {code}, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { Codemirror } from 'vue-codemirror'
|
||||
import { python } from '@codemirror/lang-python'
|
||||
import { oneDark } from '@codemirror/theme-one-dark'
|
||||
import { linter, type Diagnostic } from '@codemirror/lint'
|
||||
import {ref, computed, watch} from 'vue'
|
||||
import {Codemirror} from 'vue-codemirror'
|
||||
import {python} from '@codemirror/lang-python'
|
||||
import {oneDark} from '@codemirror/theme-one-dark'
|
||||
import {linter, type Diagnostic} from '@codemirror/lint'
|
||||
import ToolApi from '@/api/tool/tool'
|
||||
|
||||
defineOptions({ name: 'CodemirrorEditor' })
|
||||
defineOptions({name: 'CodemirrorEditor'})
|
||||
|
||||
const props = defineProps<{
|
||||
title: String
|
||||
|
|
@ -74,7 +74,7 @@ function getRangeFromLineAndColumn(state: any, line: number, column: number, end
|
|||
|
||||
const regexpLinter = linter(async (view) => {
|
||||
let diagnostics: Diagnostic[] = []
|
||||
await ToolApi.postPylint('default', view.state.doc.toString()).then((ok) => {
|
||||
await ToolApi.postPylint(view.state.doc.toString()).then((ok) => {
|
||||
ok.data.forEach((element: any) => {
|
||||
const range = getRangeFromLineAndColumn(
|
||||
view.state,
|
||||
|
|
@ -124,6 +124,7 @@ function submitDialog() {
|
|||
<style lang="scss" scoped>
|
||||
.codemirror-editor {
|
||||
position: relative;
|
||||
|
||||
&__footer {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ const open = (source: string, id: string) => {
|
|||
const submitHandle = async () => {
|
||||
await FolderFormRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
folderApi.postFolder('default', sourceType.value, folderForm.value, loading).then((res) => {
|
||||
folderApi.postFolder( sourceType.value, folderForm.value, loading).then((res) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
emit('refresh')
|
||||
dialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { type Ref } from 'vue'
|
||||
import {defineStore} from 'pinia'
|
||||
import {type Ref} from 'vue'
|
||||
import folderApi from '@/api/folder'
|
||||
|
||||
const useFolderStore = defineStore('folder', {
|
||||
state: () => ({}),
|
||||
actions: {
|
||||
async asynGetFolder(workspace_id: string, source: string, data: any, loading?: Ref<boolean>) {
|
||||
async asyncGetFolder(source: string, data: any, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
folderApi
|
||||
.getFolder(workspace_id, source, data, loading)
|
||||
.getFolder(source, data, loading)
|
||||
.then((res) => {
|
||||
resolve(res)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import type { knowledgeData } from '@/api/type/knowledge'
|
||||
import type { UploadUserFile } from 'element-plus'
|
||||
import {defineStore} from 'pinia'
|
||||
import type {knowledgeData} from '@/api/type/knowledge'
|
||||
import type {UploadUserFile} from 'element-plus'
|
||||
import knowledgeApi from '@/api/knowledge/knowledge'
|
||||
import { type Ref } from 'vue'
|
||||
import {type Ref} from 'vue'
|
||||
|
||||
export interface knowledgeStateTypes {
|
||||
baseInfo: knowledgeData | null
|
||||
|
|
@ -44,13 +44,12 @@ const useKnowledgeStore = defineStore('knowledge', {
|
|||
// })
|
||||
// },
|
||||
async asyncGetDatasetDetail(
|
||||
workspace_id: string,
|
||||
knowledge_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) {
|
||||
return new Promise((resolve, reject) => {
|
||||
knowledgeApi
|
||||
.getKnowledgeDetail(workspace_id, knowledge_id, loading)
|
||||
.getKnowledgeDetail(knowledge_id, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
|
|
@ -60,14 +59,13 @@ const useKnowledgeStore = defineStore('knowledge', {
|
|||
})
|
||||
},
|
||||
async asyncSyncDataset(
|
||||
workspace_id: string,
|
||||
id: string,
|
||||
sync_type: string,
|
||||
loading?: Ref<boolean>,
|
||||
) {
|
||||
return new Promise((resolve, reject) => {
|
||||
knowledgeApi
|
||||
.putSyncWebKnowledge(workspace_id, id, sync_type, loading)
|
||||
.putSyncWebKnowledge(id, sync_type, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { type Ref } from 'vue'
|
||||
import {defineStore} from 'pinia'
|
||||
import {type Ref} from 'vue'
|
||||
import ModelApi from '@/api/model/model'
|
||||
import ProviderApi from '@/api/model/provider'
|
||||
import type { ListModelRequest } from '@/api/type/model'
|
||||
import type {ListModelRequest} from '@/api/type/model'
|
||||
|
||||
const useModelStore = defineStore('model', {
|
||||
state: () => ({}),
|
||||
actions: {
|
||||
async asyncGetModel(wordspace_id: string, data?: ListModelRequest, loading?: Ref<boolean>) {
|
||||
async asyncGetModel(data?: ListModelRequest, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ModelApi.getModel(wordspace_id, data, loading)
|
||||
ModelApi.getModel(data, loading)
|
||||
.then((res) => {
|
||||
resolve(res)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ const useProblemStore = defineStore('problem', {
|
|||
})
|
||||
},
|
||||
async asyncGetProblem(
|
||||
workspace_id: string,
|
||||
datasetId: string,
|
||||
page: pageRequest,
|
||||
param: any,
|
||||
|
|
@ -28,7 +27,7 @@ const useProblemStore = defineStore('problem', {
|
|||
) {
|
||||
return new Promise((resolve, reject) => {
|
||||
problemApi
|
||||
.getProblems(workspace_id, datasetId, page, param, loading)
|
||||
.getProblems(datasetId, page, param, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -82,15 +82,16 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, reactive } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import type { ApplicationFormType } from '@/api/type/application'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import {ref, watch, reactive} from 'vue'
|
||||
import {useRouter, useRoute} from 'vue-router'
|
||||
import type {ApplicationFormType} from '@/api/type/application'
|
||||
import type {FormInstance, FormRules} from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { MsgSuccess, MsgAlert } from '@/utils/message'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import { baseNodes } from '@/workflow/common/data'
|
||||
import { t } from '@/locales'
|
||||
import {MsgSuccess, MsgAlert} from '@/utils/message'
|
||||
import {isWorkFlow} from '@/utils/application'
|
||||
import {baseNodes} from '@/workflow/common/data'
|
||||
import {t} from '@/locales'
|
||||
|
||||
const router = useRouter()
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
|
|
@ -227,17 +228,16 @@ const submitHandle = async (formEl: FormInstance | undefined) => {
|
|||
console.log(applicationForm.value.type)
|
||||
applicationApi
|
||||
.postApplication(
|
||||
'default',
|
||||
{ ...applicationForm.value, folder_id: currentFolder.value },
|
||||
{...applicationForm.value, folder_id: currentFolder.value},
|
||||
loading,
|
||||
)
|
||||
.then((res) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
emit('refresh')
|
||||
if (isWorkFlow(applicationForm.value.type)) {
|
||||
router.push({ path: `/application/${res.data.id}/workflow` })
|
||||
router.push({path: `/application/${res.data.id}/workflow`})
|
||||
} else {
|
||||
router.push({ path: `/application/${res.data.id}/${res.data.type}/setting` })
|
||||
router.push({path: `/application/${res.data.id}/${res.data.type}/setting`})
|
||||
}
|
||||
dialogVisible.value = false
|
||||
})
|
||||
|
|
@ -249,11 +249,12 @@ function selectedType(type: string) {
|
|||
appTemplate.value = type
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
defineExpose({open})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.radio-card {
|
||||
line-height: 22px;
|
||||
|
||||
&.active {
|
||||
border-color: var(--el-color-primary);
|
||||
color: var(--el-color-primary);
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
style="width: 120px"
|
||||
@change="search_type_change"
|
||||
>
|
||||
<el-option :label="$t('common.creator')" value="create_user" />
|
||||
<el-option :label="$t('common.creator')" value="create_user"/>
|
||||
|
||||
<el-option :label="$t('common.name')" value="name" />
|
||||
<el-option :label="$t('common.name')" value="name"/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-if="search_type === 'name'"
|
||||
|
|
@ -38,12 +38,15 @@
|
|||
clearable
|
||||
style="width: 220px"
|
||||
>
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username" />
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username"/>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="primary" class="ml-8">
|
||||
{{ $t('common.create') }}<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
{{ $t('common.create') }}
|
||||
<el-icon class="el-icon--right">
|
||||
<arrow-down/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="create-dropdown">
|
||||
|
|
@ -59,8 +62,9 @@
|
|||
<div class="pre-wrap ml-8">
|
||||
<div class="lighter">{{ $t('views.application.simple') }}</div>
|
||||
<el-text type="info" size="small">{{
|
||||
$t('views.application.simplePlaceholder')
|
||||
}}</el-text>
|
||||
$t('views.application.simplePlaceholder')
|
||||
}}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
|
|
@ -76,8 +80,9 @@
|
|||
<div class="pre-wrap ml-8">
|
||||
<div class="lighter">{{ $t('views.application.workflow') }}</div>
|
||||
<el-text type="info" size="small">{{
|
||||
$t('views.application.workflowPlaceholder')
|
||||
}}</el-text>
|
||||
$t('views.application.workflowPlaceholder')
|
||||
}}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
|
|
@ -117,7 +122,7 @@
|
|||
@click="router.push({ path: `/application/${item.id}/${item.type}/overview` })"
|
||||
>
|
||||
<template #icon>
|
||||
<LogoIcon height="28px" style="width: 28px; height: 28px; display: block" />
|
||||
<LogoIcon height="28px" style="width: 28px; height: 28px; display: block"/>
|
||||
</template>
|
||||
<template #subTitle>
|
||||
<el-text class="color-secondary" size="small">
|
||||
|
|
@ -146,17 +151,17 @@
|
|||
<AppIcon iconName="app-view"></AppIcon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-divider direction="vertical" />
|
||||
<el-divider direction="vertical"/>
|
||||
<el-tooltip effect="dark" :content="$t('common.setting')" placement="top">
|
||||
<el-button text @click.stop="settingApplication(item)">
|
||||
<AppIcon iconName="Setting"></AppIcon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-divider direction="vertical" />
|
||||
<el-divider direction="vertical"/>
|
||||
<span @click.stop>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button text @click.stop>
|
||||
<el-icon><MoreFilled /></el-icon>
|
||||
<el-icon><MoreFilled/></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
|
|
@ -173,8 +178,8 @@
|
|||
{{ $t('common.export') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="Delete" @click.stop="deleteApplication(item)">{{
|
||||
$t('common.delete')
|
||||
}}</el-dropdown-item>
|
||||
$t('common.delete')
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
|
@ -185,7 +190,9 @@
|
|||
<div @click.stop>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button text @click.stop>
|
||||
<el-icon><MoreFilled /></el-icon>
|
||||
<el-icon>
|
||||
<MoreFilled/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
|
|
@ -193,7 +200,8 @@
|
|||
icon="Refresh"
|
||||
@click.stop="syncDataset(item)"
|
||||
v-if="item.type === 1"
|
||||
>{{ $t('views.knowledge.setting.sync') }}</el-dropdown-item
|
||||
>{{ $t('views.knowledge.setting.sync') }}
|
||||
</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click.stop="reEmbeddingDataset(item)">
|
||||
<AppIcon iconName="app-vectorization"></AppIcon>
|
||||
|
|
@ -232,25 +240,26 @@
|
|||
</el-col>
|
||||
</template>
|
||||
</el-row>
|
||||
<el-empty :description="$t('common.noData')" v-else />
|
||||
<el-empty :description="$t('common.noData')" v-else/>
|
||||
</div>
|
||||
</ContentContainer>
|
||||
<CreateApplicationDialog ref="CreateApplicationDialogRef" />
|
||||
<CreateApplicationDialog ref="CreateApplicationDialogRef"/>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
|
||||
<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 ApplicaitonApi from '@/api/application/application'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
import useStore from '@/stores'
|
||||
import { numberFormat } from '@/utils/common'
|
||||
import { t } from '@/locales'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import {numberFormat} from '@/utils/common'
|
||||
import {t} from '@/locales'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {isWorkFlow} from '@/utils/application'
|
||||
|
||||
const router = useRouter()
|
||||
const { folder } = useStore()
|
||||
const {folder} = useStore()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
|
|
@ -296,14 +305,14 @@ function openCreateDialog(type?: string) {
|
|||
}
|
||||
|
||||
const search_type_change = () => {
|
||||
search_form.value = { name: '', create_user: '' }
|
||||
search_form.value = {name: '', create_user: ''}
|
||||
}
|
||||
|
||||
function getList() {
|
||||
const params = {
|
||||
folder_id: currentFolder.value?.id || 'root',
|
||||
}
|
||||
ApplicaitonApi.getApplication('default', paginationConfig, params, loading).then((res) => {
|
||||
ApplicaitonApi.getApplication(paginationConfig, params, loading).then((res) => {
|
||||
paginationConfig.total = res.data.total
|
||||
applicationList.value = [...applicationList.value, ...res.data.records]
|
||||
})
|
||||
|
|
@ -311,7 +320,7 @@ function getList() {
|
|||
|
||||
function getFolder() {
|
||||
const params = {}
|
||||
folder.asynGetFolder('default', 'APPLICATION', params, loading).then((res: any) => {
|
||||
folder.asyncGetFolder('APPLICATION', params, loading).then((res: any) => {
|
||||
folderList.value = res.data
|
||||
currentFolder.value = res.data?.[0] || {}
|
||||
getList()
|
||||
|
|
|
|||
|
|
@ -930,7 +930,7 @@ function getList(bool?: boolean) {
|
|||
folder_id: folderId,
|
||||
}
|
||||
documentApi
|
||||
.getDocument('default', id as string, paginationConfig.value, param, bool ? undefined : loading)
|
||||
.getDocument( id as string, paginationConfig.value, param, bool ? undefined : loading)
|
||||
.then((res) => {
|
||||
documentData.value = res.data.records
|
||||
paginationConfig.value.total = res.data.total
|
||||
|
|
@ -938,7 +938,7 @@ function getList(bool?: boolean) {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
knowledge.asyncGetDatasetDetail('default', id, loading).then((res: any) => {
|
||||
knowledge.asyncGetDatasetDetail( id, loading).then((res: any) => {
|
||||
datasetDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<h4 class="title-decoration-1 mb-16">
|
||||
{{ $t('common.info') }}
|
||||
</h4>
|
||||
<BaseForm ref="BaseFormRef" :data="detail" />
|
||||
<BaseForm ref="BaseFormRef" :data="detail"/>
|
||||
|
||||
<el-form
|
||||
ref="webFormRef"
|
||||
|
|
@ -21,12 +21,12 @@
|
|||
<el-card shadow="never" class="mb-8" style="width: 50%" v-if="detail.type === 0">
|
||||
<div class="flex align-center">
|
||||
<el-avatar class="mr-8 avatar-blue" shape="square" :size="32">
|
||||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt=""/>
|
||||
</el-avatar>
|
||||
<div>
|
||||
<div>{{ $t('views.knowledge.knowledgeType.generalKnowledge') }}</div>
|
||||
<el-text type="info"
|
||||
>{{ $t('views.knowledge.knowledgeType.generalInfo') }}
|
||||
>{{ $t('views.knowledge.knowledgeType.generalInfo') }}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
<el-card shadow="never" class="mb-8" style="width: 50%" v-if="detail?.type === 1">
|
||||
<div class="flex align-center">
|
||||
<el-avatar class="mr-8 avatar-purple" shape="square" :size="32">
|
||||
<img src="@/assets/knowledge/icon_web.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/knowledge/icon_web.svg" style="width: 58%" alt=""/>
|
||||
</el-avatar>
|
||||
<div>
|
||||
<div>{{ $t('views.knowledge.knowledgeType.webKnowledge') }}</div>
|
||||
|
|
@ -47,14 +47,14 @@
|
|||
<el-card shadow="never" class="mb-8" style="width: 50%" v-if="detail?.type === 2">
|
||||
<div class="flex align-center">
|
||||
<el-avatar shape="square" :size="32" style="background: none">
|
||||
<img src="@/assets/knowledge/logo_lark.svg" style="width: 100%" alt="" />
|
||||
<img src="@/assets/knowledge/logo_lark.svg" style="width: 100%" alt=""/>
|
||||
</el-avatar>
|
||||
<div>
|
||||
<p>
|
||||
<el-text>{{ $t('views.knowledge.knowledgeType.larkKnowledge') }}</el-text>
|
||||
</p>
|
||||
<el-text type="info"
|
||||
>{{ $t('views.knowledge.knowledgeType.larkInfo') }}
|
||||
>{{ $t('views.knowledge.knowledgeType.larkInfo') }}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
style="background: none"
|
||||
class="mr-12"
|
||||
>
|
||||
<img :src="item?.icon" alt="" />
|
||||
<img :src="item?.icon" alt=""/>
|
||||
</el-avatar>
|
||||
<el-avatar
|
||||
v-else-if="item?.name"
|
||||
|
|
@ -159,22 +159,22 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import {ref, onMounted, reactive} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import BaseForm from '@/views/knowledge/component/BaseForm.vue'
|
||||
import KnowledgeApi from '@/api/knowledge/knowledge'
|
||||
import type { ApplicationFormType } from '@/api/type/application'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { isAppIcon } from '@/utils/common'
|
||||
import type {ApplicationFormType} from '@/api/type/application'
|
||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
import {isAppIcon} from '@/utils/common'
|
||||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
import {t} from '@/locales'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
params: {id},
|
||||
} = route as any
|
||||
|
||||
const { knowledge } = useStore()
|
||||
const {knowledge} = useStore()
|
||||
const webFormRef = ref()
|
||||
const BaseFormRef = ref()
|
||||
const loading = ref(false)
|
||||
|
|
@ -229,14 +229,14 @@ async function submit() {
|
|||
const obj =
|
||||
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,
|
||||
meta: form.value,
|
||||
...BaseFormRef.value.form,
|
||||
}
|
||||
: {
|
||||
application_id_list: application_id_list.value,
|
||||
...BaseFormRef.value.form,
|
||||
}
|
||||
application_id_list: application_id_list.value,
|
||||
...BaseFormRef.value.form,
|
||||
}
|
||||
|
||||
if (cloneModelId.value !== BaseFormRef.value.form.embedding_mode_id) {
|
||||
MsgConfirm(t('common.tip'), t('views.knowledge.tip.updateModeMessage'), {
|
||||
|
|
@ -250,14 +250,15 @@ async function submit() {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
KnowledgeApi.putKnowledge('default', id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putReEmbeddingDataset(id).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {
|
||||
})
|
||||
} else {
|
||||
if (detail.value.type === 2) {
|
||||
KnowledgeApi.putLarkDataset(id, obj, loading).then((res) => {
|
||||
|
|
@ -266,7 +267,7 @@ async function submit() {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
KnowledgeApi.putKnowledge('default', id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putKnowledge(id, obj, loading).then((res) => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,18 +42,20 @@
|
|||
</el-form>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue'
|
||||
import { groupBy } from 'lodash'
|
||||
import {ref, reactive, onMounted, onUnmounted, computed, watch} from 'vue'
|
||||
import {groupBy} from 'lodash'
|
||||
import useStore from '@/stores'
|
||||
import type { knowledgeData } from '@/api/type/knowledge'
|
||||
import { t } from '@/locales'
|
||||
import type {knowledgeData} from '@/api/type/knowledge'
|
||||
import {t} from '@/locales'
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
default: () => {
|
||||
},
|
||||
},
|
||||
})
|
||||
const { model } = useStore()
|
||||
const {model} = useStore()
|
||||
const form = ref<knowledgeData>({
|
||||
name: '',
|
||||
desc: '',
|
||||
|
|
@ -101,6 +103,7 @@ watch(
|
|||
immediate: true,
|
||||
},
|
||||
)
|
||||
|
||||
/*
|
||||
表单校验
|
||||
*/
|
||||
|
|
@ -114,7 +117,7 @@ function validate() {
|
|||
function getModel() {
|
||||
loading.value = true
|
||||
model
|
||||
.asyncGetModel('default', { model_type: 'EMBEDDING' })
|
||||
.asyncGetModel({model_type: 'EMBEDDING'})
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const submitHandle = async () => {
|
|||
folder_id: currentFolder.value?.id,
|
||||
...BaseFormRef.value.form,
|
||||
}
|
||||
KnowledgeApi.postDataset('default', obj, loading).then((res) => {
|
||||
KnowledgeApi.postKnowledge(obj, loading).then((res) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
// router.push({ path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document` })
|
||||
emit('refresh')
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ const submitHandle = async () => {
|
|||
...BaseFormRef.value.form,
|
||||
...knowledgeForm.value,
|
||||
}
|
||||
KnowledgeApi.postWebDataset('default', obj, loading).then((res) => {
|
||||
KnowledgeApi.postWebKnowledge(obj, loading).then((res) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({ path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document` })
|
||||
emit('refresh')
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
style="width: 120px"
|
||||
@change="search_type_change"
|
||||
>
|
||||
<el-option :label="$t('common.creator')" value="create_user" />
|
||||
<el-option :label="$t('common.creator')" value="create_user"/>
|
||||
|
||||
<el-option :label="$t('common.name')" value="name" />
|
||||
<el-option :label="$t('common.name')" value="name"/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-if="search_type === 'name'"
|
||||
|
|
@ -38,42 +38,47 @@
|
|||
clearable
|
||||
style="width: 220px"
|
||||
>
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username" />
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username"/>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="primary" class="ml-8">
|
||||
{{ $t('common.create') }}<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
{{ $t('common.create') }}
|
||||
<el-icon class="el-icon--right">
|
||||
<arrow-down/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="create-dropdown">
|
||||
<el-dropdown-item @click="openCreateDialog(CreateKnowledgeDialog)">
|
||||
<div class="flex">
|
||||
<el-avatar class="avatar-blue mt-4" shape="square" :size="32">
|
||||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt=""/>
|
||||
</el-avatar>
|
||||
<div class="pre-wrap ml-8">
|
||||
<div class="lighter">
|
||||
{{ $t('views.knowledge.knowledgeType.generalKnowledge') }}
|
||||
</div>
|
||||
<el-text type="info" size="small">{{
|
||||
$t('views.knowledge.knowledgeType.generalInfo')
|
||||
}}</el-text>
|
||||
$t('views.knowledge.knowledgeType.generalInfo')
|
||||
}}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openCreateDialog(CreateWebKnowledgeDialog)">
|
||||
<div class="flex">
|
||||
<el-avatar class="avatar-purple mt-4" shape="square" :size="32">
|
||||
<img src="@/assets/knowledge/icon_web.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/knowledge/icon_web.svg" style="width: 58%" alt=""/>
|
||||
</el-avatar>
|
||||
<div class="pre-wrap ml-8">
|
||||
<div class="lighter">
|
||||
{{ $t('views.knowledge.knowledgeType.webKnowledge') }}
|
||||
</div>
|
||||
<el-text type="info" size="small">{{
|
||||
$t('views.knowledge.knowledgeType.webInfo')
|
||||
}}</el-text>
|
||||
$t('views.knowledge.knowledgeType.webInfo')
|
||||
}}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
|
|
@ -85,15 +90,16 @@
|
|||
:size="32"
|
||||
style="background: none"
|
||||
>
|
||||
<img src="@/assets/knowledge/logo_lark.svg" alt="" />
|
||||
<img src="@/assets/knowledge/logo_lark.svg" alt=""/>
|
||||
</el-avatar>
|
||||
<div class="pre-wrap ml-8">
|
||||
<div class="lighter">
|
||||
{{ $t('views.knowledge.knowledgeType.larkKnowledge') }}
|
||||
</div>
|
||||
<el-text type="info" size="small">{{
|
||||
$t('views.knowledge.knowledgeType.larkInfo')
|
||||
}}</el-text>
|
||||
$t('views.knowledge.knowledgeType.larkInfo')
|
||||
}}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
|
|
@ -105,15 +111,16 @@
|
|||
:size="32"
|
||||
style="background: none"
|
||||
>
|
||||
<img src="@/assets/knowledge/logo_yuque.svg" alt="" />
|
||||
<img src="@/assets/knowledge/logo_yuque.svg" alt=""/>
|
||||
</el-avatar>
|
||||
<div class="pre-wrap ml-8">
|
||||
<div class="lighter">
|
||||
{{ $t('views.knowledge.knowledgeType.yuqueKnowledge') }}
|
||||
</div>
|
||||
<el-text type="info" size="small">{{
|
||||
$t('views.knowledge.knowledgeType.yuqueInfo')
|
||||
}}</el-text>
|
||||
$t('views.knowledge.knowledgeType.yuqueInfo')
|
||||
}}
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
|
|
@ -179,7 +186,7 @@
|
|||
"
|
||||
>
|
||||
<template #icon>
|
||||
<KnowledgeIcon :type="item.type" />
|
||||
<KnowledgeIcon :type="item.type"/>
|
||||
</template>
|
||||
<template #subTitle>
|
||||
<el-text class="color-secondary" size="small">
|
||||
|
|
@ -192,16 +199,17 @@
|
|||
<div>
|
||||
<span class="bold mr-4">{{ item?.document_count || 0 }}</span>
|
||||
<span class="color-secondary">{{
|
||||
$t('views.knowledge.document_count')
|
||||
}}</span>
|
||||
<el-divider direction="vertical" />
|
||||
$t('views.knowledge.document_count')
|
||||
}}</span>
|
||||
<el-divider direction="vertical"/>
|
||||
<span class="bold mr-4">{{ numberFormat(item?.char_length) || 0 }}</span>
|
||||
<span class="color-secondary">{{ $t('common.character') }}</span
|
||||
><el-divider direction="vertical" />
|
||||
>
|
||||
<el-divider direction="vertical"/>
|
||||
<span class="bold mr-4">{{ item?.application_mapping_count || 0 }}</span>
|
||||
<span class="color-secondary">{{
|
||||
$t('views.knowledge.relatedApp_count')
|
||||
}}</span>
|
||||
$t('views.knowledge.relatedApp_count')
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -209,7 +217,9 @@
|
|||
<div @click.stop>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button text @click.stop>
|
||||
<el-icon><MoreFilled /></el-icon>
|
||||
<el-icon>
|
||||
<MoreFilled/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
|
|
@ -217,7 +227,8 @@
|
|||
icon="Refresh"
|
||||
@click.stop="syncDataset(item)"
|
||||
v-if="item.type === 1"
|
||||
>{{ $t('views.knowledge.setting.sync') }}</el-dropdown-item
|
||||
>{{ $t('views.knowledge.setting.sync') }}
|
||||
</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item @click.stop="reEmbeddingDataset(item)">
|
||||
<AppIcon iconName="app-vectorization"></AppIcon>
|
||||
|
|
@ -256,31 +267,31 @@
|
|||
</el-col>
|
||||
</template>
|
||||
</el-row>
|
||||
<el-empty :description="$t('common.noData')" v-else />
|
||||
<el-empty :description="$t('common.noData')" v-else/>
|
||||
</InfiniteScroll>
|
||||
</div>
|
||||
</ContentContainer>
|
||||
|
||||
<component :is="currentCreateDialog" ref="CreateKnowledgeDialogRef" />
|
||||
<CreateFolderDialog ref="CreateFolderDialogRef" @refresh="refreshFolder" />
|
||||
<component :is="currentCreateDialog" ref="CreateKnowledgeDialogRef"/>
|
||||
<CreateFolderDialog ref="CreateFolderDialogRef" @refresh="refreshFolder"/>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, reactive, shallowRef, nextTick } from 'vue'
|
||||
import {onMounted, ref, reactive, shallowRef, nextTick} from 'vue'
|
||||
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 KnowledgeApi from '@/api/knowledge/knowledge'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
import useStore from '@/stores'
|
||||
import { numberFormat } from '@/utils/common'
|
||||
import { t } from '@/locales'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {numberFormat} from '@/utils/common'
|
||||
import {t} from '@/locales'
|
||||
import {useRouter} from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const { folder } = useStore()
|
||||
const {folder} = useStore()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
|
|
@ -331,25 +342,26 @@ function openCreateDialog(data: any) {
|
|||
}
|
||||
|
||||
function reEmbeddingDataset(row: any) {
|
||||
KnowledgeApi.putReEmbeddingDataset('default', row.id).then(() => {
|
||||
KnowledgeApi.putReEmbeddingKnowledge(row.id).then(() => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
})
|
||||
}
|
||||
|
||||
const SyncWebDialogRef = ref()
|
||||
|
||||
function syncDataset(row: any) {
|
||||
SyncWebDialogRef.value.open(row.id)
|
||||
}
|
||||
|
||||
const search_type_change = () => {
|
||||
search_form.value = { name: '', create_user: '' }
|
||||
search_form.value = {name: '', create_user: ''}
|
||||
}
|
||||
|
||||
function getList() {
|
||||
const params = {
|
||||
folder_id: currentFolder.value?.id || 'root',
|
||||
}
|
||||
KnowledgeApi.getKnowledgeList('default', paginationConfig, params, loading).then((res) => {
|
||||
KnowledgeApi.getKnowledgeList(paginationConfig, params, loading).then((res) => {
|
||||
paginationConfig.total = res.data.total
|
||||
knowledgeList.value = [...knowledgeList.value, ...res.data.records]
|
||||
})
|
||||
|
|
@ -357,7 +369,7 @@ function getList() {
|
|||
|
||||
function getFolder() {
|
||||
const params = {}
|
||||
folder.asynGetFolder('default', 'KNOWLEDGE', params, loading).then((res: any) => {
|
||||
folder.asyncGetFolder('KNOWLEDGE', params, loading).then((res: any) => {
|
||||
folderList.value = res.data
|
||||
currentFolder.value = res.data?.[0] || {}
|
||||
getList()
|
||||
|
|
@ -369,6 +381,7 @@ function folderClickHandel(row: any) {
|
|||
knowledgeList.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
const CreateFolderDialogRef = ref()
|
||||
|
||||
function openCreateFolder() {
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ const loginHandle = () => {
|
|||
} else {
|
||||
login.asyncLogin(loginForm.value, loading).then(() => {
|
||||
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
|
||||
localStorage.setItem('workspace_id', 'default')
|
||||
router.push({name: 'home'})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,7 +412,6 @@ const submit = () => {
|
|||
.then(() => {
|
||||
if (providerValue.value) {
|
||||
ModelApi.createModel(
|
||||
'default',
|
||||
{
|
||||
...base_form_data.value,
|
||||
credential: credential_form_data.value,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<template #header="{ close, titleId, titleClass }">
|
||||
<el-breadcrumb separator=">">
|
||||
<el-breadcrumb-item
|
||||
><span class="active-breadcrumb">{{
|
||||
><span class="active-breadcrumb">{{
|
||||
`${$t('common.edit')} ${providerValue?.name}`
|
||||
}}</span></el-breadcrumb-item
|
||||
>
|
||||
|
|
@ -100,8 +100,8 @@
|
|||
<div class="mr-4">
|
||||
<span>{{ $t('views.model.modelForm.base_model.label') }} </span>
|
||||
<span class="danger ml-4">{{
|
||||
$t('views.model.modelForm.base_model.tooltip')
|
||||
}}</span>
|
||||
$t('views.model.modelForm.base_model.tooltip')
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -145,17 +145,17 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import type { Provider, BaseModel, Model } from '@/api/type/model'
|
||||
import type { Dict, KeyValue } from '@/api/type/common'
|
||||
import {ref, computed} from 'vue'
|
||||
import type {Provider, BaseModel, Model} from '@/api/type/model'
|
||||
import type {Dict, KeyValue} from '@/api/type/common'
|
||||
import ModelApi from '@/api/model/model'
|
||||
import ProviderApi from '@/api/model/provider'
|
||||
import type { FormField } from '@/components/dynamics-form/type'
|
||||
import type {FormField} from '@/components/dynamics-form/type'
|
||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||
import type { FormRules } from 'element-plus'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { PermissionType, PermissionDesc } from '@/enums/model'
|
||||
import { t } from '@/locales'
|
||||
import type {FormRules} from 'element-plus'
|
||||
import {MsgSuccess} from '@/utils/message'
|
||||
import {PermissionType, PermissionDesc} from '@/enums/model'
|
||||
import {t} from '@/locales'
|
||||
|
||||
const providerValue = ref<Provider>()
|
||||
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
|
||||
|
|
@ -194,13 +194,13 @@ const base_form_data = ref<{
|
|||
model_type: string
|
||||
|
||||
model_name: string
|
||||
}>({ name: '', model_type: '', model_name: '', permission_type: 'PRIVATE' })
|
||||
}>({name: '', model_type: '', model_name: '', permission_type: 'PRIVATE'})
|
||||
|
||||
const credential_form_data = ref<Dict<any>>({})
|
||||
|
||||
const form_data = computed({
|
||||
get: () => {
|
||||
return { ...credential_form_data.value, ...base_form_data.value }
|
||||
return {...credential_form_data.value, ...base_form_data.value}
|
||||
},
|
||||
set: (event: any) => {
|
||||
credential_form_data.value = event
|
||||
|
|
@ -236,7 +236,7 @@ const list_base_model = (model_type: any, change?: boolean) => {
|
|||
}
|
||||
const open = (provider: Provider, model: Model) => {
|
||||
modelValue.value = model
|
||||
ModelApi.getModelById('default', model.id, formLoading).then((ok) => {
|
||||
ModelApi.getModelById(model.id, formLoading).then((ok) => {
|
||||
modelValue.value = ok.data
|
||||
ProviderApi.listModelType(model.provider, model_type_loading).then((ok) => {
|
||||
model_type_list.value = ok.data
|
||||
|
|
@ -257,7 +257,7 @@ const open = (provider: Provider, model: Model) => {
|
|||
}
|
||||
|
||||
const close = () => {
|
||||
base_form_data.value = { name: '', model_type: '', model_name: '', permission_type: '' }
|
||||
base_form_data.value = {name: '', model_type: '', model_name: '', permission_type: ''}
|
||||
dynamicsFormRef.value?.ruleFormRef?.resetFields()
|
||||
credential_form_data.value = {}
|
||||
model_form_field.value = []
|
||||
|
|
@ -269,7 +269,6 @@ const submit = () => {
|
|||
dynamicsFormRef.value?.validate().then(() => {
|
||||
if (modelValue.value) {
|
||||
ModelApi.updateModel(
|
||||
'default',
|
||||
modelValue.value.id,
|
||||
{
|
||||
...base_form_data.value,
|
||||
|
|
@ -285,7 +284,7 @@ const submit = () => {
|
|||
})
|
||||
}
|
||||
|
||||
defineExpose({ open, close })
|
||||
defineExpose({open, close})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.select-provider {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
{{ model.name }}
|
||||
<span v-if="currentModel.status === 'ERROR'">
|
||||
<el-tooltip effect="dark" :content="errMessage" placement="top">
|
||||
<el-icon class="danger ml-4" size="18"><Warning /></el-icon>
|
||||
<el-icon class="danger ml-4" size="18"><Warning/></el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span v-if="currentModel.status === 'PAUSE_DOWNLOAD'">
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
:content="`${$t('views.model.modelForm.base_model.label')}: ${props.model.model_name} ${$t('views.model.tip.downloadError')}`"
|
||||
placement="top"
|
||||
>
|
||||
<el-icon class="danger ml-4" size="18"><Warning /></el-icon>
|
||||
<el-icon class="danger ml-4" size="18"><Warning/></el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -30,16 +30,18 @@
|
|||
<ul>
|
||||
<li class="flex mb-4">
|
||||
<el-text type="info" class="color-secondary">{{
|
||||
$t('views.model.modelForm.model_type.label')
|
||||
}}</el-text>
|
||||
$t('views.model.modelForm.model_type.label')
|
||||
}}
|
||||
</el-text>
|
||||
<span class="ellipsis ml-16">
|
||||
{{ $t(modelType[model.model_type as keyof typeof modelType]) }}</span
|
||||
>
|
||||
</li>
|
||||
<li class="flex">
|
||||
<el-text type="info" class="color-secondary">{{
|
||||
$t('views.model.modelForm.base_model.label')
|
||||
}}</el-text>
|
||||
$t('views.model.modelForm.base_model.label')
|
||||
}}
|
||||
</el-text>
|
||||
<span class="ellipsis-1 ml-16" style="height: 20px; width: 70%">
|
||||
{{ model.model_name }}</span
|
||||
>
|
||||
|
|
@ -57,7 +59,8 @@
|
|||
class="ml-16"
|
||||
:disabled="!is_permisstion"
|
||||
@click.stop="cancelDownload"
|
||||
>{{ $t('views.model.download.cancelDownload') }}</el-button
|
||||
>{{ $t('views.model.download.cancelDownload') }}
|
||||
</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -65,7 +68,9 @@
|
|||
<template #mouseEnter>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button text @click.stop>
|
||||
<el-icon><MoreFilled /></el-icon>
|
||||
<el-icon>
|
||||
<MoreFilled/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
|
|
@ -105,27 +110,28 @@
|
|||
</el-dropdown>
|
||||
</template>
|
||||
<EditModel ref="editModelRef" @submit="emit('change')"></EditModel>
|
||||
<ParamSettingDialog ref="paramSettingRef" :model="model" />
|
||||
<ParamSettingDialog ref="paramSettingRef" :model="model"/>
|
||||
</card-box>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type { Provider, Model } from '@/api/type/model'
|
||||
import type {Provider, Model} from '@/api/type/model'
|
||||
import ModelApi from '@/api/model/model'
|
||||
import { computed, ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
import {computed, ref, onMounted, onBeforeUnmount} from 'vue'
|
||||
import EditModel from '@/views/model/component/EditModel.vue'
|
||||
// import DownloadLoading from '@/components/loading/DownloadLoading.vue'
|
||||
import { MsgConfirm } from '@/utils/message'
|
||||
import { modelType } from '@/enums/model'
|
||||
import {MsgConfirm} from '@/utils/message'
|
||||
import {modelType} from '@/enums/model'
|
||||
import useStore from '@/stores'
|
||||
import ParamSettingDialog from './ParamSettingDialog.vue'
|
||||
import { t } from '@/locales'
|
||||
import {t} from '@/locales'
|
||||
|
||||
const props = defineProps<{
|
||||
model: Model
|
||||
provider_list: Array<Provider>
|
||||
updateModelById: (model_id: string, model: Model) => void
|
||||
}>()
|
||||
|
||||
const { user } = useStore()
|
||||
const {user} = useStore()
|
||||
const downModel = ref<Model>()
|
||||
|
||||
const is_permisstion = computed(() => {
|
||||
|
|
@ -161,15 +167,16 @@ const deleteModel = () => {
|
|||
},
|
||||
)
|
||||
.then(() => {
|
||||
ModelApi.deleteModel('default', props.model.id).then(() => {
|
||||
ModelApi.deleteModel(props.model.id).then(() => {
|
||||
emit('change')
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {
|
||||
})
|
||||
}
|
||||
|
||||
const cancelDownload = () => {
|
||||
ModelApi.pauseDownload('default', props.model.id).then(() => {
|
||||
ModelApi.pauseDownload(props.model.id).then(() => {
|
||||
downModel.value = undefined
|
||||
emit('change')
|
||||
})
|
||||
|
|
@ -190,7 +197,7 @@ const icon = computed(() => {
|
|||
const initInterval = () => {
|
||||
interval = setInterval(() => {
|
||||
if (currentModel.value.status === 'DOWNLOAD') {
|
||||
ModelApi.getModelMetaById('default', props.model.id).then((ok) => {
|
||||
ModelApi.getModelMetaById(props.model.id).then((ok) => {
|
||||
downModel.value = ok.data
|
||||
})
|
||||
} else {
|
||||
|
|
@ -228,12 +235,14 @@ onBeforeUnmount(() => {
|
|||
.model-card {
|
||||
min-height: 135px;
|
||||
min-width: auto;
|
||||
|
||||
.operation-button {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: 12px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.progress-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
|
@ -243,6 +252,7 @@ onBeforeUnmount(() => {
|
|||
height: 100%;
|
||||
z-index: 99;
|
||||
text-align: center;
|
||||
|
||||
.percentage {
|
||||
margin-top: 55px;
|
||||
margin-bottom: 16px;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ const AddParamRef = ref()
|
|||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
loading.value = true
|
||||
ModelApi.getModelParamsForm('default', props.model.id, loading)
|
||||
ModelApi.getModelParamsForm(props.model.id, loading)
|
||||
.then((ok) => {
|
||||
loading.value = false
|
||||
modelParamsForm.value = ok.data
|
||||
|
|
@ -151,7 +151,7 @@ function refresh(data: any, index: any) {
|
|||
}
|
||||
|
||||
function submit() {
|
||||
ModelApi.updateModelParamsForm('default', props.model.id, modelParamsForm.value, loading).then(
|
||||
ModelApi.updateModelParamsForm(props.model.id, modelParamsForm.value, loading).then(
|
||||
(ok) => {
|
||||
MsgSuccess(t('views.model.tip.saveSuccessMessage'))
|
||||
close()
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ const openCreateModel = (provider?: Provider, model_type?: string) => {
|
|||
const list_model = () => {
|
||||
const params = active_provider.value?.provider ? { provider: active_provider.value.provider } : {}
|
||||
model
|
||||
.asyncGetModel('default', { ...model_search_form.value, ...params }, list_model_loading)
|
||||
.asyncGetModel( { ...model_search_form.value, ...params }, list_model_loading)
|
||||
.then((ok: any) => {
|
||||
model_list.value = ok.data
|
||||
const v = model_list.value.map((m) => ({ id: m.user_id, username: m.username }))
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@ const remoteMethod = (query: string) => {
|
|||
function getProblemOption(filterText?: string) {
|
||||
return problem
|
||||
.asyncGetProblem(
|
||||
'default',
|
||||
props.datasetId || (id as string),
|
||||
{ current_page: 1, page_size: 100 },
|
||||
filterText && { content: filterText },
|
||||
|
|
|
|||
|
|
@ -7,14 +7,17 @@
|
|||
<div class="flex-between">
|
||||
<div>
|
||||
<el-button type="primary" @click="createProblem">{{
|
||||
$t('views.problem.createProblem')
|
||||
}}</el-button>
|
||||
$t('views.problem.createProblem')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button @click="relateProblem()" :disabled="multipleSelection.length === 0">{{
|
||||
$t('views.problem.relateParagraph.title')
|
||||
}}</el-button>
|
||||
$t('views.problem.relateParagraph.title')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0">{{
|
||||
$t('views.problem.setting.batchDelete')
|
||||
}}</el-button>
|
||||
$t('views.problem.setting.batchDelete')
|
||||
}}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-input
|
||||
|
|
@ -46,7 +49,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
|
||||
|
|
@ -100,14 +103,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>
|
||||
|
|
@ -118,7 +121,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<CreateProblemDialog ref="CreateProblemDialogRef" @refresh="refresh" />
|
||||
<CreateProblemDialog ref="CreateProblemDialogRef" @refresh="refresh"/>
|
||||
<DetailProblemDrawer
|
||||
:next="nextChatRecord"
|
||||
:pre="preChatRecord"
|
||||
|
|
@ -129,28 +132,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()
|
||||
|
|
@ -176,7 +180,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>>()
|
||||
|
|
@ -251,7 +255,8 @@ function deleteProblem(row: any) {
|
|||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {
|
||||
})
|
||||
}
|
||||
|
||||
function editName(val: string, problemId: string) {
|
||||
|
|
@ -271,6 +276,7 @@ function editName(val: string, problemId: string) {
|
|||
function cellMouseEnter(row: any) {
|
||||
currentMouseId.value = row.id
|
||||
}
|
||||
|
||||
function cellMouseLeave() {
|
||||
currentMouseId.value = ''
|
||||
}
|
||||
|
|
@ -308,7 +314,7 @@ const next_disable = computed(() => {
|
|||
return (
|
||||
index >= problemData.value.length &&
|
||||
index + (paginationConfig.current_page - 1) * paginationConfig.page_size >=
|
||||
paginationConfig.total - 1
|
||||
paginationConfig.total - 1
|
||||
)
|
||||
})
|
||||
/**
|
||||
|
|
@ -344,7 +350,7 @@ function rowClickHandle(row: any, column?: any) {
|
|||
}
|
||||
}
|
||||
|
||||
const setRowClass = ({ row }: any) => {
|
||||
const setRowClass = ({row}: any) => {
|
||||
return currentClickId.value === row?.id ? 'highlight' : ''
|
||||
}
|
||||
|
||||
|
|
@ -356,10 +362,9 @@ function handleSizeChange() {
|
|||
function getList() {
|
||||
return problem
|
||||
.asyncGetProblem(
|
||||
'default',
|
||||
id as string,
|
||||
paginationConfig,
|
||||
filterText.value && { content: filterText.value },
|
||||
filterText.value && {content: filterText.value},
|
||||
loading,
|
||||
)
|
||||
.then((res: any) => {
|
||||
|
|
@ -367,10 +372,12 @@ function getList() {
|
|||
paginationConfig.total = res.data.total
|
||||
})
|
||||
}
|
||||
|
||||
function refreshRelate() {
|
||||
getList()
|
||||
multipleTableRef.value?.clearSelection()
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
paginationConfig.current_page = 1
|
||||
getList()
|
||||
|
|
@ -380,6 +387,7 @@ onMounted(() => {
|
|||
getList()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {})
|
||||
onBeforeUnmount(() => {
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@
|
|||
:size="32"
|
||||
style="background: none"
|
||||
>
|
||||
<img :src="String(form.icon)" alt="" />
|
||||
<img :src="String(form.icon)" alt=""/>
|
||||
</el-Avatar>
|
||||
<el-avatar v-else class="avatar-green" shape="square" :size="32">
|
||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt=""/>
|
||||
</el-avatar>
|
||||
<el-Avatar
|
||||
v-if="showEditIcon"
|
||||
|
|
@ -45,11 +45,13 @@
|
|||
:size="32"
|
||||
@click="openEditAvatar"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>
|
||||
<el-icon>
|
||||
<EditPen/>
|
||||
</el-icon>
|
||||
</el-Avatar>
|
||||
</div>
|
||||
<el-avatar v-else class="avatar-green" shape="square" :size="32">
|
||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt=""/>
|
||||
</el-avatar>
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
|
|
@ -78,7 +80,10 @@
|
|||
{{ $t('common.param.initParam') }}
|
||||
</h4>
|
||||
<el-button link type="primary" @click="openAddInitDialog()">
|
||||
<el-icon class="mr-4"><Plus /></el-icon> {{ $t('common.add') }}
|
||||
<el-icon class="mr-4">
|
||||
<Plus/>
|
||||
</el-icon>
|
||||
{{ $t('common.add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table ref="initFieldTableRef" :data="form.init_field_list" class="mb-16">
|
||||
|
|
@ -90,35 +95,43 @@
|
|||
<el-table-column :label="$t('dynamicsForm.paramForm.input_type.label')">
|
||||
<template #default="{ row }">
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'TextInput'">{{
|
||||
$t('dynamicsForm.input_type_list.TextInput')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.TextInput')
|
||||
}}
|
||||
</el-tag>
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'PasswordInput'">{{
|
||||
$t('dynamicsForm.input_type_list.PasswordInput')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.PasswordInput')
|
||||
}}
|
||||
</el-tag>
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'Slider'">{{
|
||||
$t('dynamicsForm.input_type_list.Slider')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.Slider')
|
||||
}}
|
||||
</el-tag>
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'SwitchInput'">{{
|
||||
$t('dynamicsForm.input_type_list.SwitchInput')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.SwitchInput')
|
||||
}}
|
||||
</el-tag>
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'SingleSelect'">{{
|
||||
$t('dynamicsForm.input_type_list.SingleSelect')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.SingleSelect')
|
||||
}}
|
||||
</el-tag>
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'MultiSelect'">{{
|
||||
$t('dynamicsForm.input_type_list.MultiSelect')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.MultiSelect')
|
||||
}}
|
||||
</el-tag>
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'RadioCard'">{{
|
||||
$t('dynamicsForm.input_type_list.RadioCard')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.RadioCard')
|
||||
}}
|
||||
</el-tag>
|
||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'DatePicker'">{{
|
||||
$t('dynamicsForm.input_type_list.DatePicker')
|
||||
}}</el-tag>
|
||||
$t('dynamicsForm.input_type_list.DatePicker')
|
||||
}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common.required')">
|
||||
<template #default="{ row }">
|
||||
<div @click.stop>
|
||||
<el-switch disabled size="small" v-model="row.required" />
|
||||
<el-switch disabled size="small" v-model="row.required"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -127,14 +140,14 @@
|
|||
<span class="mr-4">
|
||||
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">
|
||||
<el-button type="primary" text @click.stop="openAddInitDialog(row, $index)">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
<el-icon><EditPen/></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
||||
<el-button type="primary" text @click="deleteInitField($index)">
|
||||
<el-icon>
|
||||
<Delete />
|
||||
<Delete/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
|
|
@ -149,12 +162,15 @@
|
|||
</el-text>
|
||||
</h4>
|
||||
<el-button link type="primary" @click="openAddDialog()">
|
||||
<el-icon class="mr-4"><Plus /></el-icon> {{ $t('common.add') }}
|
||||
<el-icon class="mr-4">
|
||||
<Plus/>
|
||||
</el-icon>
|
||||
{{ $t('common.add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table ref="inputFieldTableRef" :data="form.input_field_list" class="mb-16">
|
||||
<el-table-column prop="name" :label="$t('views.tool.form.paramName.label')" />
|
||||
<el-table-column prop="name" :label="$t('views.tool.form.paramName.label')"/>
|
||||
<el-table-column :label="$t('views.tool.form.dataType.label')">
|
||||
<template #default="{ row }">
|
||||
<el-tag type="info" class="info-tag">{{ row.type }}</el-tag>
|
||||
|
|
@ -163,7 +179,7 @@
|
|||
<el-table-column :label="$t('common.required')">
|
||||
<template #default="{ row }">
|
||||
<div @click.stop>
|
||||
<el-switch size="small" v-model="row.is_required" />
|
||||
<el-switch size="small" v-model="row.is_required"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -181,14 +197,14 @@
|
|||
<span class="mr-4">
|
||||
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">
|
||||
<el-button type="primary" text @click.stop="openAddDialog(row, $index)">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
<el-icon><EditPen/></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
||||
<el-button type="primary" text @click="deleteField($index)">
|
||||
<el-icon>
|
||||
<Delete />
|
||||
<Delete/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
|
|
@ -226,32 +242,33 @@
|
|||
<el-button :loading="loading" @click="visible = false">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button :loading="loading" @click="openDebug">{{ $t('common.debug') }}</el-button>
|
||||
<el-button type="primary" @click="submit(FormRef)" :loading="loading">
|
||||
{{ isEdit ? $t('common.save') : $t('common.create') }}</el-button
|
||||
{{ isEdit ? $t('common.save') : $t('common.create') }}
|
||||
</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ToolDebugDrawer ref="ToolDebugDrawerRef" />
|
||||
<FieldFormDialog ref="FieldFormDialogRef" @refresh="refreshFieldList" />
|
||||
<UserFieldFormDialog ref="UserFieldFormDialogRef" @refresh="refreshInitFieldList" />
|
||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshTool" />
|
||||
<ToolDebugDrawer ref="ToolDebugDrawerRef"/>
|
||||
<FieldFormDialog ref="FieldFormDialogRef" @refresh="refreshFieldList"/>
|
||||
<UserFieldFormDialog ref="UserFieldFormDialogRef" @refresh="refreshInitFieldList"/>
|
||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshTool"/>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, nextTick } from 'vue'
|
||||
import {ref, reactive, watch, nextTick} from 'vue'
|
||||
import FieldFormDialog from '@/views/tool/component/FieldFormDialog.vue'
|
||||
import ToolDebugDrawer from './ToolDebugDrawer.vue'
|
||||
import UserFieldFormDialog from '@/views/tool/component/UserFieldFormDialog.vue'
|
||||
import EditAvatarDialog from '@/views/tool/component/EditAvatarDialog.vue'
|
||||
import type { toolData } from '@/api/type/tool'
|
||||
import type {toolData} from '@/api/type/tool'
|
||||
import ToolApi from '@/api/tool/tool'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { PermissionType, PermissionDesc } from '@/enums/model'
|
||||
import { t } from '@/locales'
|
||||
import { isAppIcon } from '@/utils/common'
|
||||
import type {FormInstance} from 'element-plus'
|
||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
import {cloneDeep} from 'lodash'
|
||||
import {PermissionType, PermissionDesc} from '@/enums/model'
|
||||
import {t} from '@/locales'
|
||||
import {isAppIcon} from '@/utils/common'
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
|
|
@ -325,7 +342,8 @@ function close() {
|
|||
.then(() => {
|
||||
visible.value = false
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -397,13 +415,13 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
await formEl.validate((valid: any) => {
|
||||
if (valid) {
|
||||
if (isEdit.value) {
|
||||
ToolApi.putTool('default', form.value?.id as string, form.value, loading).then((res) => {
|
||||
ToolApi.putTool(form.value?.id as string, form.value, loading).then((res) => {
|
||||
MsgSuccess(t('common.editSuccess'))
|
||||
emit('refresh', res.data)
|
||||
visible.value = false
|
||||
})
|
||||
} else {
|
||||
ToolApi.postTool('default', form.value, loading).then((res) => {
|
||||
ToolApi.postTool(form.value, loading).then((res) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
emit('refresh')
|
||||
visible.value = false
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import {ref, watch} from 'vue'
|
||||
import ToolApi from '@/api/tool/tool'
|
||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import {MsgSuccess} from '@/utils/message'
|
||||
import {t} from '@/locales'
|
||||
import {cloneDeep} from 'lodash'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ watch(debugVisible, (bool) => {
|
|||
|
||||
const submit = async () => {
|
||||
dynamicsFormRef.value.validate().then(() => {
|
||||
ToolApi.putToolLib('default', form.value?.id as string, form.value, loading).then((res) => {
|
||||
ToolApi.putTool(form.value?.id as string, form.value, loading).then((res) => {
|
||||
MsgSuccess(t('common.editSuccess'))
|
||||
emit('refresh')
|
||||
debugVisible.value = false
|
||||
|
|
@ -71,12 +71,12 @@ const open = (data: any, is_active: boolean) => {
|
|||
const init_params = form.value.init_field_list
|
||||
.map((item: any) => {
|
||||
if (item.show_default_value === false) {
|
||||
return { [item.field]: undefined }
|
||||
return {[item.field]: undefined}
|
||||
}
|
||||
return { [item.field]: item.default_value }
|
||||
return {[item.field]: item.default_value}
|
||||
})
|
||||
.reduce((x: any, y: any) => ({ ...x, ...y }), {})
|
||||
form.value.init_params = { ...init_params, ...form.value.init_params }
|
||||
.reduce((x: any, y: any) => ({...x, ...y}), {})
|
||||
form.value.init_params = {...init_params, ...form.value.init_params}
|
||||
debugVisible.value = true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
style="width: 120px"
|
||||
@change="search_type_change"
|
||||
>
|
||||
<el-option :label="$t('common.creator')" value="create_user" />
|
||||
<el-option :label="$t('common.creator')" value="create_user"/>
|
||||
|
||||
<el-option :label="$t('views.model.modelForm.modeName.label')" value="name" />
|
||||
<el-option :label="$t('views.model.modelForm.modeName.label')" value="name"/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-if="search_type === 'name'"
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
clearable
|
||||
style="width: 220px"
|
||||
>
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username" />
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username"/>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button class="ml-16" type="primary"> {{ $t('common.create') }}</el-button>
|
||||
|
|
@ -84,10 +84,10 @@
|
|||
style="background: none"
|
||||
class="mr-8"
|
||||
>
|
||||
<img :src="item?.icon" alt="" />
|
||||
<img :src="item?.icon" alt=""/>
|
||||
</el-avatar>
|
||||
<el-avatar v-else class="avatar-green" shape="square" :size="32">
|
||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" />
|
||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt=""/>
|
||||
</el-avatar>
|
||||
</template>
|
||||
<template #subTitle>
|
||||
|
|
@ -99,8 +99,10 @@
|
|||
<template #footer>
|
||||
<div v-if="item.is_active" class="flex align-center">
|
||||
<el-icon class="color-success mr-8" style="font-size: 16px"
|
||||
><SuccessFilled
|
||||
/></el-icon>
|
||||
>
|
||||
<SuccessFilled
|
||||
/>
|
||||
</el-icon>
|
||||
<span class="color-secondary">
|
||||
{{ $t('common.status.enabled') }}
|
||||
</span>
|
||||
|
|
@ -120,10 +122,12 @@
|
|||
size="small"
|
||||
class="mr-4"
|
||||
/>
|
||||
<el-divider direction="vertical" />
|
||||
<el-divider direction="vertical"/>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button text @click.stop>
|
||||
<el-icon><MoreFilled /></el-icon>
|
||||
<el-icon>
|
||||
<MoreFilled/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
|
|
@ -132,7 +136,9 @@
|
|||
:disabled="!canEdit(item)"
|
||||
@click.stop="openCreateDialog(item)"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>
|
||||
<el-icon>
|
||||
<EditPen/>
|
||||
</el-icon>
|
||||
{{ $t('common.edit') }}
|
||||
</el-dropdown-item>
|
||||
<!-- <el-dropdown-item
|
||||
|
|
@ -176,25 +182,25 @@
|
|||
</el-col>
|
||||
</template>
|
||||
</el-row>
|
||||
<el-empty :description="$t('common.noData')" v-else />
|
||||
<el-empty :description="$t('common.noData')" v-else/>
|
||||
</div>
|
||||
</ContentContainer>
|
||||
<InitParamDrawer ref="InitParamDrawerRef" @refresh="refresh" />
|
||||
<ToolFormDrawer ref="ToolFormDrawerRef" @refresh="refresh" :title="ToolDrawertitle" />
|
||||
<InitParamDrawer ref="InitParamDrawerRef" @refresh="refresh"/>
|
||||
<ToolFormDrawer ref="ToolFormDrawerRef" @refresh="refresh" :title="ToolDrawertitle"/>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, reactive, computed } from 'vue'
|
||||
import {onMounted, ref, reactive, computed} from 'vue'
|
||||
import ToolApi from '@/api/tool/tool'
|
||||
import useStore from '@/stores'
|
||||
import { MsgConfirm } from '@/utils/message'
|
||||
import {MsgConfirm} from '@/utils/message'
|
||||
import InitParamDrawer from '@/views/tool/component/InitParamDrawer.vue'
|
||||
import ToolFormDrawer from './ToolFormDrawer.vue'
|
||||
import { t } from '@/locales'
|
||||
import { isAppIcon } from '@/utils/common'
|
||||
import {t} from '@/locales'
|
||||
import {isAppIcon} from '@/utils/common'
|
||||
|
||||
const { folder, user } = useStore()
|
||||
const {folder, user} = useStore()
|
||||
|
||||
const InitParamDrawerRef = ref()
|
||||
const search_type = ref('name')
|
||||
|
|
@ -220,7 +226,7 @@ const toolList = ref<any[]>([])
|
|||
const currentFolder = ref<any>({})
|
||||
|
||||
const search_type_change = () => {
|
||||
search_form.value = { name: '', create_user: '' }
|
||||
search_form.value = {name: '', create_user: ''}
|
||||
}
|
||||
const canEdit = (row: any) => {
|
||||
return user.userInfo?.id === row?.user_id
|
||||
|
|
@ -228,6 +234,7 @@ const canEdit = (row: any) => {
|
|||
|
||||
const ToolFormDrawerRef = ref()
|
||||
const ToolDrawertitle = ref('')
|
||||
|
||||
function openCreateDialog(data?: any) {
|
||||
// 有template_id的不允许编辑,是模板转换来的
|
||||
if (data?.template_id) {
|
||||
|
|
@ -236,7 +243,7 @@ function openCreateDialog(data?: any) {
|
|||
ToolDrawertitle.value = data ? t('views.tool.editTool') : t('views.tool.createTool')
|
||||
if (data) {
|
||||
if (data?.permission_type !== 'PUBLIC' || canEdit(data)) {
|
||||
ToolApi.getToolById('default', data?.id, changeStateloading).then((res) => {
|
||||
ToolApi.getToolById(data?.id, changeStateloading).then((res) => {
|
||||
ToolFormDrawerRef.value.open(res.data)
|
||||
})
|
||||
}
|
||||
|
|
@ -250,7 +257,7 @@ function getList() {
|
|||
folder_id: currentFolder.value?.id || 'root',
|
||||
scope: 'WORKSPACE',
|
||||
}
|
||||
ToolApi.getToolList('default', paginationConfig, params, loading).then((res) => {
|
||||
ToolApi.getToolList(paginationConfig, params, loading).then((res) => {
|
||||
paginationConfig.total = res.data?.total
|
||||
toolList.value = [...toolList.value, ...res.data?.records]
|
||||
})
|
||||
|
|
@ -258,7 +265,7 @@ function getList() {
|
|||
|
||||
function getFolder() {
|
||||
const params = {}
|
||||
folder.asynGetFolder('default', 'TOOL', params, loading).then((res: any) => {
|
||||
folder.asyncGetFolder('TOOL', params, loading).then((res: any) => {
|
||||
folderList.value = res.data
|
||||
currentFolder.value = res.data?.[0] || {}
|
||||
getList()
|
||||
|
|
@ -278,7 +285,7 @@ async function changeState(row: any) {
|
|||
const obj = {
|
||||
is_active: !row.is_active,
|
||||
}
|
||||
ToolApi.putTool('default', row.id, obj, changeStateloading)
|
||||
ToolApi.putTool(row.id, obj, changeStateloading)
|
||||
.then(() => {
|
||||
return true
|
||||
})
|
||||
|
|
@ -287,7 +294,7 @@ async function changeState(row: any) {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
const res = await ToolApi.getToolById('default', row.id, changeStateloading)
|
||||
const res = await ToolApi.getToolById(row.id, changeStateloading)
|
||||
if (
|
||||
!res.data.init_params &&
|
||||
res.data.init_field_list &&
|
||||
|
|
@ -301,7 +308,7 @@ async function changeState(row: any) {
|
|||
const obj = {
|
||||
is_active: !row.is_active,
|
||||
}
|
||||
ToolApi.putTool('default', row.id, obj, changeStateloading)
|
||||
ToolApi.putTool(row.id, obj, changeStateloading)
|
||||
.then(() => {
|
||||
return true
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue