mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: applicaiton resource managment
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
This commit is contained in:
parent
3951853104
commit
86ad2c54c6
|
|
@ -3,15 +3,10 @@ import {
|
|||
get,
|
||||
post,
|
||||
exportExcelPost,
|
||||
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 useStore from '@/stores'
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
import { type Ref } from 'vue'
|
||||
|
||||
const prefix = '/system/resource/application'
|
||||
/**
|
||||
* API_KEY列表
|
||||
* @param 参数 application_id
|
||||
*/
|
||||
const getAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix}/${application_id}/application_key`, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增API_KEY
|
||||
* @param 参数 application_id
|
||||
*/
|
||||
const postAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
loading,
|
||||
) => {
|
||||
return post(`${prefix}/${application_id}/application_key`, {}, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除API_KEY
|
||||
* @param 参数 application_id api_key_id
|
||||
*/
|
||||
const delAPIKey: (
|
||||
application_id: string,
|
||||
api_key_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<boolean>> = (application_id, api_key_id, loading) => {
|
||||
return del(
|
||||
`${prefix}/${application_id}/application_key/${api_key_id}`,
|
||||
undefined,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改API_KEY
|
||||
* @param 参数 application_id,api_key_id
|
||||
* data {
|
||||
* is_active: boolean
|
||||
* }
|
||||
*/
|
||||
const putAPIKey: (
|
||||
application_id: string,
|
||||
api_key_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, api_key_id, data, loading) => {
|
||||
return put(`${prefix}/${application_id}/application_key/${api_key_id}`, data, undefined, loading)
|
||||
}
|
||||
|
||||
export default {
|
||||
getAPIKey,
|
||||
postAPIKey,
|
||||
delAPIKey,
|
||||
putAPIKey,
|
||||
}
|
||||
|
|
@ -1,21 +1,11 @@
|
|||
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 { 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'
|
||||
|
||||
const prefix = '/system/resource/application'
|
||||
|
||||
/**
|
||||
* 获取全部应用
|
||||
* @param 参数
|
||||
*/
|
||||
const getAllApplication: (param?: any, loading?: Ref<boolean>) => Promise<Result<any[]>> = (
|
||||
param,
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix}`, param, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页应用
|
||||
|
|
@ -31,17 +21,6 @@ const getApplication: (
|
|||
return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建应用
|
||||
* @param 参数
|
||||
*/
|
||||
const postApplication: (
|
||||
data: ApplicationFormType,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (data, loading) => {
|
||||
return post(`${prefix}`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用
|
||||
* @param 参数
|
||||
|
|
@ -86,19 +65,6 @@ const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promis
|
|||
) => {
|
||||
return get(`${prefix}/${application_id}/access_token`, undefined, loading)
|
||||
}
|
||||
/**
|
||||
* 获取应用设置
|
||||
* @param application_id 应用id
|
||||
* @param loading 加载器
|
||||
* @returns
|
||||
*/
|
||||
const getApplicationSetting: (
|
||||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/setting`, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改AccessToken
|
||||
* @param 参数 application_id
|
||||
|
|
@ -114,6 +80,93 @@ const putAccessToken: (
|
|||
return put(`${prefix}/${application_id}/access_token`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计
|
||||
* @param 参数 application_id, data
|
||||
*/
|
||||
const getStatistics: (
|
||||
application_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return get(`${prefix}/${application_id}/application_stats`, data, loading)
|
||||
}
|
||||
/**
|
||||
* 打开调试对话id
|
||||
* @param application_id 应用id
|
||||
* @param loading 加载器
|
||||
* @returns
|
||||
*/
|
||||
const open: (application_id: string, loading?: Ref<boolean>) => Promise<Result<string>> = (
|
||||
application_id,
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix}/${application_id}/open`, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用发布
|
||||
* @param application_id
|
||||
* @param loading
|
||||
* @returns
|
||||
*/
|
||||
const publish: (
|
||||
application_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return put(`${prefix}/${application_id}/publish`, data, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param application_id
|
||||
* @param data
|
||||
* @param loading
|
||||
* @returns
|
||||
*/
|
||||
const playDemoText: (application_id: string, data: any, loading?: Ref<boolean>) => Promise<any> = (
|
||||
application_id,
|
||||
data,
|
||||
loading,
|
||||
) => {
|
||||
return download(`${prefix}/${application_id}/play_demo_text`, 'post', data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本转语音
|
||||
*/
|
||||
const postTextToSpeech: (
|
||||
application_id: String,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return download(`${prefix}/${application_id}/text_to_speech`, 'post', data, undefined, loading)
|
||||
}
|
||||
/**
|
||||
* 语音转文本
|
||||
*/
|
||||
const speechToText: (
|
||||
application_id: String,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return post(`${prefix}/${application_id}/speech_to_text`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用设置
|
||||
* @param application_id 应用id
|
||||
* @param loading 加载器
|
||||
* @returns
|
||||
*/
|
||||
const getApplicationSetting: (
|
||||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/setting`, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出应用
|
||||
*/
|
||||
|
|
@ -141,29 +194,6 @@ const importApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<a
|
|||
return post(`${prefix}/import`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计
|
||||
* @param 参数 application_id, data
|
||||
*/
|
||||
const getStatistics: (
|
||||
application_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return get(`${prefix}/${application_id}/application_stats`, data, loading)
|
||||
}
|
||||
/**
|
||||
* 打开调试对话id
|
||||
* @param application_id 应用id
|
||||
* @param loading 加载器
|
||||
* @returns
|
||||
*/
|
||||
const open: (application_id: string, loading?: Ref<boolean>) => Promise<Result<string>> = (
|
||||
application_id,
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix}/${application_id}/open`, {}, loading)
|
||||
}
|
||||
/**
|
||||
* 对话
|
||||
* @param 参数
|
||||
|
|
@ -218,67 +248,6 @@ const updatePlatformConfig: (
|
|||
) => Promise<Result<any>> = (application_id, type, data, loading) => {
|
||||
return post(`${prefix}/${application_id}/platform/${type}`, data, undefined, loading)
|
||||
}
|
||||
/**
|
||||
* 应用发布
|
||||
* @param application_id
|
||||
* @param loading
|
||||
* @returns
|
||||
*/
|
||||
const publish: (
|
||||
application_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return put(`${prefix}/${application_id}/publish`, data, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param application_id
|
||||
* @param data
|
||||
* @param loading
|
||||
* @returns
|
||||
*/
|
||||
const playDemoText: (application_id: string, data: any, loading?: Ref<boolean>) => Promise<any> = (
|
||||
application_id,
|
||||
data,
|
||||
loading,
|
||||
) => {
|
||||
return download(
|
||||
`${prefix}/${application_id}/play_demo_text`,
|
||||
'post',
|
||||
data,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本转语音
|
||||
*/
|
||||
const postTextToSpeech: (
|
||||
application_id: String,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return download(
|
||||
`${prefix}/${application_id}/text_to_speech`,
|
||||
'post',
|
||||
data,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 语音转文本
|
||||
*/
|
||||
const speechToText: (
|
||||
application_id: String,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return post(`${prefix}/${application_id}/speech_to_text`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* mcp 节点
|
||||
|
|
@ -291,9 +260,7 @@ const getMcpTools: (application_id: String, loading?: Ref<boolean>) => Promise<R
|
|||
}
|
||||
|
||||
export default {
|
||||
getAllApplication,
|
||||
getApplication,
|
||||
postApplication,
|
||||
putApplication,
|
||||
delApplication,
|
||||
getApplicationDetail,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,192 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, exportExcelPost, del, put } from '@/request/index'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
import { type Ref } from 'vue'
|
||||
|
||||
const prefix = '/system/resource/application'
|
||||
/**
|
||||
* 对话记录提交至知识库
|
||||
* @param data
|
||||
* @param loading
|
||||
* @param application_id
|
||||
* @param knowledge_id
|
||||
*/
|
||||
|
||||
const postChatLogAddKnowledge: (
|
||||
application_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
||||
return post(`${prefix}/${application_id}/add_knowledge`, data, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话日志
|
||||
* @param 参数
|
||||
* application_id
|
||||
* param {
|
||||
"start_time": "string",
|
||||
"end_time": "string",
|
||||
}
|
||||
*/
|
||||
const getChatLog: (
|
||||
application_id: String,
|
||||
page: pageRequest,
|
||||
param: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, page, param, loading) => {
|
||||
return get(
|
||||
`${prefix}/${application_id}/chat/${page.current_page}/${page.page_size}`,
|
||||
param,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对话日志记录
|
||||
* @param 参数
|
||||
* application_id, chart_id,order_asc
|
||||
*/
|
||||
const getChatRecordLog: (
|
||||
application_id: String,
|
||||
chart_id: String,
|
||||
page: pageRequest,
|
||||
loading?: Ref<boolean>,
|
||||
order_asc?: boolean,
|
||||
) => Promise<Result<any>> = (application_id, chart_id, page, loading, order_asc) => {
|
||||
return get(
|
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${page.current_page}/${page.page_size}`,
|
||||
{ order_asc: order_asc !== undefined ? order_asc : true },
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标注段落列表信息
|
||||
* @param 参数
|
||||
* application_id, chart_id, chart_record_id
|
||||
*/
|
||||
const getMarkChatRecord: (
|
||||
application_id: string,
|
||||
chart_id: string,
|
||||
chart_record_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, chart_id, chart_record_id, loading) => {
|
||||
return get(
|
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/improve`,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改日志记录内容
|
||||
* @param 参数
|
||||
* application_id, chart_id, chart_record_id, knowledge_id, document_id
|
||||
* data {
|
||||
"title": "string",
|
||||
"content": "string",
|
||||
"problem_text": "string"
|
||||
}
|
||||
*/
|
||||
const putChatRecordLog: (
|
||||
application_id: String,
|
||||
chart_id: String,
|
||||
chart_record_id: String,
|
||||
knowledge_id: String,
|
||||
document_id: String,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
chart_id,
|
||||
chart_record_id,
|
||||
knowledge_id,
|
||||
document_id,
|
||||
data,
|
||||
loading,
|
||||
) => {
|
||||
return put(
|
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/improve`,
|
||||
data,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除标注
|
||||
* @param 参数
|
||||
* application_id, chart_id, chart_record_id, knowledge_id, document_id,paragraph_id
|
||||
*/
|
||||
const delMarkChatRecord: (
|
||||
application_id: String,
|
||||
chart_id: String,
|
||||
chart_record_id: String,
|
||||
knowledge_id: String,
|
||||
document_id: String,
|
||||
paragraph_id: String,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
chart_id,
|
||||
chart_record_id,
|
||||
knowledge_id,
|
||||
document_id,
|
||||
paragraph_id,
|
||||
loading,
|
||||
) => {
|
||||
return del(
|
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/paragraph/${paragraph_id}/improve`,
|
||||
undefined,
|
||||
{},
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出对话日志
|
||||
* @param 参数
|
||||
* application_id
|
||||
* param {
|
||||
"start_time": "string",
|
||||
"end_time": "string",
|
||||
}
|
||||
*/
|
||||
const postExportChatLog: (
|
||||
application_id: string,
|
||||
application_name: string,
|
||||
param: any,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => void = (application_id, application_name, param, data, loading) => {
|
||||
exportExcelPost(
|
||||
application_name + '.xlsx',
|
||||
`${prefix}/${application_id}/chat/export`,
|
||||
param,
|
||||
data,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
const getChatRecordDetails: (
|
||||
application_id: string,
|
||||
chat_id: string,
|
||||
chat_record_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<any> = (application_id, chat_id, chat_record_id, loading) => {
|
||||
return get(
|
||||
`${prefix}/${application_id}/chat/${chat_id}/chat_record/${chat_record_id}`,
|
||||
{},
|
||||
loading,
|
||||
)
|
||||
}
|
||||
export default {
|
||||
postChatLogAddKnowledge,
|
||||
getChatLog,
|
||||
getChatRecordLog,
|
||||
getMarkChatRecord,
|
||||
putChatRecordLog,
|
||||
delMarkChatRecord,
|
||||
postExportChatLog,
|
||||
getChatRecordDetails,
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, put } from '@/request/index'
|
||||
import { type Ref } from 'vue'
|
||||
|
||||
const prefix = '/system/resource/application'
|
||||
|
||||
/**
|
||||
* workflow历史版本
|
||||
*/
|
||||
const getWorkFlowVersion: (
|
||||
application_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, loading) => {
|
||||
return get(`${prefix}/${application_id}/application_version`, undefined, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* workflow历史版本详情
|
||||
*/
|
||||
const getWorkFlowVersionDetail: (
|
||||
application_id: string,
|
||||
application_version_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, application_version_id, loading) => {
|
||||
return get(
|
||||
`${prefix}/${application_id}/application_version/${application_version_id}`,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 修改workflow历史版本
|
||||
*/
|
||||
const putWorkFlowVersion: (
|
||||
application_id: string,
|
||||
application_version_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (application_id, application_version_id, data, loading) => {
|
||||
return put(
|
||||
`${prefix}/${application_id}/application_version/${application_version_id}`,
|
||||
data,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
export default {
|
||||
getWorkFlowVersion,
|
||||
getWorkFlowVersionDetail,
|
||||
putWorkFlowVersion,
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ interface ApplicationFormType {
|
|||
tts_autoplay?: boolean
|
||||
stt_autosend?: boolean
|
||||
folder_id?: string
|
||||
workspace_id?: string
|
||||
}
|
||||
interface Chunk {
|
||||
real_node_id: string
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import { t } from '@/locales'
|
|||
import useStore from '@/stores'
|
||||
import { SourceTypeEnum } from '@/enums/common'
|
||||
import KnowledgeApi from '@/api/knowledge/knowledge'
|
||||
import ApplicationApi from '@/api/application/application'
|
||||
import ToolApi from '@/api/tool/tool'
|
||||
const { folder, application } = useStore()
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
|
@ -119,7 +120,7 @@ const submitHandle = async () => {
|
|||
dialogVisible.value = false
|
||||
})
|
||||
} else if (props.source === SourceTypeEnum.APPLICATION) {
|
||||
application.asyncPutApplication(detail.value.id, obj, loading).then((res) => {
|
||||
ApplicationApi.putApplication(detail.value.id, obj, loading).then((res) => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
emit('refresh', detail.value)
|
||||
dialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -191,27 +191,24 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
|
||||
function getModelFn() {
|
||||
loading.value = true
|
||||
if (props.apiType === 'systemManage') {
|
||||
modelResourceApi
|
||||
.getSelectModelList({ model_type: 'LLM' }, currentKnowledge.value?.workspace_id)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
loadSharedApi({ type: 'model', systemType: props.apiType })
|
||||
.getSelectModelList({ model_type: 'LLM' })
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
const obj =
|
||||
props.apiType === 'systemManage'
|
||||
? {
|
||||
model_type: 'LLM',
|
||||
workspace_id: currentKnowledge.value?.workspace_id,
|
||||
}
|
||||
: {
|
||||
model_type: 'LLM',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: props.apiType })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open, dialogVisible })
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@ const route = useRoute()
|
|||
const {
|
||||
meta: { activeMenu },
|
||||
params: { id, folderId },
|
||||
query: { isShared, type },
|
||||
query: { isShared },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management') || type === 'systemManage') {
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
|
|
@ -71,7 +71,7 @@ const isKnowledge = computed(() => {
|
|||
const toBackPath = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return '/system/shared' + activeMenu
|
||||
} else if (route.path.includes('resource-management') || type === 'systemManage') {
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return '/system/resource-management' + activeMenu
|
||||
} else {
|
||||
return activeMenu
|
||||
|
|
@ -93,8 +93,8 @@ function getKnowledgeDetail() {
|
|||
|
||||
function getApplicationDetail() {
|
||||
loading.value = true
|
||||
application
|
||||
.asyncGetApplicationDetail(id)
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationDetail(id)
|
||||
.then((res: any) => {
|
||||
current.value = res.data
|
||||
loading.value = false
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ const props = defineProps<{
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, type },
|
||||
params: { id, type, from },
|
||||
} = route as any
|
||||
|
||||
function showMenu() {
|
||||
|
|
@ -60,7 +60,7 @@ function showMenu() {
|
|||
|
||||
function clickHandle(item?: any) {
|
||||
if (isWorkFlow(type) && item?.name === 'AppSetting') {
|
||||
router.push({ path: `/application/${id}/workflow` })
|
||||
router.push({ path: `/application/${from}/${id}/workflow` })
|
||||
}
|
||||
}
|
||||
const menuIcon = computed(() => {
|
||||
|
|
|
|||
|
|
@ -33,10 +33,15 @@ import { useRoute } from 'vue-router'
|
|||
const route = useRoute()
|
||||
const {
|
||||
params: { folderId }, // id为knowledgeID
|
||||
query: { type },
|
||||
query: { from },
|
||||
} = route as any
|
||||
const isShared = computed(() => {
|
||||
return folderId === 'shared' || type === 'systemShare' || type === 'systemManage'
|
||||
return (
|
||||
folderId === 'shared' ||
|
||||
from === 'systemShare' ||
|
||||
from === 'systemManage' ||
|
||||
folderId === 'resource-management'
|
||||
)
|
||||
})
|
||||
const { theme, user } = useStore()
|
||||
const isDefaultTheme = computed(() => {
|
||||
|
|
|
|||
|
|
@ -12,10 +12,15 @@ const isDefaultTheme = computed(() => {
|
|||
})
|
||||
const {
|
||||
params: { folderId }, // id为knowledgeID
|
||||
query: { type },
|
||||
query: { from },
|
||||
} = route as any
|
||||
const isShared = computed(() => {
|
||||
return folderId === 'shared' || type === 'systemShare' || type === 'systemManage'
|
||||
return (
|
||||
folderId === 'shared' ||
|
||||
from === 'systemShare' ||
|
||||
from === 'systemManage' ||
|
||||
folderId === 'resource-management'
|
||||
)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import workspace from './workspace'
|
||||
import systemManage from './system-manage'
|
||||
const permission = {
|
||||
workspace,
|
||||
systemManage,
|
||||
}
|
||||
export default permission
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {PermissionConst, RoleConst} from '@/utils/permission/data'
|
|||
const systemManage = {
|
||||
create: () => false,
|
||||
folderCreate: () => false,
|
||||
edit: () =>
|
||||
edit: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -13,7 +13,7 @@ const systemManage = {
|
|||
'OR'
|
||||
),
|
||||
folderEdit: () => false,
|
||||
export: () =>
|
||||
export: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -21,16 +21,16 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
delete: () =>
|
||||
delete: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.RESOURCE_APPLICATION_DELETE
|
||||
PermissionConst.RESOURCE_APPLICATION_DELETE
|
||||
],
|
||||
'OR'
|
||||
),
|
||||
folderDelete: () => false,
|
||||
overview_embed: () =>
|
||||
overview_embed: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -38,7 +38,7 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
overview_access: () =>
|
||||
overview_access: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -46,7 +46,7 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
overview_display: () =>
|
||||
overview_display: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -54,7 +54,7 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
overview_api_key: () =>
|
||||
overview_api_key: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -62,7 +62,7 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
access_edit: () =>
|
||||
access_edit: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -70,7 +70,7 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
application_chat_user_edit: () =>
|
||||
application_chat_user_edit: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -78,7 +78,7 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
chat_log_clear: () =>
|
||||
chat_log_clear: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -86,7 +86,7 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
chat_log_export: () =>
|
||||
chat_log_export: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
|
|
@ -94,12 +94,13 @@ const systemManage = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
chat_log_add_knowledge: () =>
|
||||
chat_log_add_knowledge: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_ADD_KNOWLEDGE
|
||||
],
|
||||
'OR'
|
||||
),
|
||||
}
|
||||
),
|
||||
}
|
||||
export default systemManage
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/dat
|
|||
import { ComplexPermission } from '@/utils/permission/type'
|
||||
|
||||
const ApplicationDetailRouter = {
|
||||
path: '/application/:id/:type',
|
||||
path: '/application/:from/:id/:type',
|
||||
name: 'ApplicationDetail',
|
||||
meta: { title: 'views.applicationOverview.title', activeMenu: '/application', breadcrumb: true },
|
||||
component: () => import('@/layout/layout-template/MainLayout.vue'),
|
||||
|
|
@ -19,7 +19,7 @@ const ApplicationDetailRouter = {
|
|||
iconActive: 'app-all-menu-active',
|
||||
title: 'views.applicationOverview.title',
|
||||
active: 'overview',
|
||||
parentPath: '/application/:id/:type',
|
||||
parentPath: '/application/:from/:id/:type',
|
||||
parentName: 'ApplicationDetail',
|
||||
permission: [
|
||||
() => {
|
||||
|
|
@ -46,7 +46,7 @@ const ApplicationDetailRouter = {
|
|||
iconActive: 'app-setting-active',
|
||||
title: 'common.setting',
|
||||
active: 'setting',
|
||||
parentPath: '/application/:id/:type',
|
||||
parentPath: '/application/:from/:id/:type',
|
||||
parentName: 'ApplicationDetail',
|
||||
permission: [
|
||||
() => {
|
||||
|
|
@ -72,7 +72,7 @@ const ApplicationDetailRouter = {
|
|||
iconActive: 'app-access-active',
|
||||
title: 'views.application.applicationAccess.title',
|
||||
active: 'access',
|
||||
parentPath: '/application/:id/:type',
|
||||
parentPath: '/application/:from/:id/:type',
|
||||
parentName: 'ApplicationDetail',
|
||||
permission: [
|
||||
() => {
|
||||
|
|
@ -96,7 +96,7 @@ const ApplicationDetailRouter = {
|
|||
iconActive: 'app-user-chat',
|
||||
title: 'views.chatUser.title',
|
||||
active: 'chat-user',
|
||||
parentPath: '/application/:id/:type',
|
||||
parentPath: '/application/:from/:id/:type',
|
||||
parentName: 'ApplicationDetail',
|
||||
resourceType: SourceTypeEnum.APPLICATION,
|
||||
permission: [
|
||||
|
|
@ -122,7 +122,7 @@ const ApplicationDetailRouter = {
|
|||
iconActive: 'app-document-active',
|
||||
title: 'views.chatLog.title',
|
||||
active: 'chat-log',
|
||||
parentPath: '/application/:id/:type',
|
||||
parentPath: '/application/:from/:id/:type',
|
||||
parentName: 'ApplicationDetail',
|
||||
permission: [
|
||||
() => {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export const routes: Array<RouteRecordRaw> = [
|
|||
|
||||
// 高级编排
|
||||
{
|
||||
path: '/application/:id/workflow',
|
||||
path: '/application/:from/:id/workflow',
|
||||
name: 'ApplicationWorkflow',
|
||||
meta: {activeMenu: '/application'},
|
||||
component: () => import('@/views/application-workflow/index.vue'),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import useKnowledgeStore from './modules/knowledge'
|
|||
import useModelStore from './modules/model'
|
||||
import usePromptStore from './modules/prompt'
|
||||
import useApplicationStore from './modules/application'
|
||||
import useChatLogStore from './modules/chat-log'
|
||||
import useChatUserStore from './modules/chat-user'
|
||||
import useToolStore from './modules/tool'
|
||||
const useStore = () => ({
|
||||
|
|
@ -20,7 +19,6 @@ const useStore = () => ({
|
|||
model: useModelStore(),
|
||||
prompt: usePromptStore(),
|
||||
application: useApplicationStore(),
|
||||
chatLog: useChatLogStore(),
|
||||
chatUser: useChatUserStore(),
|
||||
tool: useToolStore(),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,51 +1,10 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { type Ref } from 'vue'
|
||||
const useApplicationStore = defineStore('application', {
|
||||
state: () => ({
|
||||
location: `${window.location.origin}${window.MaxKB.chatPrefix ? window.MaxKB.chatPrefix : window.MaxKB.prefix}/`,
|
||||
}),
|
||||
actions: {
|
||||
async asyncGetApplicationDetail(id: string, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
applicationApi
|
||||
.getApplicationDetail(id, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async asyncGetAccessToken(id: string, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
applicationApi
|
||||
.getAccessToken(id, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 修改应用
|
||||
async asyncPutApplication(id: string, data: any, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
applicationApi
|
||||
.putApplication(id, data, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
actions: {},
|
||||
})
|
||||
|
||||
export default useApplicationStore
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import chatLogApi from '@/api/application/chat-log'
|
||||
import { type Ref } from 'vue'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
|
||||
const useChatLogStore = defineStore('chatLog',{
|
||||
state: () => ({}),
|
||||
actions: {
|
||||
async asyncGetChatLog(id: string, page: pageRequest, param: any, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
chatLogApi
|
||||
.getChatLog(id, page, param, loading)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
async asyncChatRecordLog(
|
||||
id: string,
|
||||
chatId: string,
|
||||
page: pageRequest,
|
||||
loading?: Ref<boolean>,
|
||||
order_asc?: boolean
|
||||
) {
|
||||
return new Promise((resolve, reject) => {
|
||||
chatLogApi
|
||||
.getChatRecordLog(id, chatId, page, loading, order_asc)
|
||||
.then((data) => {
|
||||
resolve(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
export default useChatLogStore
|
||||
|
|
@ -5,6 +5,10 @@ import problemWorkspaceApi from '@/api/knowledge/problem'
|
|||
import modelWorkspaceApi from '@/api/model/model'
|
||||
import toolWorkspaceApi from '@/api/tool/tool'
|
||||
import chatUserWorkspaceApi from '@/api/chat-user/chat-user'
|
||||
import applicationWorkspaceApi from '@/api/application/application'
|
||||
import applicationKeyWorkspaceApi from '@/api/application/application-key'
|
||||
import workflowVersionWorkspaceApi from '@/api/application/workflow-version'
|
||||
import chatLogWorkspaceApi from '@/api/application/chat-log'
|
||||
import sharedWorkspaceApi from '@/api/shared-workspace'
|
||||
import toolSystemShareApi from '@/api/system-shared/tool'
|
||||
import modelSystemShareApi from '@/api/system-shared/model'
|
||||
|
|
@ -22,6 +26,10 @@ import paragraphResourceApi from '@/api/system-resource-management/paragraph'
|
|||
import problemResourceApi from '@/api/system-resource-management/problem'
|
||||
import modelResourceApi from '@/api/system-resource-management/model'
|
||||
import chatUserResourceApi from '@/api/system-resource-management/chat-user'
|
||||
import applicationResourceApi from '@/api/system-resource-management/application'
|
||||
import applicationKeyResourceApi from '@/api/system-resource-management/application-key'
|
||||
import workflowVersionResourceApi from '@/api/system-resource-management/workflow-version'
|
||||
import chatLogWResourceApi from '@/api/system-resource-management/chat-log'
|
||||
|
||||
// 普通 API
|
||||
const workspaceApiMap = {
|
||||
|
|
@ -33,6 +41,10 @@ const workspaceApiMap = {
|
|||
problem: problemWorkspaceApi,
|
||||
chatUser: chatUserWorkspaceApi,
|
||||
workspace: workspaceApi,
|
||||
application: applicationWorkspaceApi,
|
||||
applicationKey: applicationKeyWorkspaceApi,
|
||||
workflowVersion: workflowVersionWorkspaceApi,
|
||||
chatLog: chatLogWorkspaceApi,
|
||||
} as any
|
||||
|
||||
// 系统分享 API
|
||||
|
|
@ -56,6 +68,10 @@ const systemManageApiMap = {
|
|||
model: modelResourceApi,
|
||||
tool: ToolResourceApi,
|
||||
chatUser: chatUserResourceApi,
|
||||
application: applicationResourceApi,
|
||||
applicationKey: applicationKeyResourceApi,
|
||||
workflowVersion: workflowVersionResourceApi,
|
||||
chatLog: chatLogWResourceApi,
|
||||
} as any
|
||||
|
||||
const data = {
|
||||
|
|
|
|||
|
|
@ -58,19 +58,27 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { copyClick } from '@/utils/clipboard'
|
||||
import applicationKeyApi from '@/api/application/application-key'
|
||||
import SettingAPIKeyDialog from './SettingAPIKeyDialog.vue'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }
|
||||
params: { id },
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['addData'])
|
||||
|
||||
const SettingAPIKeyDialogRef = ref()
|
||||
|
|
@ -96,28 +104,30 @@ function deleteApiKey(row: any) {
|
|||
{
|
||||
confirmButtonText: t('common.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
confirmButtonClass: 'color-danger'
|
||||
}
|
||||
confirmButtonClass: 'color-danger',
|
||||
},
|
||||
)
|
||||
.then(() => {
|
||||
applicationKeyApi.delAPIKey(id as string, row.id, loading).then(() => {
|
||||
MsgSuccess(t('common.deleteSuccess'))
|
||||
getApiKeyList()
|
||||
})
|
||||
loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
|
||||
.delAPIKey(id as string, row.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.deleteSuccess'))
|
||||
getApiKeyList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
async function changeState(row: any) {
|
||||
const obj = {
|
||||
is_active: !row.is_active
|
||||
is_active: !row.is_active,
|
||||
}
|
||||
const str = obj.is_active
|
||||
? t('views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess')
|
||||
: t('views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess')
|
||||
await applicationKeyApi
|
||||
await loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
|
||||
.putAPIKey(id as string, row.id, obj, loading)
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
MsgSuccess(str)
|
||||
getApiKeyList()
|
||||
return true
|
||||
|
|
@ -128,9 +138,11 @@ async function changeState(row: any) {
|
|||
}
|
||||
|
||||
function createApiKey() {
|
||||
applicationKeyApi.postAPIKey(id as string, loading).then((res) => {
|
||||
getApiKeyList()
|
||||
})
|
||||
loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
|
||||
.postAPIKey(id as string, loading)
|
||||
.then(() => {
|
||||
getApiKeyList()
|
||||
})
|
||||
}
|
||||
|
||||
const open = () => {
|
||||
|
|
@ -139,10 +151,12 @@ const open = () => {
|
|||
}
|
||||
|
||||
function getApiKeyList() {
|
||||
applicationKeyApi.getAPIKey(id as string, loading).then((res) => {
|
||||
res.data.sort((x:any,y:any)=>x.name < y.name ? 1 : -1)
|
||||
apiKey.value = res.data
|
||||
})
|
||||
loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
|
||||
.getAPIKey(id as string, loading)
|
||||
.then((res: any) => {
|
||||
res.data?.sort((x: any, y: any) => (x.name < y.name ? 1 : -1))
|
||||
apiKey.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
|
|
|
|||
|
|
@ -47,18 +47,24 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { getBrowserLang, langList, t } from '@/locales'
|
||||
import { langList, t } from '@/locales'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const displayFormRef = ref()
|
||||
|
|
@ -94,12 +100,14 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
applicationApi.putAccessToken(id as string, form.value, loading).then((res) => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putAccessToken(id as string, form.value, loading)
|
||||
.then(() => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,18 +51,25 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const limitFormRef = ref()
|
||||
|
|
@ -107,17 +114,17 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
authentication: form.value.authentication,
|
||||
authentication_value: form.value.authentication_value,
|
||||
}
|
||||
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putAccessToken(id as string, obj, loading)
|
||||
.then(() => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -34,25 +34,33 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import applicationKeyApi from '@/api/application/application-key'
|
||||
import overviewSystemApi from '@/api/system/api-key'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }
|
||||
params: { id },
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const settingFormRef = ref()
|
||||
const form = ref<any>({
|
||||
allow_cross_domain: false,
|
||||
cross_domain_list: ''
|
||||
cross_domain_list: '',
|
||||
})
|
||||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
|
@ -65,7 +73,7 @@ watch(dialogVisible, (bool) => {
|
|||
if (!bool) {
|
||||
form.value = {
|
||||
allow_cross_domain: false,
|
||||
cross_domain_list: ''
|
||||
cross_domain_list: '',
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -90,15 +98,20 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
? form.value.cross_domain_list.split('\n').filter(function (item: string) {
|
||||
return item !== ''
|
||||
})
|
||||
: []
|
||||
: [],
|
||||
}
|
||||
|
||||
const apiCall =
|
||||
APIType.value === 'APPLICATION'
|
||||
? applicationKeyApi.putAPIKey(id as string, APIKeyId.value, obj, loading)
|
||||
? loadSharedApi({ type: 'applicationKey', systemType: apiType.value }).putAPIKey(
|
||||
id as string,
|
||||
APIKeyId.value,
|
||||
obj,
|
||||
loading,
|
||||
)
|
||||
: overviewSystemApi.putAPIKey(APIKeyId.value, obj, loading)
|
||||
|
||||
apiCall.then((res) => {
|
||||
apiCall.then(() => {
|
||||
emit('refresh')
|
||||
//@ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
|
|
|
|||
|
|
@ -206,7 +206,6 @@ import XPackLimitDrawer from './xpack-component/XPackLimitDrawer.vue'
|
|||
import DisplaySettingDialog from './component/DisplaySettingDialog.vue'
|
||||
import XPackDisplaySettingDialog from './xpack-component/XPackDisplaySettingDialog.vue'
|
||||
import StatisticsCharts from './component/StatisticsCharts.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { nowDate, beforeDay } from '@/utils/time'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { copyClick } from '@/utils/clipboard'
|
||||
|
|
@ -217,21 +216,24 @@ import { t } from '@/locales'
|
|||
import { EditionConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
import permissionMap from '@/permission'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed<'workspace'>(() => {
|
||||
return 'workspace'
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['application'][apiType.value]
|
||||
})
|
||||
|
||||
const { user, application } = useStore()
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiUrl = window.location.origin + '/doc_chat/'
|
||||
|
||||
const baseUrl = window.location.origin + `${window.MaxKB.chatPrefix}/api/`
|
||||
|
|
@ -292,7 +294,6 @@ const daterange = ref({
|
|||
const statisticsLoading = ref(false)
|
||||
const statisticsData = ref([])
|
||||
|
||||
const showEditIcon = ref(false)
|
||||
const apiInputParams = ref([])
|
||||
|
||||
function toUrl(url: string) {
|
||||
|
|
@ -313,9 +314,11 @@ function openDisplaySettingDialog() {
|
|||
}
|
||||
nextTick(() => {
|
||||
if (currentDisplaySettingDialog.value == XPackDisplaySettingDialog) {
|
||||
applicationApi.getApplicationSetting(id).then((ok) => {
|
||||
DisplaySettingDialogRef.value?.open(ok.data, detail.value)
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationSetting(id)
|
||||
.then((ok: any) => {
|
||||
DisplaySettingDialogRef.value?.open(ok.data, detail.value)
|
||||
})
|
||||
} else {
|
||||
DisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
|
||||
}
|
||||
|
|
@ -354,9 +357,11 @@ function changeDayRangeHandle(val: string) {
|
|||
}
|
||||
|
||||
function getAppStatistics() {
|
||||
applicationApi.getStatistics(id, daterange.value, statisticsLoading).then((res: any) => {
|
||||
statisticsData.value = res.data
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getStatistics(id, daterange.value, statisticsLoading)
|
||||
.then((res: any) => {
|
||||
statisticsData.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
function refreshAccessToken() {
|
||||
|
|
@ -394,10 +399,12 @@ async function changeState(bool: boolean) {
|
|||
}
|
||||
|
||||
async function updateAccessToken(obj: any, str: string) {
|
||||
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
|
||||
accessToken.value = res?.data
|
||||
MsgSuccess(str)
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putAccessToken(id as string, obj, loading)
|
||||
.then((res: any) => {
|
||||
accessToken.value = res?.data
|
||||
MsgSuccess(str)
|
||||
})
|
||||
}
|
||||
|
||||
function openAPIKeyDialog() {
|
||||
|
|
@ -409,46 +416,46 @@ function openDialog() {
|
|||
}
|
||||
|
||||
function getAccessToken() {
|
||||
application.asyncGetAccessToken(id, loading).then((res: any) => {
|
||||
accessToken.value = res?.data
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getAccessToken(id, loading)
|
||||
.then((res: any) => {
|
||||
accessToken.value = res?.data
|
||||
})
|
||||
}
|
||||
|
||||
function getDetail() {
|
||||
application.asyncGetApplicationDetail(id, loading).then((res: any) => {
|
||||
detail.value = res.data
|
||||
detail.value.work_flow?.nodes
|
||||
?.filter((v: any) => v.id === 'base-node')
|
||||
.map((v: any) => {
|
||||
apiInputParams.value = v.properties.api_input_field_list
|
||||
? v.properties.api_input_field_list.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: v.properties.input_field_list
|
||||
? v.properties.input_field_list
|
||||
.filter((v: any) => v.assignment_method === 'api_input')
|
||||
.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: []
|
||||
})
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
detail.value = res.data
|
||||
detail.value.work_flow?.nodes
|
||||
?.filter((v: any) => v.id === 'base-node')
|
||||
.map((v: any) => {
|
||||
apiInputParams.value = v.properties.api_input_field_list
|
||||
? v.properties.api_input_field_list.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: v.properties.input_field_list
|
||||
? v.properties.input_field_list
|
||||
.filter((v: any) => v.assignment_method === 'api_input')
|
||||
.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: []
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
getAccessToken()
|
||||
}
|
||||
|
||||
function refreshIcon() {
|
||||
getDetail()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDetail()
|
||||
getAccessToken()
|
||||
|
|
|
|||
|
|
@ -481,11 +481,11 @@ import { computed, ref, watch } from 'vue'
|
|||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
|
||||
import { isAppIcon } from '@/utils/common'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { langList, t } from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const { user } = useStore()
|
||||
|
||||
|
|
@ -494,6 +494,14 @@ const {
|
|||
params: { id },
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const defaultSetting = {
|
||||
|
|
@ -663,12 +671,14 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
fd.append(item, xpackForm.value[item])
|
||||
}
|
||||
})
|
||||
applicationApi.putXpackAccessToken(id as string, fd, loading).then((res) => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putXpackAccessToken(id as string, fd, loading)
|
||||
.then(() => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,13 +144,13 @@
|
|||
</el-drawer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { copyClick } from '@/utils/clipboard'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
|
@ -158,6 +158,13 @@ const {
|
|||
params: { id },
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['refresh'])
|
||||
const auth_list = ref<Array<{ label: string; value: string }>>([])
|
||||
const limitFormRef = ref()
|
||||
|
|
@ -198,9 +205,11 @@ const open = (data: any) => {
|
|||
}
|
||||
form.value.authentication = data.authentication
|
||||
dialogVisible.value = true
|
||||
applicationApi.getChatUserAuthType().then((ok) => {
|
||||
auth_list.value = ok.data
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getChatUserAuthType()
|
||||
.then((ok: any) => {
|
||||
auth_list.value = ok.data
|
||||
})
|
||||
}
|
||||
|
||||
const submit = async (formEl: FormInstance | undefined) => {
|
||||
|
|
@ -214,12 +223,14 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
authentication: form.value.authentication,
|
||||
authentication_value: form.value.authentication_value,
|
||||
}
|
||||
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putAccessToken(id as string, obj, loading)
|
||||
.then(() => {
|
||||
emit('refresh')
|
||||
// @ts-ignore
|
||||
MsgSuccess(t('common.settingSuccess'))
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ import { isWorkFlow } from '@/utils/application'
|
|||
import useStore from '@/stores'
|
||||
import NodeContent from './NodeContent.vue'
|
||||
import { SourceTypeEnum } from '@/enums/common'
|
||||
import ApplicationApi from '@/api/application/application'
|
||||
import permissionMap from '@/permission'
|
||||
import { useRoute } from 'vue-router'
|
||||
const route = useRoute()
|
||||
|
|
@ -149,9 +148,7 @@ const props = defineProps({
|
|||
const emit = defineEmits(['clickNodes', 'onmousedown'])
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
|
|
@ -256,8 +253,7 @@ async function getToolFolder() {
|
|||
async function getToolList() {
|
||||
const res = await loadSharedApi({
|
||||
type: 'tool',
|
||||
isShared: isShared.value,
|
||||
systemType: apiType.value,
|
||||
systemType: 'workspace',
|
||||
}).getToolList({
|
||||
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
|
||||
})
|
||||
|
|
@ -276,10 +272,13 @@ function getApplicationFolder() {
|
|||
}
|
||||
|
||||
async function getApplicationList() {
|
||||
const res = await ApplicationApi.getAllApplication({
|
||||
const res = await loadSharedApi({
|
||||
type: 'application',
|
||||
systemType: 'workspace',
|
||||
}).getAllApplication({
|
||||
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
|
||||
})
|
||||
applicationList.value = res.data.filter((item) => item.resource_type === 'application')
|
||||
applicationList.value = res.data.filter((item: any) => item.resource_type === 'application')
|
||||
}
|
||||
|
||||
function folderClickHandle(row: any) {
|
||||
|
|
|
|||
|
|
@ -71,14 +71,21 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import workFlowVersionApi from '@/api/application/workflow-version'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }
|
||||
params: { id },
|
||||
} = route as any
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['click', 'refreshVersion'])
|
||||
const loading = ref(false)
|
||||
|
|
@ -109,22 +116,26 @@ function closeWrite(item: any) {
|
|||
function editName(val: string, item: any) {
|
||||
if (val) {
|
||||
const obj = {
|
||||
name: val
|
||||
name: val,
|
||||
}
|
||||
workFlowVersionApi.putWorkFlowVersion(id as string, item.id, obj, loading).then(() => {
|
||||
MsgSuccess(t('common.modifySuccess'))
|
||||
item['writeStatus'] = false
|
||||
getList()
|
||||
})
|
||||
loadSharedApi({ type: 'workflowVersion', systemType: apiType.value })
|
||||
.putWorkFlowVersion(id as string, item.id, obj, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.modifySuccess'))
|
||||
item['writeStatus'] = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
MsgError(t('views.applicationWorkflow.tip.nameMessage'))
|
||||
}
|
||||
}
|
||||
|
||||
function getList() {
|
||||
workFlowVersionApi.getWorkFlowVersion(id, loading).then((res: any) => {
|
||||
LogData.value = res.data
|
||||
})
|
||||
loadSharedApi({ type: 'workflowVersion', systemType: apiType.value })
|
||||
.getWorkFlowVersion(id, loading)
|
||||
.then((res: any) => {
|
||||
LogData.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ import type { Action } from 'element-plus'
|
|||
import Workflow from '@/workflow/index.vue'
|
||||
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
|
||||
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
|
||||
import ApplicationAPI from '@/api/application/application'
|
||||
import { isAppIcon, resetUrl } from '@/utils/common'
|
||||
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
|
|
@ -152,17 +151,25 @@ import { hasPermission } from '@/utils/permission'
|
|||
import { t } from '@/locales'
|
||||
import { ComplexPermission } from '@/utils/permission/type'
|
||||
import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const { theme, application } = useStore()
|
||||
const { theme } = useStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const isDefaultTheme = computed(() => {
|
||||
return theme.isDefaultTheme()
|
||||
})
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
let interval: any
|
||||
const workflowRef = ref()
|
||||
|
|
@ -285,9 +292,14 @@ const publish = () => {
|
|||
MsgError(e.toString())
|
||||
return
|
||||
}
|
||||
ApplicationAPI.putApplication(id, { work_flow: workflow }, loading)
|
||||
.then((ok) => {
|
||||
return ApplicationAPI.publish(id, {}, loading)
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putApplication(id, { work_flow: workflow }, loading)
|
||||
.then(() => {
|
||||
return loadSharedApi({ type: 'application', systemType: apiType.value }).publish(
|
||||
id,
|
||||
{},
|
||||
loading,
|
||||
)
|
||||
})
|
||||
.then((ok: any) => {
|
||||
detail.value.name = ok.data.name
|
||||
|
|
@ -372,51 +384,57 @@ function getGraphData() {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
application.asyncGetApplicationDetail(id).then((res: any) => {
|
||||
res.data?.work_flow['nodes'].map((v: any) => {
|
||||
v['properties']['noRender'] = true
|
||||
})
|
||||
detail.value = res.data
|
||||
detail.value.stt_model_id = res.data.stt_model
|
||||
detail.value.tts_model_id = res.data.tts_model
|
||||
detail.value.tts_type = res.data.tts_type
|
||||
saveTime.value = res.data?.update_time
|
||||
detail.value.work_flow?.nodes
|
||||
?.filter((v: any) => v.id === 'base-node')
|
||||
.map((v: any) => {
|
||||
apiInputParams.value = v.properties.api_input_field_list
|
||||
? v.properties.api_input_field_list.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: v.properties.input_field_list
|
||||
? v.properties.input_field_list
|
||||
.filter((v: any) => v.assignment_method === 'api_input')
|
||||
.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: []
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationDetail(id)
|
||||
.then((res: any) => {
|
||||
res.data?.work_flow['nodes'].map((v: any) => {
|
||||
v['properties']['noRender'] = true
|
||||
})
|
||||
application.asyncGetAccessToken(id, loading).then((res: any) => {
|
||||
detail.value = { ...detail.value, ...res.data }
|
||||
})
|
||||
workflowRef.value?.clearGraphData()
|
||||
nextTick(() => {
|
||||
workflowRef.value?.render(detail.value.work_flow)
|
||||
cloneWorkFlow.value = getGraphData()
|
||||
})
|
||||
// 企业版和专业版
|
||||
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
|
||||
ApplicationAPI.getApplicationSetting(id).then((ok) => {
|
||||
detail.value = { ...detail.value, ...ok.data }
|
||||
detail.value = res.data
|
||||
detail.value.stt_model_id = res.data.stt_model
|
||||
detail.value.tts_model_id = res.data.tts_model
|
||||
detail.value.tts_type = res.data.tts_type
|
||||
saveTime.value = res.data?.update_time
|
||||
detail.value.work_flow?.nodes
|
||||
?.filter((v: any) => v.id === 'base-node')
|
||||
.map((v: any) => {
|
||||
apiInputParams.value = v.properties.api_input_field_list
|
||||
? v.properties.api_input_field_list.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: v.properties.input_field_list
|
||||
? v.properties.input_field_list
|
||||
.filter((v: any) => v.assignment_method === 'api_input')
|
||||
.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: []
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getAccessToken(id, loading)
|
||||
.then((res: any) => {
|
||||
detail.value = { ...detail.value, ...res.data }
|
||||
})
|
||||
workflowRef.value?.clearGraphData()
|
||||
nextTick(() => {
|
||||
workflowRef.value?.render(detail.value.work_flow)
|
||||
cloneWorkFlow.value = getGraphData()
|
||||
})
|
||||
}
|
||||
})
|
||||
// 企业版和专业版
|
||||
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationSetting(id)
|
||||
.then((ok: any) => {
|
||||
detail.value = { ...detail.value, ...ok.data }
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function saveApplication(bool?: boolean, back?: boolean) {
|
||||
|
|
@ -424,9 +442,9 @@ function saveApplication(bool?: boolean, back?: boolean) {
|
|||
work_flow: getGraphData(),
|
||||
}
|
||||
loading.value = back || false
|
||||
application
|
||||
.asyncPutApplication(id, obj)
|
||||
.then((res) => {
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putApplication(id, obj)
|
||||
.then(() => {
|
||||
saveTime.value = new Date()
|
||||
if (bool) {
|
||||
cloneWorkFlow.value = getGraphData()
|
||||
|
|
@ -627,5 +645,4 @@ onBeforeUnmount(() => {
|
|||
height: 600px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<el-card shadow="hover" class="border-none cursor">
|
||||
<div class="flex-between">
|
||||
<div class="flex align-center ml-8 mr-8">
|
||||
<img :src="item.logoSrc" alt="" class="icon"/>
|
||||
<img :src="item.logoSrc" alt="" class="icon" />
|
||||
<div class="ml-12">
|
||||
<h5 class="mb-4">{{ item.name }}</h5>
|
||||
<el-text type="info" style="font-size: 12px">{{ item.description }}</el-text>
|
||||
|
|
@ -31,11 +31,12 @@
|
|||
v-if="permissionPrecise.access_edit(id)"
|
||||
/>
|
||||
<el-divider direction="vertical" />
|
||||
<el-button class="mr-4" @click="openDrawer(item.key)"
|
||||
<el-button
|
||||
class="mr-4"
|
||||
@click="openDrawer(item.key)"
|
||||
v-if="permissionPrecise.access_edit(id)"
|
||||
>{{
|
||||
$t('views.application.applicationAccess.setting')
|
||||
}}</el-button>
|
||||
>{{ $t('views.application.applicationAccess.setting') }}</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
|
@ -48,16 +49,19 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
import AccessSettingDrawer from './component/AccessSettingDrawer.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { t } from '@/locales'
|
||||
import permissionMap from '@/permission'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed<'workspace'>(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['application'][apiType.value]
|
||||
|
|
@ -123,13 +127,15 @@ function refresh() {
|
|||
|
||||
function getPlatformStatus() {
|
||||
loading.value = true
|
||||
applicationApi.getPlatformStatus(id).then((res: any) => {
|
||||
platforms.forEach((platform) => {
|
||||
platform.isActive = res.data[platform.key][1]
|
||||
platform.exists = res.data[platform.key][0]
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getPlatformStatus(id)
|
||||
.then((res: any) => {
|
||||
platforms.forEach((platform) => {
|
||||
platform.isActive = res.data[platform.key][1]
|
||||
platform.exists = res.data[platform.key][0]
|
||||
})
|
||||
loading.value = false
|
||||
})
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function changeStatus(type: string, value: boolean) {
|
||||
|
|
@ -137,9 +143,11 @@ function changeStatus(type: string, value: boolean) {
|
|||
type: type,
|
||||
status: value,
|
||||
}
|
||||
applicationApi.updatePlatformStatus(id, data).then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.updatePlatformStatus(id, data)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -446,28 +446,31 @@ import type { FormInstance, FormRules } from 'element-plus'
|
|||
import type { ApplicationFormType } from '@/api/type/application'
|
||||
import { relatedObject } from '@/utils/array'
|
||||
import { MsgSuccess, MsgWarning } from '@/utils/message'
|
||||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
import TTSModeParamSettingDialog from './component/TTSModeParamSettingDialog.vue'
|
||||
import ReasoningParamSettingDialog from './component/ReasoningParamSettingDialog.vue'
|
||||
import permissionMap from '@/permission'
|
||||
import ApplicationAPI from '@/api/application/application'
|
||||
import { EditionConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed<'workspace'>(() => {
|
||||
return 'workspace'
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['application'][apiType.value]
|
||||
})
|
||||
|
||||
const { knowledge, model, application } = useStore()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
// @ts-ignore
|
||||
const defaultPrompt = t('views.application.form.prompt.defaultPrompt', {
|
||||
data: '{data}',
|
||||
|
|
@ -562,11 +565,16 @@ function submitReasoningDialog(val: any) {
|
|||
const publish = (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
formEl.validate().then(() => {
|
||||
return ApplicationAPI.putApplication(id, applicationForm.value, loading)
|
||||
.then((ok) => {
|
||||
return ApplicationAPI.publish(id, {}, loading)
|
||||
return loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putApplication(id, applicationForm.value, loading)
|
||||
.then(() => {
|
||||
return loadSharedApi({ type: 'application', systemType: apiType.value }).publish(
|
||||
id,
|
||||
{},
|
||||
loading,
|
||||
)
|
||||
})
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.application.tip.publishSuccess'))
|
||||
})
|
||||
})
|
||||
|
|
@ -575,9 +583,11 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
application.asyncPutApplication(id, applicationForm.value, loading).then((res) => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putApplication(id, applicationForm.value, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -648,29 +658,43 @@ function openKnowledgeDialog() {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
application.asyncGetApplicationDetail(id, loading).then((res: any) => {
|
||||
applicationForm.value = res.data
|
||||
applicationForm.value.model_id = res.data.model
|
||||
applicationForm.value.stt_model_id = res.data.stt_model
|
||||
applicationForm.value.tts_model_id = res.data.tts_model
|
||||
applicationForm.value.tts_type = res.data.tts_type
|
||||
knowledgeList.value = res.data.knowledge_list
|
||||
applicationForm.value.model_setting.no_references_prompt =
|
||||
res.data.model_setting.no_references_prompt || '{question}'
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
applicationForm.value = res.data
|
||||
applicationForm.value.model_id = res.data.model
|
||||
applicationForm.value.stt_model_id = res.data.stt_model
|
||||
applicationForm.value.tts_model_id = res.data.tts_model
|
||||
applicationForm.value.tts_type = res.data.tts_type
|
||||
knowledgeList.value = res.data.knowledge_list
|
||||
applicationForm.value.model_setting.no_references_prompt =
|
||||
res.data.model_setting.no_references_prompt || '{question}'
|
||||
|
||||
// 企业版和专业版
|
||||
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
|
||||
ApplicationAPI.getApplicationSetting(id).then((ok) => {
|
||||
applicationForm.value = { ...applicationForm.value, ...ok.data }
|
||||
})
|
||||
}
|
||||
})
|
||||
// 企业版和专业版
|
||||
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationSetting(id)
|
||||
.then((ok: any) => {
|
||||
applicationForm.value = { ...applicationForm.value, ...ok.data }
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getSelectModel() {
|
||||
loading.value = true
|
||||
model
|
||||
.asyncGetSelectModel({ model_type: 'LLM' })
|
||||
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'LLM',
|
||||
workspace_id: applicationForm.value?.workspace_id,
|
||||
}
|
||||
: {
|
||||
model_type: 'LLM',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
@ -682,8 +706,17 @@ function getSelectModel() {
|
|||
|
||||
function getSTTModel() {
|
||||
loading.value = true
|
||||
model
|
||||
.asyncGetSelectModel({ model_type: 'STT' })
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'STT',
|
||||
workspace_id: applicationForm.value?.workspace_id,
|
||||
}
|
||||
: {
|
||||
model_type: 'STT',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
sttModelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
@ -695,8 +728,17 @@ function getSTTModel() {
|
|||
|
||||
function getTTSModel() {
|
||||
loading.value = true
|
||||
model
|
||||
.asyncGetSelectModel({ model_type: 'TTS' })
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'TTS',
|
||||
workspace_id: applicationForm.value?.workspace_id,
|
||||
}
|
||||
: {
|
||||
model_type: 'TTS',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
ttsModelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@
|
|||
<el-button @click.prevent="dialogVisible = false">
|
||||
{{ $t('common.cancel') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="submit" :loading="loading"
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="submit"
|
||||
:loading="loading"
|
||||
v-if="permissionPrecise.paramSetting(modelID)"
|
||||
>
|
||||
{{ $t('common.confirm') }}
|
||||
|
|
@ -37,11 +40,19 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import type { FormField } from '@/components/dynamics-form/type'
|
||||
import modelAPi from '@/api/model/model'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { useRoute } from 'vue-router'
|
||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||
import permissionMap from '@/permission'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const model_form_field = ref<Array<FormField>>([])
|
||||
const emit = defineEmits(['refresh'])
|
||||
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
|
||||
|
|
@ -49,20 +60,23 @@ const form_data = ref<any>({})
|
|||
const dialogVisible = ref(false)
|
||||
const loading = ref(false)
|
||||
const getApi = (model_id: string, application_id?: string) => {
|
||||
return modelAPi.getModelParamsForm(model_id, loading)
|
||||
return loadSharedApi({ type: 'model', systemType: apiType.value }).getModelParamsForm(
|
||||
model_id,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
const modelID = ref('')
|
||||
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['model']['workspace']
|
||||
return permissionMap['model'][apiType.value]
|
||||
})
|
||||
|
||||
const open = (model_id: string, application_id?: string, model_setting_data?: any) => {
|
||||
modelID.value = model_id
|
||||
form_data.value = {}
|
||||
const api = getApi(model_id, application_id)
|
||||
api.then((ok) => {
|
||||
api.then((ok: any) => {
|
||||
model_form_field.value = ok.data
|
||||
// 渲染动态表单
|
||||
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
|
||||
|
|
@ -72,17 +86,17 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
|
|||
|
||||
const reset_default = (model_id: string, application_id?: string) => {
|
||||
const api = getApi(model_id, application_id)
|
||||
api.then((ok) => {
|
||||
api.then((ok: any) => {
|
||||
model_form_field.value = ok.data
|
||||
const model_setting_data = ok.data
|
||||
.map((item) => {
|
||||
.map((item: any) => {
|
||||
if (item.show_default_value === false) {
|
||||
return { [item.field]: undefined }
|
||||
} else {
|
||||
return { [item.field]: item.default_value }
|
||||
}
|
||||
})
|
||||
.reduce((x, y) => ({ ...x, ...y }), {})
|
||||
.reduce((x: any, y: any) => ({ ...x, ...y }), {})
|
||||
|
||||
emit('refresh', model_setting_data)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -101,24 +101,31 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { MsgError, MsgSuccess } from '@/utils/message'
|
||||
import { copyClick } from '@/utils/clipboard'
|
||||
import { t } from '@/locales'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
type PlatformType = 'wechat' | 'dingtalk' | 'wecom' | 'lark' | 'slack'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['refresh'])
|
||||
const formRef = ref<FormInstance>()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const dataLoaded = ref(false)
|
||||
const configType = ref<PlatformType>('wechat')
|
||||
const route = useRoute()
|
||||
const emit = defineEmits(['refresh'])
|
||||
const {
|
||||
params: { id }
|
||||
} = route as any
|
||||
|
||||
const form = reactive<any>({
|
||||
wechat: {
|
||||
|
|
@ -127,7 +134,7 @@ const form = reactive<any>({
|
|||
token: '',
|
||||
encoding_aes_key: '',
|
||||
is_certification: false,
|
||||
callback_url: ''
|
||||
callback_url: '',
|
||||
},
|
||||
dingtalk: { client_id: '', client_secret: '', callback_url: '' },
|
||||
wecom: {
|
||||
|
|
@ -136,10 +143,10 @@ const form = reactive<any>({
|
|||
secret: '',
|
||||
token: '',
|
||||
encoding_aes_key: '',
|
||||
callback_url: ''
|
||||
callback_url: '',
|
||||
},
|
||||
lark: { app_id: '', app_secret: '', verification_token: '', callback_url: '' },
|
||||
slack: { signing_secret: '', bot_user_token: '', callback_url: '' }
|
||||
slack: { signing_secret: '', bot_user_token: '', callback_url: '' },
|
||||
})
|
||||
|
||||
const rules = reactive<{ [propName: string]: any }>({
|
||||
|
|
@ -148,164 +155,164 @@ const rules = reactive<{ [propName: string]: any }>({
|
|||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wechatSetting.appIdPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
app_secret: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wechatSetting.appSecretPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
token: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wechatSetting.tokenPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
encoding_aes_key: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wechatSetting.aesKeyPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
dingtalk: {
|
||||
client_id: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.dingtalkSetting.clientIdPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
client_secret: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.dingtalkSetting.clientSecretPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
wecom: {
|
||||
app_id: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wecomSetting.cropIdPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
agent_id: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wecomSetting.agentIdPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
secret: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wecomSetting.secretPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
token: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wecomSetting.tokenPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
encoding_aes_key: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.wecomSetting.encodingAesKeyPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
lark: {
|
||||
app_id: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.larkSetting.appIdPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
app_secret: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.larkSetting.appSecretPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
verification_token: [
|
||||
{
|
||||
required: false,
|
||||
message: t('views.application.applicationAccess.larkSetting.verificationTokenPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
slack: {
|
||||
signing_secret: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.slackSetting.signingSecretPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
bot_user_token: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.application.applicationAccess.slackSetting.botUserTokenPlaceholder'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
const configFields: { [propName: string]: { [propName: string]: any } } = {
|
||||
wechat: {
|
||||
app_id: {
|
||||
label: t('views.application.applicationAccess.wechatSetting.appId'),
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
app_secret: {
|
||||
label: t('views.application.applicationAccess.wechatSetting.appSecret'),
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
token: { label: t('views.application.applicationAccess.wechatSetting.token'), placeholder: '' },
|
||||
encoding_aes_key: {
|
||||
label: t('views.application.applicationAccess.wechatSetting.aesKey'),
|
||||
placeholder: ''
|
||||
}
|
||||
placeholder: '',
|
||||
},
|
||||
},
|
||||
dingtalk: {
|
||||
client_id: { label: 'Client ID', placeholder: '' },
|
||||
client_secret: { label: 'Client Secret', placeholder: '' }
|
||||
client_secret: { label: 'Client Secret', placeholder: '' },
|
||||
},
|
||||
wecom: {
|
||||
app_id: {
|
||||
label: t('views.application.applicationAccess.wecomSetting.cropId'),
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
agent_id: { label: 'Agent ID', placeholder: '' },
|
||||
secret: { label: 'Secret', placeholder: '' },
|
||||
token: { label: 'Token', placeholder: '' },
|
||||
encoding_aes_key: { label: 'EncodingAESKey', placeholder: '' }
|
||||
encoding_aes_key: { label: 'EncodingAESKey', placeholder: '' },
|
||||
},
|
||||
lark: {
|
||||
app_id: { label: 'App ID', placeholder: '' },
|
||||
app_secret: { label: 'App Secret', placeholder: '' },
|
||||
verification_token: { label: 'Verification Token', placeholder: '' }
|
||||
verification_token: { label: 'Verification Token', placeholder: '' },
|
||||
},
|
||||
slack: {
|
||||
signing_secret: { label: 'Signing Secret', placeholder: '' },
|
||||
bot_user_token: { label: 'Bot User Token', placeholder: '' }
|
||||
}
|
||||
bot_user_token: { label: 'Bot User Token', placeholder: '' },
|
||||
},
|
||||
}
|
||||
|
||||
const passwordFields = new Set([
|
||||
|
|
@ -313,7 +320,7 @@ const passwordFields = new Set([
|
|||
'client_secret',
|
||||
'secret',
|
||||
'bot_user_token',
|
||||
'signing_secret'
|
||||
'signing_secret',
|
||||
])
|
||||
|
||||
const drawerTitle = computed(
|
||||
|
|
@ -323,8 +330,8 @@ const drawerTitle = computed(
|
|||
dingtalk: t('views.application.applicationAccess.dingtalkSetting.title'),
|
||||
wecom: t('views.application.applicationAccess.wecomSetting.title'),
|
||||
lark: t('views.application.applicationAccess.larkSetting.title'),
|
||||
slack: t('views.application.applicationAccess.slackSetting.title')
|
||||
}[configType.value])
|
||||
slack: t('views.application.applicationAccess.slackSetting.title'),
|
||||
})[configType.value],
|
||||
)
|
||||
|
||||
const infoTitle = computed(
|
||||
|
|
@ -334,8 +341,8 @@ const infoTitle = computed(
|
|||
dingtalk: t('views.applicationOverview.appInfo.header'),
|
||||
wecom: t('views.applicationOverview.appInfo.header'),
|
||||
lark: t('views.applicationOverview.appInfo.header'),
|
||||
slack: t('views.applicationOverview.appInfo.header')
|
||||
}[configType.value])
|
||||
slack: t('views.applicationOverview.appInfo.header'),
|
||||
})[configType.value],
|
||||
)
|
||||
|
||||
const passwordVisible = reactive<Record<string, boolean>>(
|
||||
|
|
@ -346,8 +353,8 @@ const passwordVisible = reactive<Record<string, boolean>>(
|
|||
}
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, boolean>
|
||||
)
|
||||
{} as Record<string, boolean>,
|
||||
),
|
||||
)
|
||||
|
||||
const isPasswordField = (key: any) => passwordFields.has(key)
|
||||
|
|
@ -362,7 +369,7 @@ const submit = async () => {
|
|||
formRef.value?.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
applicationApi
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.updatePlatformConfig(id, configType.value, form[configType.value], loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
|
|
@ -383,7 +390,10 @@ const open = async (id: string, type: PlatformType) => {
|
|||
dataLoaded.value = false
|
||||
formRef.value?.resetFields()
|
||||
try {
|
||||
const res = await applicationApi.getPlatformConfig(id, type)
|
||||
const res = await loadSharedApi({
|
||||
type: 'application',
|
||||
systemType: apiType.value,
|
||||
}).getPlatformConfig(id, type)
|
||||
if (res.data) {
|
||||
form[configType.value] = res.data
|
||||
}
|
||||
|
|
@ -392,7 +402,8 @@ const open = async (id: string, type: PlatformType) => {
|
|||
MsgError(t('views.application.tip.loadingErrorMessage'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
form[configType.value].callback_url = `${window.location.origin}${window.MaxKB.prefix}/api/chat/${type}/${id}`
|
||||
form[configType.value].callback_url =
|
||||
`${window.location.origin}${window.MaxKB.prefix}/api/chat/${type}/${id}`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ import { MsgSuccess, MsgAlert } from '@/utils/message'
|
|||
import { isWorkFlow } from '@/utils/application'
|
||||
import { t } from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
import { ValidType, ValidCount } from '@/enums/common'
|
||||
const router = useRouter()
|
||||
const { common, user } = useStore()
|
||||
|
||||
|
|
|
|||
|
|
@ -41,18 +41,23 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import type { FormField } from '@/components/dynamics-form/type'
|
||||
import ModelAPI from '@/api/model/model'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { MsgError } from '@/utils/message'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const tts_model_id = ref('')
|
||||
const model_form_field = ref<Array<FormField>>([])
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
|
@ -65,39 +70,43 @@ const playLoading = ref(false)
|
|||
const open = (model_id: string, application_id?: string, model_setting_data?: any) => {
|
||||
form_data.value = {}
|
||||
tts_model_id.value = model_id
|
||||
ModelAPI.getModelParamsForm(model_id, loading).then((ok) => {
|
||||
model_form_field.value = ok.data
|
||||
const resp = ok.data
|
||||
.map((item: any) => ({
|
||||
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
|
||||
}))
|
||||
.reduce((x, y) => ({ ...x, ...y }), {})
|
||||
// 删除不存在的字段
|
||||
if (model_setting_data) {
|
||||
Object.keys(model_setting_data).forEach((key) => {
|
||||
if (!(key in resp)) {
|
||||
delete model_setting_data[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
model_setting_data = { ...resp, ...model_setting_data }
|
||||
// 渲染动态表单
|
||||
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
|
||||
})
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getModelParamsForm(model_id, loading)
|
||||
.then((ok: any) => {
|
||||
model_form_field.value = ok.data
|
||||
const resp = ok.data
|
||||
.map((item: any) => ({
|
||||
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
|
||||
}))
|
||||
.reduce((x: any, y: any) => ({ ...x, ...y }), {})
|
||||
// 删除不存在的字段
|
||||
if (model_setting_data) {
|
||||
Object.keys(model_setting_data).forEach((key) => {
|
||||
if (!(key in resp)) {
|
||||
delete model_setting_data[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
model_setting_data = { ...resp, ...model_setting_data }
|
||||
// 渲染动态表单
|
||||
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
|
||||
})
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const reset_default = (model_id: string, application_id?: string) => {
|
||||
ModelAPI.getModelParamsForm(model_id, loading).then((ok) => {
|
||||
model_form_field.value = ok.data
|
||||
const model_setting_data = ok.data
|
||||
.map((item) => ({
|
||||
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
|
||||
}))
|
||||
.reduce((x, y) => ({ ...x, ...y }), {})
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getModelParamsForm(model_id, loading)
|
||||
.then((ok: any) => {
|
||||
model_form_field.value = ok.data
|
||||
const model_setting_data = ok.data
|
||||
.map((item: any) => ({
|
||||
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
|
||||
}))
|
||||
.reduce((x: any, y: any) => ({ ...x, ...y }), {})
|
||||
|
||||
emit('refresh', model_setting_data)
|
||||
})
|
||||
emit('refresh', model_setting_data)
|
||||
})
|
||||
}
|
||||
|
||||
const submit = async () => {
|
||||
|
|
@ -113,7 +122,7 @@ const testPlay = () => {
|
|||
...form_data.value,
|
||||
tts_model_id: tts_model_id.value,
|
||||
}
|
||||
applicationApi
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.playDemoText(id as string, data, playLoading)
|
||||
.then(async (res: any) => {
|
||||
if (res.type === 'application/json') {
|
||||
|
|
@ -135,7 +144,7 @@ const testPlay = () => {
|
|||
console.error('audioPlayer.value is not an instance of HTMLAudioElement')
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch((err: any) => {
|
||||
console.log('err: ', err)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@
|
|||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click.stop="getAccessToken(item.id)">
|
||||
<el-dropdown-item @click.stop="toChat(item)">
|
||||
<AppIcon iconName="app-create-chat"></AppIcon>
|
||||
{{ $t('views.application.operation.toChat') }}
|
||||
</el-dropdown-item>
|
||||
|
|
@ -386,7 +386,7 @@ const get_route = (item: any) => {
|
|||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${item.id}/${item.type}/overview`
|
||||
return `/application/workspace/${item.id}/${item.type}/overview`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
|
|
@ -404,9 +404,9 @@ const get_route = (item: any) => {
|
|||
)
|
||||
) {
|
||||
if (item.type == 'WORK_FLOW') {
|
||||
return `/application/${item.id}/workflow`
|
||||
return `/application/workspace/${item.id}/workflow`
|
||||
} else {
|
||||
return `/application/${item.id}/${item.type}/setting`
|
||||
return `/application/workspace/${item.id}/${item.type}/setting`
|
||||
}
|
||||
} else if (
|
||||
hasPermission(
|
||||
|
|
@ -437,7 +437,7 @@ const get_route = (item: any) => {
|
|||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${item.id}/${item.type}/access`
|
||||
return `/application/workspace/${item.id}/${item.type}/access`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
|
|
@ -467,7 +467,7 @@ const get_route = (item: any) => {
|
|||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${item.id}/${item.type}/chat-user`
|
||||
return `/application/workspace/${item.id}/${item.type}/chat-user`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
|
|
@ -485,7 +485,7 @@ const get_route = (item: any) => {
|
|||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/${item.id}/${item.type}/chat-log`
|
||||
return `/application//workspace${item.id}/${item.type}/chat-log`
|
||||
} else return `/application/`
|
||||
}
|
||||
|
||||
|
|
@ -499,10 +499,11 @@ const search_type_change = () => {
|
|||
search_form.value = { name: '', create_user: '' }
|
||||
}
|
||||
|
||||
function getAccessToken(id: string) {
|
||||
applicationList.value
|
||||
.filter((app) => app.id === id)[0]
|
||||
?.work_flow?.nodes?.filter((v: any) => v.id === 'base-node')
|
||||
const apiInputParams = ref([])
|
||||
|
||||
function toChat(row: any) {
|
||||
row?.work_flow?.nodes
|
||||
?.filter((v: any) => v.id === 'base-node')
|
||||
.map((v: any) => {
|
||||
apiInputParams.value = v.properties.api_input_field_list
|
||||
? v.properties.api_input_field_list.map((v: any) => {
|
||||
|
|
@ -525,15 +526,23 @@ function getAccessToken(id: string) {
|
|||
const apiParams = mapToUrlParams(apiInputParams.value)
|
||||
? '?' + mapToUrlParams(apiInputParams.value)
|
||||
: ''
|
||||
application.asyncGetAccessToken(id, loading).then((res: any) => {
|
||||
ApplicationApi.getAccessToken(row.id, loading).then((res: any) => {
|
||||
window.open(application.location + res?.data?.access_token + apiParams)
|
||||
})
|
||||
}
|
||||
|
||||
const apiInputParams = ref([])
|
||||
function mapToUrlParams(map: any[]) {
|
||||
const params = new URLSearchParams()
|
||||
|
||||
map.forEach((item: any) => {
|
||||
params.append(encodeURIComponent(item.name), encodeURIComponent(item.value))
|
||||
})
|
||||
|
||||
return params.toString() // 返回 URL 查询字符串
|
||||
}
|
||||
|
||||
function copyApplication(row: any) {
|
||||
application.asyncGetApplicationDetail(row.id, loading).then((res: any) => {
|
||||
ApplicationApi.getApplicationDetail(row.id, loading).then((res: any) => {
|
||||
if (res?.data) {
|
||||
CopyApplicationDialogRef.value.open(
|
||||
{ ...res.data, model_id: res.data.model },
|
||||
|
|
@ -545,22 +554,12 @@ function copyApplication(row: any) {
|
|||
|
||||
function settingApplication(row: any) {
|
||||
if (isWorkFlow(row.type)) {
|
||||
router.push({ path: `/application/${row.id}/workflow` })
|
||||
router.push({ path: `/application/workspace/${row.id}/workflow` })
|
||||
} else {
|
||||
router.push({ path: `/application/${row.id}/${row.type}/setting` })
|
||||
router.push({ path: `/application/workspace/${row.id}/${row.type}/setting` })
|
||||
}
|
||||
}
|
||||
|
||||
function mapToUrlParams(map: any[]) {
|
||||
const params = new URLSearchParams()
|
||||
|
||||
map.forEach((item: any) => {
|
||||
params.append(encodeURIComponent(item.name), encodeURIComponent(item.value))
|
||||
})
|
||||
|
||||
return params.toString() // 返回 URL 查询字符串
|
||||
}
|
||||
|
||||
function deleteApplication(row: any) {
|
||||
MsgConfirm(
|
||||
// @ts-ignore
|
||||
|
|
|
|||
|
|
@ -31,12 +31,11 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, nextTick } from 'vue'
|
||||
import { ref, reactive, watch, nextTick, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { type ApplicationFormType, type chatType } from '@/api/type/application'
|
||||
import useStore from '@/stores'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const AiChatRef = ref()
|
||||
const { chatLog } = useStore()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/**
|
||||
|
|
@ -70,6 +69,14 @@ const route = useRoute()
|
|||
const {
|
||||
params: { id },
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const loading = ref(false)
|
||||
const visible = ref(false)
|
||||
const recordList = ref<chatType[]>([])
|
||||
|
|
@ -87,8 +94,8 @@ function closeHandle() {
|
|||
}
|
||||
|
||||
function getChatRecord() {
|
||||
return chatLog
|
||||
.asyncChatRecordLog(id as string, props.chatId, paginationConfig, loading)
|
||||
return loadSharedApi({ type: 'chatLog', systemType: apiType.value })
|
||||
.getChatRecordLog(id as string, props.chatId, paginationConfig, loading)
|
||||
.then((res: any) => {
|
||||
paginationConfig.total = res.data.total
|
||||
const list = res.data.records
|
||||
|
|
|
|||
|
|
@ -71,20 +71,23 @@ import { ref, watch, reactive, computed } from 'vue'
|
|||
import { useRoute } from 'vue-router'
|
||||
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import chatLogApi from '@/api/application/chat-log'
|
||||
import imageApi from '@/api/image'
|
||||
import { t } from '@/locales'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const apiType = computed<'workspace'>(() => {
|
||||
return 'workspace'
|
||||
})
|
||||
const formRef = ref()
|
||||
|
||||
const toolbars = [
|
||||
|
|
@ -197,7 +200,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|||
content: form.value.content,
|
||||
problem_text: form.value.problem_text,
|
||||
}
|
||||
chatLogApi
|
||||
loadSharedApi({ type: 'chatLog', systemType: apiType.value })
|
||||
.putChatRecordLog(
|
||||
id,
|
||||
form.value.chat_id,
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@
|
|||
<div class="text-right">
|
||||
<el-button text @click="isEdit = true" v-if="!isEdit">
|
||||
<el-icon>
|
||||
<EditPen/>
|
||||
<EditPen />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button text style="margin-left: 4px" @click="deleteMark">
|
||||
<el-icon>
|
||||
<Delete/>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-divider direction="vertical"/>
|
||||
<el-divider direction="vertical" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -64,18 +64,24 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref, watch, reactive} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import type {FormInstance, FormRules} from 'element-plus'
|
||||
import chatLogApi from '@/api/application/chat-log'
|
||||
import paragraphApi from '@/api/knowledge/paragraph'
|
||||
import {t} from '@/locales'
|
||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
import { ref, watch, reactive, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { t } from '@/locales'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: {id},
|
||||
params: { id },
|
||||
} = route as any
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
|
|
@ -90,7 +96,7 @@ const detail = ref<any>({})
|
|||
|
||||
const rules = reactive<FormRules>({
|
||||
content: [
|
||||
{required: true, message: t('views.chatLog.form.content.placeholder'), trigger: 'blur'},
|
||||
{ required: true, message: t('views.chatLog.form.content.placeholder'), trigger: 'blur' },
|
||||
],
|
||||
})
|
||||
|
||||
|
|
@ -102,7 +108,7 @@ watch(dialogVisible, (bool) => {
|
|||
})
|
||||
|
||||
function deleteMark() {
|
||||
chatLogApi
|
||||
loadSharedApi({ type: 'chatLog', systemType: apiType.value })
|
||||
.delMarkChatRecord(
|
||||
id as string,
|
||||
detail.value.chat_id,
|
||||
|
|
@ -120,7 +126,7 @@ function deleteMark() {
|
|||
}
|
||||
|
||||
function getMark(data: any) {
|
||||
chatLogApi
|
||||
loadSharedApi({ type: 'chatLog', systemType: apiType.value })
|
||||
.getMarkChatRecord(id as string, data.chat_id, data.id, loading)
|
||||
.then((res: any) => {
|
||||
if (res.data.length > 0) {
|
||||
|
|
@ -138,7 +144,7 @@ const submit = async (formEl: FormInstance) => {
|
|||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
paragraphApi
|
||||
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
|
||||
.putParagraph(
|
||||
form.value.knowledge,
|
||||
form.value.document,
|
||||
|
|
@ -148,14 +154,14 @@ const submit = async (formEl: FormInstance) => {
|
|||
},
|
||||
loading,
|
||||
)
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({open})
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.edit-mark-dialog {
|
||||
|
|
|
|||
|
|
@ -230,24 +230,25 @@ import { cloneDeep } from 'lodash'
|
|||
import ChatRecordDrawer from './component/ChatRecordDrawer.vue'
|
||||
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import chatLogApi from '@/api/application/chat-log'
|
||||
import { beforeDay, datetimeFormat, nowDate } from '@/utils/time'
|
||||
import useStore from '@/stores'
|
||||
import type { Dict } from '@/api/type/common'
|
||||
import { t } from '@/locales'
|
||||
import { ElTable } from 'element-plus'
|
||||
import permissionMap from '@/permission'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed<'workspace'>(() => {
|
||||
return 'workspace'
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['application'][apiType.value]
|
||||
})
|
||||
|
||||
const { application, chatLog, user } = useStore()
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
|
@ -326,8 +327,6 @@ const filter = ref<any>({
|
|||
comparer: 'and',
|
||||
})
|
||||
|
||||
const documentList = ref<any[]>([])
|
||||
|
||||
function filterChange(val: string) {
|
||||
if (val === 'clear') {
|
||||
filter.value = cloneDeep(defaultFilter)
|
||||
|
|
@ -420,18 +419,20 @@ function getList() {
|
|||
if (search.value) {
|
||||
obj = { ...obj, abstract: search.value }
|
||||
}
|
||||
return chatLog.asyncGetChatLog(id as string, paginationConfig, obj, loading).then((res: any) => {
|
||||
tableData.value = res.data.records
|
||||
if (currentChatId.value) {
|
||||
currentChatId.value = tableData.value[0]?.id
|
||||
}
|
||||
paginationConfig.total = res.data.total
|
||||
})
|
||||
return loadSharedApi({ type: 'chatLog', systemType: apiType.value })
|
||||
.getChatLog(id as string, paginationConfig, obj, loading)
|
||||
.then((res: any) => {
|
||||
tableData.value = res.data.records
|
||||
if (currentChatId.value) {
|
||||
currentChatId.value = tableData.value[0]?.id
|
||||
}
|
||||
paginationConfig.total = res.data.total
|
||||
})
|
||||
}
|
||||
|
||||
function getDetail(isLoading = false) {
|
||||
application
|
||||
.asyncGetApplicationDetail(id as string, isLoading ? loading : undefined)
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationDetail(id as string, isLoading ? loading : undefined)
|
||||
.then((res: any) => {
|
||||
detail.value = res.data
|
||||
days.value = res.data.clean_time
|
||||
|
|
@ -455,7 +456,7 @@ const exportLog = () => {
|
|||
obj = { ...obj, abstract: search.value }
|
||||
}
|
||||
|
||||
chatLogApi.postExportChatLog(
|
||||
loadSharedApi({ type: 'chatLog', systemType: apiType.value }).postExportChatLog(
|
||||
detail.value.id,
|
||||
detail.value.name,
|
||||
obj,
|
||||
|
|
@ -487,8 +488,8 @@ function saveCleanTime() {
|
|||
const obj = {
|
||||
clean_time: days.value,
|
||||
}
|
||||
application
|
||||
.asyncPutApplication(id as string, obj, loading)
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.putApplication(id as string, obj, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
dialogVisible.value = false
|
||||
|
|
@ -512,10 +513,12 @@ const submitForm = async () => {
|
|||
...SelectKnowledgeDocumentRef.value.form,
|
||||
chat_ids: arr,
|
||||
}
|
||||
chatLogApi.postChatLogAddKnowledge(id, obj, documentLoading).then((res: any) => {
|
||||
multipleTableRef.value?.clearSelection()
|
||||
documentDialogVisible.value = false
|
||||
})
|
||||
loadSharedApi({ type: 'chatLog', systemType: apiType.value })
|
||||
.postChatLogAddKnowledge(id, obj, documentLoading)
|
||||
.then((res: any) => {
|
||||
multipleTableRef.value?.clearSelection()
|
||||
documentDialogVisible.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ function rowClickHandle(row: any, column: any) {
|
|||
|
||||
router.push({
|
||||
path: `/paragraph/${id}/${row.id}`,
|
||||
query: { type: apiType.value, isShared: isShared.value ? 'true' : 'false' },
|
||||
query: { from: apiType.value, isShared: isShared.value ? 'true' : 'false' },
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ import { useRoute } from 'vue-router'
|
|||
import BaseForm from '@/views/knowledge/component/BaseForm.vue'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import permissionMap from '@/permission'
|
||||
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
|
@ -192,13 +191,12 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
|||
const route = useRoute()
|
||||
const {
|
||||
params: { id, folderId },
|
||||
query: { type },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management') || type === 'systemManage') {
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import { groupBy } from 'lodash'
|
|||
import type { knowledgeData } from '@/api/type/knowledge'
|
||||
import { t } from '@/locales'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
import modelResourceApi from '@/api/system-resource-management/model'
|
||||
const props = defineProps<{
|
||||
data?: {
|
||||
type: Object
|
||||
|
|
@ -98,7 +98,6 @@ watch(
|
|||
form.value.desc = value.desc
|
||||
form.value.embedding_model_id = value.embedding_model_id
|
||||
workspace_id.value = value.workspace_id || ''
|
||||
|
||||
// 重新刷新模型列表
|
||||
getSelectModel()
|
||||
}
|
||||
|
|
@ -120,8 +119,17 @@ function validate() {
|
|||
|
||||
function getSelectModel() {
|
||||
loading.value = true
|
||||
const obj =
|
||||
props.apiType === 'systemManage'
|
||||
? {
|
||||
model_type: 'EMBEDDING',
|
||||
workspace_id: workspace_id.value,
|
||||
}
|
||||
: {
|
||||
model_type: 'EMBEDDING',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: props.apiType })
|
||||
.getSelectModelList({ model_type: 'EMBEDDING', workspace_id: workspace_id.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
@ -132,7 +140,9 @@ function getSelectModel() {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getSelectModel()
|
||||
if (props.apiType !== 'systemManage') {
|
||||
getSelectModel()
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ import { t } from '@/locales'
|
|||
|
||||
const route = useRoute()
|
||||
const {
|
||||
query: { type },
|
||||
query: { from },
|
||||
} = route
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management') || type === 'systemManage') {
|
||||
} else if (route.path.includes('resource-management') || from === 'systemManage') {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ const submitHandle = async () => {
|
|||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`,
|
||||
query: {
|
||||
type: apiType.value,
|
||||
from: apiType.value,
|
||||
},
|
||||
})
|
||||
emit('refresh')
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ const submitHandle = async () => {
|
|||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`,
|
||||
query: {
|
||||
type: apiType.value,
|
||||
from: apiType.value,
|
||||
},
|
||||
})
|
||||
emit('refresh')
|
||||
|
|
|
|||
|
|
@ -146,11 +146,11 @@ const props = defineProps<{
|
|||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId },
|
||||
query: { type },
|
||||
query: { from },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
return type as 'systemShare' | 'workspace' | 'systemManage'
|
||||
return from as 'systemShare' | 'workspace' | 'systemManage'
|
||||
})
|
||||
|
||||
const permissionPrecise = computed (() => {
|
||||
|
|
@ -158,8 +158,8 @@ const permissionPrecise = computed (() => {
|
|||
})
|
||||
|
||||
const MoreFieldPermission = (id:any) => {
|
||||
return permissionPrecise.value.doc_generate(id) ||
|
||||
permissionPrecise.value.doc_edit(id)
|
||||
return permissionPrecise.value.doc_generate(id) ||
|
||||
permissionPrecise.value.doc_edit(id)
|
||||
}
|
||||
|
||||
const emit = defineEmits(['dialogVisibleChange','clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move'])
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
>)
|
||||
</el-text>
|
||||
</div>
|
||||
<div class="header-button" v-if="!shareDisabled && permissionPrecise.doc_edit(id)">
|
||||
<div class="header-button" v-if="!shareDisabled && permissionPrecise.doc_edit(id)">
|
||||
<el-button @click="batchSelectedHandle(true)" v-if="isBatch === false">
|
||||
{{ $t('views.paragraph.setting.batchSelected') }}
|
||||
</el-button>
|
||||
|
|
@ -85,7 +85,12 @@
|
|||
<VueDraggable
|
||||
ref="el"
|
||||
v-model="paragraphDetail"
|
||||
:disabled="isBatch === true || shareDisabled || dialogVisible || !permissionPrecise.doc_edit(id)"
|
||||
:disabled="
|
||||
isBatch === true ||
|
||||
shareDisabled ||
|
||||
dialogVisible ||
|
||||
!permissionPrecise.doc_edit(id)
|
||||
"
|
||||
handle=".handle"
|
||||
:animation="150"
|
||||
ghostClass="ghost"
|
||||
|
|
@ -96,7 +101,12 @@
|
|||
<!-- 批量操作 -->
|
||||
<div class="paragraph-card flex w-full" v-if="isBatch === true">
|
||||
<el-checkbox :value="item.id" />
|
||||
<ParagraphCard :data="item" class="mb-8 w-full" :disabled="true" @clickCard="toggleSelect(item.id)"/>
|
||||
<ParagraphCard
|
||||
:data="item"
|
||||
class="mb-8 w-full"
|
||||
:disabled="true"
|
||||
@clickCard="toggleSelect(item.id)"
|
||||
/>
|
||||
</div>
|
||||
<!-- 非批量操作 -->
|
||||
<div class="handle paragraph-card flex w-full" :id="item.id" v-else>
|
||||
|
|
@ -110,11 +120,21 @@
|
|||
<ParagraphCard
|
||||
:data="item"
|
||||
:showMoveUp="index !== 0"
|
||||
:showMoveDown="index < paragraphDetail.length-1"
|
||||
:showMoveDown="index < paragraphDetail.length - 1"
|
||||
class="mb-8 w-full"
|
||||
@changeState="changeState"
|
||||
@deleteParagraph="deleteParagraph"
|
||||
@move="(val: string)=>onEnd(null, {paragraph_id: item.id,new_position: val==='up'?index-1:index+1}, index)"
|
||||
@move="
|
||||
(val: string) =>
|
||||
onEnd(
|
||||
null,
|
||||
{
|
||||
paragraph_id: item.id,
|
||||
new_position: val === 'up' ? index - 1 : index + 1,
|
||||
},
|
||||
index,
|
||||
)
|
||||
"
|
||||
@refresh="refresh"
|
||||
@refreshMigrateParagraph="refreshMigrateParagraph"
|
||||
:disabled="shareDisabled"
|
||||
|
|
@ -175,15 +195,15 @@ import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
|||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import permissionMap from '@/permission'
|
||||
import { t } from '@/locales'
|
||||
import {cloneDeep} from "lodash";
|
||||
import { cloneDeep } from 'lodash'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId },
|
||||
query: { type, isShared },
|
||||
query: { from, isShared },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
return type as 'systemShare' | 'workspace' | 'systemManage'
|
||||
return from as 'systemShare' | 'workspace' | 'systemManage'
|
||||
})
|
||||
const shareDisabled = computed(() => {
|
||||
return isShared === 'true'
|
||||
|
|
@ -192,7 +212,6 @@ const permissionPrecise = computed(() => {
|
|||
return permissionMap['knowledge'][apiType.value]
|
||||
})
|
||||
|
||||
|
||||
const SelectDocumentDialogRef = ref()
|
||||
const ParagraphDialogRef = ref()
|
||||
const loading = ref(false)
|
||||
|
|
@ -204,9 +223,12 @@ const search = ref('')
|
|||
const searchType = ref('title')
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
watch(()=>ParagraphDialogRef.value?.dialogVisible, (val: boolean) => {
|
||||
dialogVisible.value = val
|
||||
})
|
||||
watch(
|
||||
() => ParagraphDialogRef.value?.dialogVisible,
|
||||
(val: boolean) => {
|
||||
dialogVisible.value = val
|
||||
},
|
||||
)
|
||||
function dialogVisibleChange(val: boolean) {
|
||||
dialogVisible.value = val
|
||||
}
|
||||
|
|
@ -353,7 +375,7 @@ function openGenerateDialog(row?: any) {
|
|||
|
||||
function onEnd(event?: any, params?: any, index?: number) {
|
||||
// console.log('onEnd', event, params, index)
|
||||
const p = cloneDeep(params)
|
||||
const p = cloneDeep(params)
|
||||
if (p) {
|
||||
p.new_position = p.new_position + 1 // 由于拖拽时会将当前段落位置作为新位置,所以需要加1
|
||||
}
|
||||
|
|
@ -367,7 +389,7 @@ function onEnd(event?: any, params?: any, index?: number) {
|
|||
obj,
|
||||
loading,
|
||||
)
|
||||
if(params) {
|
||||
if (params) {
|
||||
const movedItem = paragraphDetail.value.splice(index as number, 1)[0]
|
||||
paragraphDetail.value.splice(params.new_position, 0, movedItem)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,66 @@
|
|||
{{ datetimeFormat(row.create_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common.operation')" align="left" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="$t('views.application.operation.toChat')"
|
||||
placement="top"
|
||||
>
|
||||
<span class="mr-8">
|
||||
<el-button
|
||||
type="primary"
|
||||
text
|
||||
:title="$t('views.application.operation.toChat')"
|
||||
@click.stop="toChat(row)"
|
||||
>
|
||||
<AppIcon iconName="app-create-chat"></AppIcon>
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="$t('views.system.resource_management.management')"
|
||||
placement="top"
|
||||
>
|
||||
<span class="mr-8">
|
||||
<el-button
|
||||
type="primary"
|
||||
text
|
||||
:title="$t('views.system.resource_management.management')"
|
||||
@click="goApp(row)"
|
||||
>
|
||||
<AppIcon iconName="app-admin-operation"></AppIcon>
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-dropdown trigger="click">
|
||||
<el-button text @click.stop>
|
||||
<el-icon>
|
||||
<MoreFilled />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
@click.stop="exportApplication(row)"
|
||||
v-if="permissionPrecise.export()"
|
||||
>
|
||||
<AppIcon iconName="app-export"></AppIcon>
|
||||
{{ $t('common.export') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
icon="Delete"
|
||||
@click.stop="deleteApplication(row)"
|
||||
v-if="permissionPrecise.delete()"
|
||||
>{{ $t('common.delete') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</app-table>
|
||||
</el-card>
|
||||
</div>
|
||||
|
|
@ -226,6 +286,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, reactive, computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import ApplicationResourceApi from '@/api/system-resource-management/application'
|
||||
import { t } from '@/locales'
|
||||
import { isAppIcon, resetUrl } from '@/utils/common'
|
||||
|
|
@ -234,8 +295,91 @@ import { datetimeFormat } from '@/utils/time'
|
|||
import { loadPermissionApi } from '@/utils/dynamics-api/permission-api.ts'
|
||||
import { isWorkFlow } from '@/utils/application.ts'
|
||||
import UserApi from '@/api/user/user.ts'
|
||||
import { hasPermission } from '@/utils/permission'
|
||||
import { ComplexPermission } from '@/utils/permission/type'
|
||||
import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import permissionMap from '@/permission'
|
||||
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
|
||||
|
||||
const { user } = useStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { user, application } = useStore()
|
||||
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['application']['systemManage']
|
||||
})
|
||||
|
||||
const apiInputParams = ref([])
|
||||
function toChat(row: any) {
|
||||
row?.work_flow?.nodes
|
||||
?.filter((v: any) => v.id === 'base-node')
|
||||
.map((v: any) => {
|
||||
apiInputParams.value = v.properties.api_input_field_list
|
||||
? v.properties.api_input_field_list.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: v.properties.input_field_list
|
||||
? v.properties.input_field_list
|
||||
.filter((v: any) => v.assignment_method === 'api_input')
|
||||
.map((v: any) => {
|
||||
return {
|
||||
name: v.variable,
|
||||
value: v.default_value,
|
||||
}
|
||||
})
|
||||
: []
|
||||
})
|
||||
const apiParams = mapToUrlParams(apiInputParams.value)
|
||||
? '?' + mapToUrlParams(apiInputParams.value)
|
||||
: ''
|
||||
ApplicationResourceApi.getAccessToken(row.id, loading).then((res: any) => {
|
||||
window.open(application.location + res?.data?.access_token + apiParams)
|
||||
})
|
||||
}
|
||||
|
||||
function mapToUrlParams(map: any[]) {
|
||||
const params = new URLSearchParams()
|
||||
|
||||
map.forEach((item: any) => {
|
||||
params.append(encodeURIComponent(item.name), encodeURIComponent(item.value))
|
||||
})
|
||||
|
||||
return params.toString() // 返回 URL 查询字符串
|
||||
}
|
||||
|
||||
function deleteApplication(row: any) {
|
||||
MsgConfirm(
|
||||
// @ts-ignore
|
||||
`${t('views.application.delete.confirmTitle')}${row.name} ?`,
|
||||
t('views.application.delete.confirmMessage'),
|
||||
{
|
||||
confirmButtonText: t('common.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
confirmButtonClass: 'danger',
|
||||
},
|
||||
)
|
||||
.then(() => {
|
||||
ApplicationResourceApi.delApplication(row.id, loading).then(() => {
|
||||
const index = applicationList.value.findIndex((v) => v.id === row.id)
|
||||
applicationList.value.splice(index, 1)
|
||||
MsgSuccess(t('common.deleteSuccess'))
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const exportApplication = (application: any) => {
|
||||
ApplicationResourceApi.exportApplication(application.id, application.name, loading).catch((e) => {
|
||||
if (e.response.status !== 403) {
|
||||
e.response.data.text().then((res: string) => {
|
||||
MsgError(`${t('views.application.tip.ExportError')}:${JSON.parse(res).message}`)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const search_type = ref('name')
|
||||
const search_form = ref<any>({
|
||||
|
|
@ -245,13 +389,139 @@ const search_form = ref<any>({
|
|||
const user_options = ref<any[]>([])
|
||||
|
||||
const loading = ref(false)
|
||||
const changeStateloading = ref(false)
|
||||
const applicationList = ref<any[]>([])
|
||||
const paginationConfig = reactive({
|
||||
current_page: 1,
|
||||
page_size: 20,
|
||||
total: 0,
|
||||
})
|
||||
|
||||
const goApp = (item: any) => {
|
||||
router.push({ path: get_route(item) })
|
||||
}
|
||||
|
||||
const get_route = (item: any) => {
|
||||
if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(item.id)],
|
||||
[],
|
||||
'AND',
|
||||
),
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_OVERVIEW_READ.getApplicationWorkspaceResourcePermission(
|
||||
item.id,
|
||||
),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/resource-management/${item.id}/${item.type}/overview`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(item.id)],
|
||||
[],
|
||||
'AND',
|
||||
),
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.APPLICATION_EDIT.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_EDIT.getApplicationWorkspaceResourcePermission(item.id),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
if (item.type == 'WORK_FLOW') {
|
||||
return `/application/resource-management/${item.id}/workflow`
|
||||
} else {
|
||||
return `/application/resource-management/${item.id}/${item.type}/setting`
|
||||
}
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(item.id)],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'AND',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
|
||||
[PermissionConst.APPLICATION_ACCESS_READ.getWorkspacePermissionWorkspaceManageRole],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[],
|
||||
[
|
||||
PermissionConst.APPLICATION_ACCESS_READ.getApplicationWorkspaceResourcePermission(
|
||||
item.id,
|
||||
),
|
||||
],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/resource-management/${item.id}/${item.type}/access`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(item.id)],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'AND',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
|
||||
[PermissionConst.APPLICATION_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
new ComplexPermission(
|
||||
[],
|
||||
[
|
||||
PermissionConst.APPLICATION_CHAT_USER_READ.getApplicationWorkspaceResourcePermission(
|
||||
item.id,
|
||||
),
|
||||
],
|
||||
[EditionConst.IS_EE, EditionConst.IS_PE],
|
||||
'OR',
|
||||
),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/resource-management/${item.id}/${item.type}/chat-user`
|
||||
} else if (
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission(
|
||||
[RoleConst.USER],
|
||||
[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(item.id)],
|
||||
[],
|
||||
'AND',
|
||||
),
|
||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.APPLICATION_CHAT_LOG_READ.getApplicationWorkspaceResourcePermission(
|
||||
item.id,
|
||||
),
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
) {
|
||||
return `/application/resource-management/${item.id}/${item.type}/chat-log`
|
||||
} else return `/system/resource-management/application/`
|
||||
}
|
||||
|
||||
const workspaceOptions = ref<any[]>([])
|
||||
const workspaceVisible = ref(false)
|
||||
const workspaceArr = ref<any[]>([])
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@
|
|||
"
|
||||
@click.stop="openParamSetting(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
<el-icon><Setting /></el-icon>
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
|
|
|
|||
|
|
@ -173,15 +173,27 @@ import { cloneDeep, set, groupBy } from 'lodash'
|
|||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import useStore from '@/stores'
|
||||
import { isLastNode } from '@/workflow/common/data'
|
||||
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
|
||||
import { t } from '@/locales'
|
||||
import ReasoningParamSettingDialog from '@/views/application/component/ReasoningParamSettingDialog.vue'
|
||||
import McpServersDialog from '@/views/application/component/McpServersDialog.vue'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
const { model } = useStore()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const wheel = (e: any) => {
|
||||
if (e.ctrlKey === true) {
|
||||
|
|
@ -208,9 +220,6 @@ const model_change = (model_id?: string) => {
|
|||
refreshParam({})
|
||||
}
|
||||
}
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
// @ts-ignore
|
||||
const defaultPrompt = `${t('views.applicationWorkflow.nodes.aiChatNode.defaultPrompt')}:
|
||||
|
|
@ -269,9 +278,20 @@ const validate = () => {
|
|||
}
|
||||
|
||||
function getSelectModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'LLM' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'LLM',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'LLM',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
const openAIParamSettingDialog = (modelId: string) => {
|
||||
|
|
|
|||
|
|
@ -147,8 +147,8 @@
|
|||
<div class="flex align-center">
|
||||
<div class="mr-4">
|
||||
<span>{{
|
||||
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
|
||||
}}</span>
|
||||
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
|
||||
}}</span>
|
||||
</div>
|
||||
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
|
||||
<template #content>
|
||||
|
|
@ -158,7 +158,7 @@
|
|||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
<el-switch size="small" v-model="form_data.is_result"/>
|
||||
<el-switch size="small" v-model="form_data.is_result" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
|
@ -166,16 +166,24 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {set, groupBy, create, cloneDeep} from 'lodash'
|
||||
import { set, groupBy, create, cloneDeep } from 'lodash'
|
||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import {ref, computed, onMounted, onActivated} from 'vue'
|
||||
import { ref, computed, onMounted, onActivated } from 'vue'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import type {FormInstance} from 'element-plus'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import {isWorkFlow} from '@/utils/application'
|
||||
import {useRoute} from 'vue-router'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const form = {
|
||||
question_reference_address: ['start-node', 'question'],
|
||||
api_input_field_list: [],
|
||||
|
|
@ -185,10 +193,6 @@ const form = {
|
|||
audio_list: ['start-node', 'audio'],
|
||||
}
|
||||
|
||||
const {
|
||||
params: {id},
|
||||
} = route as any
|
||||
|
||||
const applicationNodeFormRef = ref<FormInstance>()
|
||||
|
||||
const form_data = computed({
|
||||
|
|
@ -222,9 +226,9 @@ const update_field = () => {
|
|||
set(props.nodeModel.properties, 'status', 500)
|
||||
return
|
||||
}
|
||||
applicationApi
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationDetail(props.nodeModel.properties.node_data.application_id)
|
||||
.then((ok) => {
|
||||
.then((ok: any) => {
|
||||
const old_api_input_field_list = cloneDeep(
|
||||
props.nodeModel.properties.node_data.api_input_field_list,
|
||||
)
|
||||
|
|
@ -299,7 +303,7 @@ const update_field = () => {
|
|||
set(props.nodeModel.properties, 'status', ok.data.id ? 200 : 500)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch((err: any) => {
|
||||
console.log(err)
|
||||
set(props.nodeModel.properties, 'status', 500)
|
||||
})
|
||||
|
|
@ -309,7 +313,7 @@ const props = defineProps<{ nodeModel: any }>()
|
|||
|
||||
const validate = () => {
|
||||
return applicationNodeFormRef.value?.validate().catch((err) => {
|
||||
return Promise.reject({node: props.nodeModel, errMessage: err})
|
||||
return Promise.reject({ node: props.nodeModel, errMessage: err })
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,13 +178,22 @@ import ApiInputFieldTable from './component/ApiInputFieldTable.vue'
|
|||
import UserInputFieldTable from './component/UserInputFieldTable.vue'
|
||||
import FileUploadSettingDialog from '@/workflow/nodes/base-node/component/FileUploadSettingDialog.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import useStore from '@/stores'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
const { model } = useStore()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
||||
const sttModelOptions = ref<any>(null)
|
||||
|
|
@ -253,15 +262,37 @@ const validate = () => {
|
|||
}
|
||||
|
||||
function getSTTModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'STT' }).then((res: any) => {
|
||||
sttModelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'STT',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'STT',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
sttModelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
function getTTSModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'TTS' }).then((res: any) => {
|
||||
ttsModelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'TTS',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'TTS',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
ttsModelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
function ttsModelChange() {
|
||||
|
|
|
|||
|
|
@ -153,21 +153,28 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import {computed, nextTick, onMounted, ref} from 'vue'
|
||||
import { computed, nextTick, onMounted, ref } from 'vue'
|
||||
import { groupBy, set } from 'lodash'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import useStore from '@/stores'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
|
||||
import { t } from '@/locales'
|
||||
const { model } = useStore()
|
||||
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
const modelOptions = ref<any>(null)
|
||||
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
|
||||
|
|
@ -219,13 +226,24 @@ const form_data = computed({
|
|||
})
|
||||
|
||||
function getSelectModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'TTI' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'TTI',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'TTI',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
const model_change = () => {
|
||||
nextTick(()=>{
|
||||
nextTick(() => {
|
||||
if (form_data.value.model_id) {
|
||||
AIModeParamSettingDialogRef.value?.reset_default(form_data.value.model_id, id)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -171,20 +171,27 @@
|
|||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { groupBy, set } from 'lodash'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import useStore from '@/stores'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
|
||||
import { t } from '@/locales'
|
||||
const { model } = useStore()
|
||||
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
const modelOptions = ref<any>(null)
|
||||
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
|
||||
|
|
@ -239,9 +246,20 @@ const form_data = computed({
|
|||
})
|
||||
|
||||
function getSelectModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'IMAGE' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'IMAGE',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'IMAGE',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
function submitSystemDialog(val: string) {
|
||||
|
|
|
|||
|
|
@ -203,12 +203,12 @@ import { cloneDeep, set } from 'lodash'
|
|||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { isLastNode } from '@/workflow/common/data'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import { t } from '@/locales'
|
||||
import { MsgError, MsgSuccess } from '@/utils/message'
|
||||
import TooltipLabel from '@/components/dynamics-form/items/label/TooltipLabel.vue'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
||||
const route = useRoute()
|
||||
|
|
@ -216,6 +216,14 @@ const {
|
|||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const dynamicsFormRef = ref()
|
||||
const loading = ref(false)
|
||||
|
||||
|
|
@ -260,14 +268,16 @@ function getTools() {
|
|||
MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip'))
|
||||
return
|
||||
}
|
||||
applicationApi.getMcpTools(id, form_data.value.mcp_servers, loading).then((res: any) => {
|
||||
form_data.value.mcp_tools = res.data
|
||||
MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess'))
|
||||
// 修改了json,刷新mcp_server
|
||||
form_data.value.mcp_server = form_data.value.mcp_tools.find(
|
||||
(item: any) => item.name === form_data.value.mcp_tool,
|
||||
)?.server
|
||||
})
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getMcpTools(id, form_data.value.mcp_servers, loading)
|
||||
.then((res: any) => {
|
||||
form_data.value.mcp_tools = res.data
|
||||
MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess'))
|
||||
// 修改了json,刷新mcp_server
|
||||
form_data.value.mcp_server = form_data.value.mcp_tools.find(
|
||||
(item: any) => item.name === form_data.value.mcp_tool,
|
||||
)?.server
|
||||
})
|
||||
}
|
||||
|
||||
function changeTool() {
|
||||
|
|
|
|||
|
|
@ -137,16 +137,25 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
|||
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import useStore from '@/stores'
|
||||
import { isLastNode } from '@/workflow/common/data'
|
||||
import { t } from '@/locales'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
const { model } = useStore()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
|
||||
|
||||
const wheel = (e: any) => {
|
||||
|
|
@ -220,9 +229,20 @@ const validate = () => {
|
|||
}
|
||||
|
||||
function getSelectModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'LLM' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'LLM',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'LLM',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -185,14 +185,22 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
|||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import ParamSettingDialog from './ParamSettingDialog.vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import useStore from '@/stores'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
const { model } = useStore()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
||||
const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
|
||||
|
|
@ -244,9 +252,20 @@ function refreshParam(data: any) {
|
|||
set(props.nodeModel.properties.node_data, 'reranker_setting', data)
|
||||
}
|
||||
function getSelectModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'RERANKER' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'RERANKER',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'RERANKER',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
const add_reranker_reference = () => {
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@ import type { FormInstance } from 'element-plus'
|
|||
import { ref, computed, onMounted } from 'vue'
|
||||
import { relatedObject } from '@/utils/array'
|
||||
import { SearchMode } from '@/enums/application'
|
||||
import useStore from '@/stores'
|
||||
const { knowledge, application, user } = useStore()
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
const nodeCascaderRef = ref()
|
||||
|
|
|
|||
|
|
@ -98,16 +98,24 @@
|
|||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { groupBy, set } from 'lodash'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import useStore from '@/stores'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
|
||||
} = route as any
|
||||
const { model } = useStore()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
const modelOptions = ref<any>(null)
|
||||
|
|
@ -154,9 +162,20 @@ const form_data = computed({
|
|||
})
|
||||
|
||||
function getSelectModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'STT' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'STT',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'STT',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
getSelectModel()
|
||||
|
|
|
|||
|
|
@ -109,22 +109,30 @@ import { computed, onMounted, ref } from 'vue'
|
|||
import { groupBy, set } from 'lodash'
|
||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import TTSModeParamSettingDialog from '@/views/application/component/TTSModeParamSettingDialog.vue'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import useStore from '@/stores'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const TTSModeParamSettingDialogRef = ref<InstanceType<typeof TTSModeParamSettingDialog>>()
|
||||
const { model } = useStore()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
||||
const TTSModeParamSettingDialogRef = ref<InstanceType<typeof TTSModeParamSettingDialog>>()
|
||||
|
||||
const modelOptions = ref<any>(null)
|
||||
|
||||
const aiChatNodeFormRef = ref<FormInstance>()
|
||||
|
|
@ -170,9 +178,20 @@ const form_data = computed({
|
|||
})
|
||||
|
||||
function getSelectModel() {
|
||||
model.asyncGetSelectModel({ model_type: 'TTS' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
const obj =
|
||||
apiType.value === 'systemManage'
|
||||
? {
|
||||
model_type: 'TTS',
|
||||
// workspace_id: workspace,
|
||||
}
|
||||
: {
|
||||
model_type: 'TTS',
|
||||
}
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getSelectModelList(obj)
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
const openTTSParamSettingDialog = () => {
|
||||
|
|
|
|||
|
|
@ -83,16 +83,26 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import { set } from 'lodash'
|
||||
import { useRoute } from 'vue-router'
|
||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { isLastNode } from '@/workflow/common/data'
|
||||
import applicationApi from '@/api/application/application'
|
||||
import ToolApi from '@/api/tool/tool'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const props = defineProps<{ nodeModel: any }>()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const nodeCascaderRef = ref()
|
||||
|
||||
const form = {
|
||||
|
|
@ -127,8 +137,9 @@ const update_field = () => {
|
|||
set(props.nodeModel.properties, 'status', 500)
|
||||
return
|
||||
}
|
||||
ToolApi.getToolById(props.nodeModel.properties.node_data.tool_lib_id)
|
||||
.then((ok) => {
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.getToolById(props.nodeModel.properties.node_data.tool_lib_id)
|
||||
.then((ok: any) => {
|
||||
const old_input_field_list = props.nodeModel.properties.node_data.input_field_list
|
||||
const merge_input_field_list = ok.data.input_field_list.map((item: any) => {
|
||||
const find_field = old_input_field_list.find((old_item: any) => old_item.name == item.name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue