feat: applicaiton resource managment

v3.2
wangdan-fit2cloud 2025-07-30 19:36:37 +08:00
parent 3951853104
commit 86ad2c54c6
63 changed files with 1730 additions and 831 deletions

View File

@ -3,15 +3,10 @@ import {
get, get,
post, post,
exportExcelPost, exportExcelPost,
postStream,
del, del,
put, put,
request,
download,
exportFile,
} from '@/request/index' } from '@/request/index'
import type {pageRequest} from '@/api/type/common' import type {pageRequest} from '@/api/type/common'
import type {ApplicationFormType} from '@/api/type/application'
import {type Ref} from 'vue' import {type Ref} from 'vue'
import useStore from '@/stores' import useStore from '@/stores'

View File

@ -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,
}

View File

@ -1,21 +1,11 @@
import {Result} from '@/request/Result' import { Result } from '@/request/Result'
import {get, post, postStream, del, put, request, download, exportFile} from '@/request/index' import { get, post, postStream, del, put, request, download, exportFile } from '@/request/index'
import type {pageRequest} from '@/api/type/common' import type { pageRequest } from '@/api/type/common'
import type {ApplicationFormType} from '@/api/type/application' import type { ApplicationFormType } from '@/api/type/application'
import {type Ref} from 'vue' import { type Ref } from 'vue'
const prefix = '/system/resource/application' 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) 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 * @param
@ -86,19 +65,6 @@ const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promis
) => { ) => {
return get(`${prefix}/${application_id}/access_token`, undefined, loading) 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 * AccessToken
* @param application_id * @param application_id
@ -114,6 +80,93 @@ const putAccessToken: (
return put(`${prefix}/${application_id}/access_token`, data, undefined, loading) 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) 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 * @param
@ -218,67 +248,6 @@ const updatePlatformConfig: (
) => Promise<Result<any>> = (application_id, type, data, loading) => { ) => Promise<Result<any>> = (application_id, type, data, loading) => {
return post(`${prefix}/${application_id}/platform/${type}`, data, undefined, 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 * mcp
@ -291,9 +260,7 @@ const getMcpTools: (application_id: String, loading?: Ref<boolean>) => Promise<R
} }
export default { export default {
getAllApplication,
getApplication, getApplication,
postApplication,
putApplication, putApplication,
delApplication, delApplication,
getApplicationDetail, getApplicationDetail,

View File

@ -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,
}

View File

@ -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,
}

View File

@ -25,6 +25,7 @@ interface ApplicationFormType {
tts_autoplay?: boolean tts_autoplay?: boolean
stt_autosend?: boolean stt_autosend?: boolean
folder_id?: string folder_id?: string
workspace_id?: string
} }
interface Chunk { interface Chunk {
real_node_id: string real_node_id: string

View File

@ -41,6 +41,7 @@ import { t } from '@/locales'
import useStore from '@/stores' import useStore from '@/stores'
import { SourceTypeEnum } from '@/enums/common' import { SourceTypeEnum } from '@/enums/common'
import KnowledgeApi from '@/api/knowledge/knowledge' import KnowledgeApi from '@/api/knowledge/knowledge'
import ApplicationApi from '@/api/application/application'
import ToolApi from '@/api/tool/tool' import ToolApi from '@/api/tool/tool'
const { folder, application } = useStore() const { folder, application } = useStore()
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
@ -119,7 +120,7 @@ const submitHandle = async () => {
dialogVisible.value = false dialogVisible.value = false
}) })
} else if (props.source === SourceTypeEnum.APPLICATION) { } 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')) MsgSuccess(t('common.saveSuccess'))
emit('refresh', detail.value) emit('refresh', detail.value)
dialogVisible.value = false dialogVisible.value = false

View File

@ -191,27 +191,24 @@ const submitHandle = async (formEl: FormInstance) => {
function getModelFn() { function getModelFn() {
loading.value = true loading.value = true
if (props.apiType === 'systemManage') { const obj =
modelResourceApi props.apiType === 'systemManage'
.getSelectModelList({ model_type: 'LLM' }, currentKnowledge.value?.workspace_id) ? {
.then((res: any) => { model_type: 'LLM',
modelOptions.value = groupBy(res?.data, 'provider') workspace_id: currentKnowledge.value?.workspace_id,
loading.value = false }
}) : {
.catch(() => { model_type: 'LLM',
loading.value = false }
}) loadSharedApi({ type: 'model', systemType: props.apiType })
} else { .getSelectModelList(obj)
loadSharedApi({ type: 'model', systemType: props.apiType }) .then((res: any) => {
.getSelectModelList({ model_type: 'LLM' }) modelOptions.value = groupBy(res?.data, 'provider')
.then((res: any) => { loading.value = false
modelOptions.value = groupBy(res?.data, 'provider') })
loading.value = false .catch(() => {
}) loading.value = false
.catch(() => { })
loading.value = false
})
}
} }
defineExpose({ open, dialogVisible }) defineExpose({ open, dialogVisible })

View File

@ -36,13 +36,13 @@ const route = useRoute()
const { const {
meta: { activeMenu }, meta: { activeMenu },
params: { id, folderId }, params: { id, folderId },
query: { isShared, type }, query: { isShared },
} = route as any } = route as any
const apiType = computed(() => { const apiType = computed(() => {
if (route.path.includes('shared')) { if (route.path.includes('shared')) {
return 'systemShare' return 'systemShare'
} else if (route.path.includes('resource-management') || type === 'systemManage') { } else if (route.path.includes('resource-management')) {
return 'systemManage' return 'systemManage'
} else { } else {
return 'workspace' return 'workspace'
@ -71,7 +71,7 @@ const isKnowledge = computed(() => {
const toBackPath = computed(() => { const toBackPath = computed(() => {
if (route.path.includes('shared')) { if (route.path.includes('shared')) {
return '/system/shared' + activeMenu 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 return '/system/resource-management' + activeMenu
} else { } else {
return activeMenu return activeMenu
@ -93,8 +93,8 @@ function getKnowledgeDetail() {
function getApplicationDetail() { function getApplicationDetail() {
loading.value = true loading.value = true
application loadSharedApi({ type: 'application', systemType: apiType.value })
.asyncGetApplicationDetail(id) .getApplicationDetail(id)
.then((res: any) => { .then((res: any) => {
current.value = res.data current.value = res.data
loading.value = false loading.value = false

View File

@ -47,7 +47,7 @@ const props = defineProps<{
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const { const {
params: { id, type }, params: { id, type, from },
} = route as any } = route as any
function showMenu() { function showMenu() {
@ -60,7 +60,7 @@ function showMenu() {
function clickHandle(item?: any) { function clickHandle(item?: any) {
if (isWorkFlow(type) && item?.name === 'AppSetting') { if (isWorkFlow(type) && item?.name === 'AppSetting') {
router.push({ path: `/application/${id}/workflow` }) router.push({ path: `/application/${from}/${id}/workflow` })
} }
} }
const menuIcon = computed(() => { const menuIcon = computed(() => {

View File

@ -33,10 +33,15 @@ import { useRoute } from 'vue-router'
const route = useRoute() const route = useRoute()
const { const {
params: { folderId }, // idknowledgeID params: { folderId }, // idknowledgeID
query: { type }, query: { from },
} = route as any } = route as any
const isShared = computed(() => { 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 { theme, user } = useStore()
const isDefaultTheme = computed(() => { const isDefaultTheme = computed(() => {

View File

@ -12,10 +12,15 @@ const isDefaultTheme = computed(() => {
}) })
const { const {
params: { folderId }, // idknowledgeID params: { folderId }, // idknowledgeID
query: { type }, query: { from },
} = route as any } = route as any
const isShared = computed(() => { const isShared = computed(() => {
return folderId === 'shared' || type === 'systemShare' || type === 'systemManage' return (
folderId === 'shared' ||
from === 'systemShare' ||
from === 'systemManage' ||
folderId === 'resource-management'
)
}) })
</script> </script>

View File

@ -1,5 +1,7 @@
import workspace from './workspace' import workspace from './workspace'
import systemManage from './system-manage'
const permission = { const permission = {
workspace, workspace,
systemManage,
} }
export default permission export default permission

View File

@ -4,7 +4,7 @@ import {PermissionConst, RoleConst} from '@/utils/permission/data'
const systemManage = { const systemManage = {
create: () => false, create: () => false,
folderCreate: () => false, folderCreate: () => false,
edit: () => edit: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -13,7 +13,7 @@ const systemManage = {
'OR' 'OR'
), ),
folderEdit: () => false, folderEdit: () => false,
export: () => export: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -21,16 +21,16 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
delete: () => delete: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
PermissionConst.RESOURCE_APPLICATION_DELETE PermissionConst.RESOURCE_APPLICATION_DELETE
], ],
'OR' 'OR'
), ),
folderDelete: () => false, folderDelete: () => false,
overview_embed: () => overview_embed: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -38,7 +38,7 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
overview_access: () => overview_access: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -46,7 +46,7 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
overview_display: () => overview_display: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -54,7 +54,7 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
overview_api_key: () => overview_api_key: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -62,7 +62,7 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
access_edit: () => access_edit: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -70,7 +70,7 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
application_chat_user_edit: () => application_chat_user_edit: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -78,7 +78,7 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
chat_log_clear: () => chat_log_clear: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -86,7 +86,7 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
chat_log_export: () => chat_log_export: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
@ -94,12 +94,13 @@ const systemManage = {
], ],
'OR' 'OR'
), ),
chat_log_add_knowledge: () => chat_log_add_knowledge: () =>
hasPermission( hasPermission(
[ [
RoleConst.ADMIN, RoleConst.ADMIN,
PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_ADD_KNOWLEDGE PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_ADD_KNOWLEDGE
], ],
'OR' 'OR'
), ),
} }
export default systemManage

View File

@ -5,7 +5,7 @@ import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/dat
import { ComplexPermission } from '@/utils/permission/type' import { ComplexPermission } from '@/utils/permission/type'
const ApplicationDetailRouter = { const ApplicationDetailRouter = {
path: '/application/:id/:type', path: '/application/:from/:id/:type',
name: 'ApplicationDetail', name: 'ApplicationDetail',
meta: { title: 'views.applicationOverview.title', activeMenu: '/application', breadcrumb: true }, meta: { title: 'views.applicationOverview.title', activeMenu: '/application', breadcrumb: true },
component: () => import('@/layout/layout-template/MainLayout.vue'), component: () => import('@/layout/layout-template/MainLayout.vue'),
@ -19,7 +19,7 @@ const ApplicationDetailRouter = {
iconActive: 'app-all-menu-active', iconActive: 'app-all-menu-active',
title: 'views.applicationOverview.title', title: 'views.applicationOverview.title',
active: 'overview', active: 'overview',
parentPath: '/application/:id/:type', parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail', parentName: 'ApplicationDetail',
permission: [ permission: [
() => { () => {
@ -46,7 +46,7 @@ const ApplicationDetailRouter = {
iconActive: 'app-setting-active', iconActive: 'app-setting-active',
title: 'common.setting', title: 'common.setting',
active: 'setting', active: 'setting',
parentPath: '/application/:id/:type', parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail', parentName: 'ApplicationDetail',
permission: [ permission: [
() => { () => {
@ -72,7 +72,7 @@ const ApplicationDetailRouter = {
iconActive: 'app-access-active', iconActive: 'app-access-active',
title: 'views.application.applicationAccess.title', title: 'views.application.applicationAccess.title',
active: 'access', active: 'access',
parentPath: '/application/:id/:type', parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail', parentName: 'ApplicationDetail',
permission: [ permission: [
() => { () => {
@ -96,7 +96,7 @@ const ApplicationDetailRouter = {
iconActive: 'app-user-chat', iconActive: 'app-user-chat',
title: 'views.chatUser.title', title: 'views.chatUser.title',
active: 'chat-user', active: 'chat-user',
parentPath: '/application/:id/:type', parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail', parentName: 'ApplicationDetail',
resourceType: SourceTypeEnum.APPLICATION, resourceType: SourceTypeEnum.APPLICATION,
permission: [ permission: [
@ -122,7 +122,7 @@ const ApplicationDetailRouter = {
iconActive: 'app-document-active', iconActive: 'app-document-active',
title: 'views.chatLog.title', title: 'views.chatLog.title',
active: 'chat-log', active: 'chat-log',
parentPath: '/application/:id/:type', parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail', parentName: 'ApplicationDetail',
permission: [ permission: [
() => { () => {

View File

@ -31,7 +31,7 @@ export const routes: Array<RouteRecordRaw> = [
// 高级编排 // 高级编排
{ {
path: '/application/:id/workflow', path: '/application/:from/:id/workflow',
name: 'ApplicationWorkflow', name: 'ApplicationWorkflow',
meta: {activeMenu: '/application'}, meta: {activeMenu: '/application'},
component: () => import('@/views/application-workflow/index.vue'), component: () => import('@/views/application-workflow/index.vue'),

View File

@ -7,7 +7,6 @@ import useKnowledgeStore from './modules/knowledge'
import useModelStore from './modules/model' import useModelStore from './modules/model'
import usePromptStore from './modules/prompt' import usePromptStore from './modules/prompt'
import useApplicationStore from './modules/application' import useApplicationStore from './modules/application'
import useChatLogStore from './modules/chat-log'
import useChatUserStore from './modules/chat-user' import useChatUserStore from './modules/chat-user'
import useToolStore from './modules/tool' import useToolStore from './modules/tool'
const useStore = () => ({ const useStore = () => ({
@ -20,7 +19,6 @@ const useStore = () => ({
model: useModelStore(), model: useModelStore(),
prompt: usePromptStore(), prompt: usePromptStore(),
application: useApplicationStore(), application: useApplicationStore(),
chatLog: useChatLogStore(),
chatUser: useChatUserStore(), chatUser: useChatUserStore(),
tool: useToolStore(), tool: useToolStore(),
}) })

View File

@ -1,51 +1,10 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import applicationApi from '@/api/application/application'
import { type Ref } from 'vue' import { type Ref } from 'vue'
const useApplicationStore = defineStore('application', { const useApplicationStore = defineStore('application', {
state: () => ({ state: () => ({
location: `${window.location.origin}${window.MaxKB.chatPrefix ? window.MaxKB.chatPrefix : window.MaxKB.prefix}/`, location: `${window.location.origin}${window.MaxKB.chatPrefix ? window.MaxKB.chatPrefix : window.MaxKB.prefix}/`,
}), }),
actions: { 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)
})
})
},
},
}) })
export default useApplicationStore export default useApplicationStore

View File

@ -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

View File

@ -5,6 +5,10 @@ import problemWorkspaceApi from '@/api/knowledge/problem'
import modelWorkspaceApi from '@/api/model/model' import modelWorkspaceApi from '@/api/model/model'
import toolWorkspaceApi from '@/api/tool/tool' import toolWorkspaceApi from '@/api/tool/tool'
import chatUserWorkspaceApi from '@/api/chat-user/chat-user' 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 sharedWorkspaceApi from '@/api/shared-workspace'
import toolSystemShareApi from '@/api/system-shared/tool' import toolSystemShareApi from '@/api/system-shared/tool'
import modelSystemShareApi from '@/api/system-shared/model' 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 problemResourceApi from '@/api/system-resource-management/problem'
import modelResourceApi from '@/api/system-resource-management/model' import modelResourceApi from '@/api/system-resource-management/model'
import chatUserResourceApi from '@/api/system-resource-management/chat-user' 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 // 普通 API
const workspaceApiMap = { const workspaceApiMap = {
@ -33,6 +41,10 @@ const workspaceApiMap = {
problem: problemWorkspaceApi, problem: problemWorkspaceApi,
chatUser: chatUserWorkspaceApi, chatUser: chatUserWorkspaceApi,
workspace: workspaceApi, workspace: workspaceApi,
application: applicationWorkspaceApi,
applicationKey: applicationKeyWorkspaceApi,
workflowVersion: workflowVersionWorkspaceApi,
chatLog: chatLogWorkspaceApi,
} as any } as any
// 系统分享 API // 系统分享 API
@ -56,6 +68,10 @@ const systemManageApiMap = {
model: modelResourceApi, model: modelResourceApi,
tool: ToolResourceApi, tool: ToolResourceApi,
chatUser: chatUserResourceApi, chatUser: chatUserResourceApi,
application: applicationResourceApi,
applicationKey: applicationKeyResourceApi,
workflowVersion: workflowVersionResourceApi,
chatLog: chatLogWResourceApi,
} as any } as any
const data = { const data = {

View File

@ -58,19 +58,27 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { copyClick } from '@/utils/clipboard' import { copyClick } from '@/utils/clipboard'
import applicationKeyApi from '@/api/application/application-key'
import SettingAPIKeyDialog from './SettingAPIKeyDialog.vue' import SettingAPIKeyDialog from './SettingAPIKeyDialog.vue'
import { datetimeFormat } from '@/utils/time' import { datetimeFormat } from '@/utils/time'
import { MsgSuccess, MsgConfirm } from '@/utils/message' import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { t } from '@/locales' import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id } params: { id },
} = route } = route
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['addData']) const emit = defineEmits(['addData'])
const SettingAPIKeyDialogRef = ref() const SettingAPIKeyDialogRef = ref()
@ -96,28 +104,30 @@ function deleteApiKey(row: any) {
{ {
confirmButtonText: t('common.confirm'), confirmButtonText: t('common.confirm'),
cancelButtonText: t('common.cancel'), cancelButtonText: t('common.cancel'),
confirmButtonClass: 'color-danger' confirmButtonClass: 'color-danger',
} },
) )
.then(() => { .then(() => {
applicationKeyApi.delAPIKey(id as string, row.id, loading).then(() => { loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
MsgSuccess(t('common.deleteSuccess')) .delAPIKey(id as string, row.id, loading)
getApiKeyList() .then(() => {
}) MsgSuccess(t('common.deleteSuccess'))
getApiKeyList()
})
}) })
.catch(() => {}) .catch(() => {})
} }
async function changeState(row: any) { async function changeState(row: any) {
const obj = { const obj = {
is_active: !row.is_active is_active: !row.is_active,
} }
const str = obj.is_active const str = obj.is_active
? t('views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess') ? t('views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess')
: t('views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess') : t('views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess')
await applicationKeyApi await loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
.putAPIKey(id as string, row.id, obj, loading) .putAPIKey(id as string, row.id, obj, loading)
.then((res) => { .then(() => {
MsgSuccess(str) MsgSuccess(str)
getApiKeyList() getApiKeyList()
return true return true
@ -128,9 +138,11 @@ async function changeState(row: any) {
} }
function createApiKey() { function createApiKey() {
applicationKeyApi.postAPIKey(id as string, loading).then((res) => { loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
getApiKeyList() .postAPIKey(id as string, loading)
}) .then(() => {
getApiKeyList()
})
} }
const open = () => { const open = () => {
@ -139,10 +151,12 @@ const open = () => {
} }
function getApiKeyList() { function getApiKeyList() {
applicationKeyApi.getAPIKey(id as string, loading).then((res) => { loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
res.data.sort((x:any,y:any)=>x.name < y.name ? 1 : -1) .getAPIKey(id as string, loading)
apiKey.value = res.data .then((res: any) => {
}) res.data?.sort((x: any, y: any) => (x.name < y.name ? 1 : -1))
apiKey.value = res.data
})
} }
function refresh() { function refresh() {

View File

@ -47,18 +47,24 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import type { FormInstance, FormRules, UploadFiles } from 'element-plus' import type { FormInstance } from 'element-plus'
import applicationApi from '@/api/application/application'
import { MsgSuccess, MsgError } from '@/utils/message' 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 route = useRoute()
const { const {
params: { id }, params: { id },
} = route } = route
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
const displayFormRef = ref() const displayFormRef = ref()
@ -94,12 +100,14 @@ const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
await formEl.validate((valid, fields) => { await formEl.validate((valid, fields) => {
if (valid) { if (valid) {
applicationApi.putAccessToken(id as string, form.value, loading).then((res) => { loadSharedApi({ type: 'application', systemType: apiType.value })
emit('refresh') .putAccessToken(id as string, form.value, loading)
// @ts-ignore .then(() => {
MsgSuccess(t('common.settingSuccess')) emit('refresh')
dialogVisible.value = false // @ts-ignore
}) MsgSuccess(t('common.settingSuccess'))
dialogVisible.value = false
})
} }
}) })
} }

View File

@ -51,18 +51,25 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import applicationApi from '@/api/application/application'
import { MsgSuccess } from '@/utils/message' import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales' import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route } = route
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
const limitFormRef = ref() const limitFormRef = ref()
@ -107,17 +114,17 @@ const submit = async (formEl: FormInstance | undefined) => {
authentication: form.value.authentication, authentication: form.value.authentication,
authentication_value: form.value.authentication_value, authentication_value: form.value.authentication_value,
} }
applicationApi.putAccessToken(id as string, obj, loading).then((res) => { loadSharedApi({ type: 'application', systemType: apiType.value })
emit('refresh') .putAccessToken(id as string, obj, loading)
// @ts-ignore .then(() => {
MsgSuccess(t('common.settingSuccess')) emit('refresh')
dialogVisible.value = false // @ts-ignore
}) MsgSuccess(t('common.settingSuccess'))
dialogVisible.value = false
})
} }
}) })
} }
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
</style>

View File

@ -34,25 +34,33 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import applicationKeyApi from '@/api/application/application-key'
import overviewSystemApi from '@/api/system/api-key' import overviewSystemApi from '@/api/system/api-key'
import { MsgSuccess } from '@/utils/message' import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales' import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id } params: { id },
} = route } = route
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
const settingFormRef = ref() const settingFormRef = ref()
const form = ref<any>({ const form = ref<any>({
allow_cross_domain: false, allow_cross_domain: false,
cross_domain_list: '' cross_domain_list: '',
}) })
const dialogVisible = ref<boolean>(false) const dialogVisible = ref<boolean>(false)
@ -65,7 +73,7 @@ watch(dialogVisible, (bool) => {
if (!bool) { if (!bool) {
form.value = { form.value = {
allow_cross_domain: false, 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) { ? form.value.cross_domain_list.split('\n').filter(function (item: string) {
return item !== '' return item !== ''
}) })
: [] : [],
} }
const apiCall = const apiCall =
APIType.value === 'APPLICATION' 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) : overviewSystemApi.putAPIKey(APIKeyId.value, obj, loading)
apiCall.then((res) => { apiCall.then(() => {
emit('refresh') emit('refresh')
//@ts-ignore //@ts-ignore
MsgSuccess(t('common.settingSuccess')) MsgSuccess(t('common.settingSuccess'))

View File

@ -206,7 +206,6 @@ import XPackLimitDrawer from './xpack-component/XPackLimitDrawer.vue'
import DisplaySettingDialog from './component/DisplaySettingDialog.vue' import DisplaySettingDialog from './component/DisplaySettingDialog.vue'
import XPackDisplaySettingDialog from './xpack-component/XPackDisplaySettingDialog.vue' import XPackDisplaySettingDialog from './xpack-component/XPackDisplaySettingDialog.vue'
import StatisticsCharts from './component/StatisticsCharts.vue' import StatisticsCharts from './component/StatisticsCharts.vue'
import applicationApi from '@/api/application/application'
import { nowDate, beforeDay } from '@/utils/time' import { nowDate, beforeDay } from '@/utils/time'
import { MsgSuccess, MsgConfirm } from '@/utils/message' import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { copyClick } from '@/utils/clipboard' import { copyClick } from '@/utils/clipboard'
@ -217,21 +216,24 @@ import { t } from '@/locales'
import { EditionConst } from '@/utils/permission/data' import { EditionConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index' import { hasPermission } from '@/utils/permission/index'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const {
params: { id },
} = route as any
const apiType = computed<'workspace'>(() => { const apiType = computed(() => {
return 'workspace' if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
}) })
const permissionPrecise = computed(() => { const permissionPrecise = computed(() => {
return permissionMap['application'][apiType.value] return permissionMap['application'][apiType.value]
}) })
const { user, application } = useStore()
const {
params: { id },
} = route as any
const apiUrl = window.location.origin + '/doc_chat/' const apiUrl = window.location.origin + '/doc_chat/'
const baseUrl = window.location.origin + `${window.MaxKB.chatPrefix}/api/` const baseUrl = window.location.origin + `${window.MaxKB.chatPrefix}/api/`
@ -292,7 +294,6 @@ const daterange = ref({
const statisticsLoading = ref(false) const statisticsLoading = ref(false)
const statisticsData = ref([]) const statisticsData = ref([])
const showEditIcon = ref(false)
const apiInputParams = ref([]) const apiInputParams = ref([])
function toUrl(url: string) { function toUrl(url: string) {
@ -313,9 +314,11 @@ function openDisplaySettingDialog() {
} }
nextTick(() => { nextTick(() => {
if (currentDisplaySettingDialog.value == XPackDisplaySettingDialog) { if (currentDisplaySettingDialog.value == XPackDisplaySettingDialog) {
applicationApi.getApplicationSetting(id).then((ok) => { loadSharedApi({ type: 'application', systemType: apiType.value })
DisplaySettingDialogRef.value?.open(ok.data, detail.value) .getApplicationSetting(id)
}) .then((ok: any) => {
DisplaySettingDialogRef.value?.open(ok.data, detail.value)
})
} else { } else {
DisplaySettingDialogRef.value?.open(accessToken.value, detail.value) DisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
} }
@ -354,9 +357,11 @@ function changeDayRangeHandle(val: string) {
} }
function getAppStatistics() { function getAppStatistics() {
applicationApi.getStatistics(id, daterange.value, statisticsLoading).then((res: any) => { loadSharedApi({ type: 'application', systemType: apiType.value })
statisticsData.value = res.data .getStatistics(id, daterange.value, statisticsLoading)
}) .then((res: any) => {
statisticsData.value = res.data
})
} }
function refreshAccessToken() { function refreshAccessToken() {
@ -394,10 +399,12 @@ async function changeState(bool: boolean) {
} }
async function updateAccessToken(obj: any, str: string) { async function updateAccessToken(obj: any, str: string) {
applicationApi.putAccessToken(id as string, obj, loading).then((res) => { loadSharedApi({ type: 'application', systemType: apiType.value })
accessToken.value = res?.data .putAccessToken(id as string, obj, loading)
MsgSuccess(str) .then((res: any) => {
}) accessToken.value = res?.data
MsgSuccess(str)
})
} }
function openAPIKeyDialog() { function openAPIKeyDialog() {
@ -409,46 +416,46 @@ function openDialog() {
} }
function getAccessToken() { function getAccessToken() {
application.asyncGetAccessToken(id, loading).then((res: any) => { loadSharedApi({ type: 'application', systemType: apiType.value })
accessToken.value = res?.data .getAccessToken(id, loading)
}) .then((res: any) => {
accessToken.value = res?.data
})
} }
function getDetail() { function getDetail() {
application.asyncGetApplicationDetail(id, loading).then((res: any) => { loadSharedApi({ type: 'application', systemType: apiType.value })
detail.value = res.data .getApplicationDetail(id, loading)
detail.value.work_flow?.nodes .then((res: any) => {
?.filter((v: any) => v.id === 'base-node') detail.value = res.data
.map((v: any) => { detail.value.work_flow?.nodes
apiInputParams.value = v.properties.api_input_field_list ?.filter((v: any) => v.id === 'base-node')
? v.properties.api_input_field_list.map((v: any) => { .map((v: any) => {
return { apiInputParams.value = v.properties.api_input_field_list
name: v.variable, ? v.properties.api_input_field_list.map((v: any) => {
value: v.default_value, 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') : v.properties.input_field_list
.map((v: any) => { ? v.properties.input_field_list
return { .filter((v: any) => v.assignment_method === 'api_input')
name: v.variable, .map((v: any) => {
value: v.default_value, return {
} name: v.variable,
}) value: v.default_value,
: [] }
}) })
}) : []
})
})
} }
function refresh() { function refresh() {
getAccessToken() getAccessToken()
} }
function refreshIcon() {
getDetail()
}
onMounted(() => { onMounted(() => {
getDetail() getDetail()
getAccessToken() getAccessToken()

View File

@ -481,11 +481,11 @@ import { computed, ref, watch } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import type { FormInstance, FormRules, UploadFiles } from 'element-plus' import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
import { isAppIcon } from '@/utils/common' import { isAppIcon } from '@/utils/common'
import applicationApi from '@/api/application/application'
import { MsgSuccess, MsgError } from '@/utils/message' import { MsgSuccess, MsgError } from '@/utils/message'
import { langList, t } from '@/locales' import { langList, t } from '@/locales'
import useStore from '@/stores' import useStore from '@/stores'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const { user } = useStore() const { user } = useStore()
@ -494,6 +494,14 @@ const {
params: { id }, params: { id },
} = route } = route
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
const defaultSetting = { const defaultSetting = {
@ -663,12 +671,14 @@ const submit = async (formEl: FormInstance | undefined) => {
fd.append(item, xpackForm.value[item]) fd.append(item, xpackForm.value[item])
} }
}) })
applicationApi.putXpackAccessToken(id as string, fd, loading).then((res) => { loadSharedApi({ type: 'application', systemType: apiType.value })
emit('refresh') .putXpackAccessToken(id as string, fd, loading)
// @ts-ignore .then(() => {
MsgSuccess(t('common.settingSuccess')) emit('refresh')
dialogVisible.value = false // @ts-ignore
}) MsgSuccess(t('common.settingSuccess'))
dialogVisible.value = false
})
} }
}) })
} }

View File

@ -144,13 +144,13 @@
</el-drawer> </el-drawer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import applicationApi from '@/api/application/application'
import { MsgSuccess } from '@/utils/message' import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales' import { t } from '@/locales'
import { copyClick } from '@/utils/clipboard' import { copyClick } from '@/utils/clipboard'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@ -158,6 +158,13 @@ const {
params: { id }, params: { id },
} = route } = route
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
const auth_list = ref<Array<{ label: string; value: string }>>([]) const auth_list = ref<Array<{ label: string; value: string }>>([])
const limitFormRef = ref() const limitFormRef = ref()
@ -198,9 +205,11 @@ const open = (data: any) => {
} }
form.value.authentication = data.authentication form.value.authentication = data.authentication
dialogVisible.value = true dialogVisible.value = true
applicationApi.getChatUserAuthType().then((ok) => { loadSharedApi({ type: 'application', systemType: apiType.value })
auth_list.value = ok.data .getChatUserAuthType()
}) .then((ok: any) => {
auth_list.value = ok.data
})
} }
const submit = async (formEl: FormInstance | undefined) => { const submit = async (formEl: FormInstance | undefined) => {
@ -214,12 +223,14 @@ const submit = async (formEl: FormInstance | undefined) => {
authentication: form.value.authentication, authentication: form.value.authentication,
authentication_value: form.value.authentication_value, authentication_value: form.value.authentication_value,
} }
applicationApi.putAccessToken(id as string, obj, loading).then((res) => { loadSharedApi({ type: 'application', systemType: apiType.value })
emit('refresh') .putAccessToken(id as string, obj, loading)
// @ts-ignore .then(() => {
MsgSuccess(t('common.settingSuccess')) emit('refresh')
dialogVisible.value = false // @ts-ignore
}) MsgSuccess(t('common.settingSuccess'))
dialogVisible.value = false
})
} }
}) })
} }

View File

@ -127,7 +127,6 @@ import { isWorkFlow } from '@/utils/application'
import useStore from '@/stores' import useStore from '@/stores'
import NodeContent from './NodeContent.vue' import NodeContent from './NodeContent.vue'
import { SourceTypeEnum } from '@/enums/common' import { SourceTypeEnum } from '@/enums/common'
import ApplicationApi from '@/api/application/application'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
const route = useRoute() const route = useRoute()
@ -149,9 +148,7 @@ const props = defineProps({
const emit = defineEmits(['clickNodes', 'onmousedown']) const emit = defineEmits(['clickNodes', 'onmousedown'])
const apiType = computed(() => { const apiType = computed(() => {
if (route.path.includes('shared')) { if (route.path.includes('resource-management')) {
return 'systemShare'
} else if (route.path.includes('resource-management')) {
return 'systemManage' return 'systemManage'
} else { } else {
return 'workspace' return 'workspace'
@ -256,8 +253,7 @@ async function getToolFolder() {
async function getToolList() { async function getToolList() {
const res = await loadSharedApi({ const res = await loadSharedApi({
type: 'tool', type: 'tool',
isShared: isShared.value, systemType: 'workspace',
systemType: apiType.value,
}).getToolList({ }).getToolList({
folder_id: folder.currentFolder?.id || user.getWorkspaceId(), folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
}) })
@ -276,10 +272,13 @@ function getApplicationFolder() {
} }
async function getApplicationList() { async function getApplicationList() {
const res = await ApplicationApi.getAllApplication({ const res = await loadSharedApi({
type: 'application',
systemType: 'workspace',
}).getAllApplication({
folder_id: folder.currentFolder?.id || user.getWorkspaceId(), 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) { function folderClickHandle(row: any) {

View File

@ -71,14 +71,21 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed } from 'vue' import { ref, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import workFlowVersionApi from '@/api/application/workflow-version'
import { datetimeFormat } from '@/utils/time' import { datetimeFormat } from '@/utils/time'
import { MsgSuccess, MsgError } from '@/utils/message' import { MsgSuccess, MsgError } from '@/utils/message'
import { t } from '@/locales' import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id } params: { id },
} = route as any } = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['click', 'refreshVersion']) const emit = defineEmits(['click', 'refreshVersion'])
const loading = ref(false) const loading = ref(false)
@ -109,22 +116,26 @@ function closeWrite(item: any) {
function editName(val: string, item: any) { function editName(val: string, item: any) {
if (val) { if (val) {
const obj = { const obj = {
name: val name: val,
} }
workFlowVersionApi.putWorkFlowVersion(id as string, item.id, obj, loading).then(() => { loadSharedApi({ type: 'workflowVersion', systemType: apiType.value })
MsgSuccess(t('common.modifySuccess')) .putWorkFlowVersion(id as string, item.id, obj, loading)
item['writeStatus'] = false .then(() => {
getList() MsgSuccess(t('common.modifySuccess'))
}) item['writeStatus'] = false
getList()
})
} else { } else {
MsgError(t('views.applicationWorkflow.tip.nameMessage')) MsgError(t('views.applicationWorkflow.tip.nameMessage'))
} }
} }
function getList() { function getList() {
workFlowVersionApi.getWorkFlowVersion(id, loading).then((res: any) => { loadSharedApi({ type: 'workflowVersion', systemType: apiType.value })
LogData.value = res.data .getWorkFlowVersion(id, loading)
}) .then((res: any) => {
LogData.value = res.data
})
} }
onMounted(() => { onMounted(() => {

View File

@ -141,7 +141,6 @@ import type { Action } from 'element-plus'
import Workflow from '@/workflow/index.vue' import Workflow from '@/workflow/index.vue'
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue' import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue' import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
import ApplicationAPI from '@/api/application/application'
import { isAppIcon, resetUrl } from '@/utils/common' import { isAppIcon, resetUrl } from '@/utils/common'
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message' import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
import { datetimeFormat } from '@/utils/time' import { datetimeFormat } from '@/utils/time'
@ -152,17 +151,25 @@ import { hasPermission } from '@/utils/permission'
import { t } from '@/locales' import { t } from '@/locales'
import { ComplexPermission } from '@/utils/permission/type' import { ComplexPermission } from '@/utils/permission/type'
import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/data' 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 router = useRouter()
const route = useRoute() 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(() => { const isDefaultTheme = computed(() => {
return theme.isDefaultTheme() return theme.isDefaultTheme()
}) })
const {
params: { id },
} = route as any
let interval: any let interval: any
const workflowRef = ref() const workflowRef = ref()
@ -285,9 +292,14 @@ const publish = () => {
MsgError(e.toString()) MsgError(e.toString())
return return
} }
ApplicationAPI.putApplication(id, { work_flow: workflow }, loading) loadSharedApi({ type: 'application', systemType: apiType.value })
.then((ok) => { .putApplication(id, { work_flow: workflow }, loading)
return ApplicationAPI.publish(id, {}, loading) .then(() => {
return loadSharedApi({ type: 'application', systemType: apiType.value }).publish(
id,
{},
loading,
)
}) })
.then((ok: any) => { .then((ok: any) => {
detail.value.name = ok.data.name detail.value.name = ok.data.name
@ -372,51 +384,57 @@ function getGraphData() {
} }
function getDetail() { function getDetail() {
application.asyncGetApplicationDetail(id).then((res: any) => { loadSharedApi({ type: 'application', systemType: apiType.value })
res.data?.work_flow['nodes'].map((v: any) => { .getApplicationDetail(id)
v['properties']['noRender'] = true .then((res: any) => {
}) res.data?.work_flow['nodes'].map((v: any) => {
detail.value = res.data v['properties']['noRender'] = true
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,
}
})
: []
}) })
application.asyncGetAccessToken(id, loading).then((res: any) => { detail.value = res.data
detail.value = { ...detail.value, ...res.data } detail.value.stt_model_id = res.data.stt_model
}) detail.value.tts_model_id = res.data.tts_model
workflowRef.value?.clearGraphData() detail.value.tts_type = res.data.tts_type
nextTick(() => { saveTime.value = res.data?.update_time
workflowRef.value?.render(detail.value.work_flow) detail.value.work_flow?.nodes
cloneWorkFlow.value = getGraphData() ?.filter((v: any) => v.id === 'base-node')
}) .map((v: any) => {
// apiInputParams.value = v.properties.api_input_field_list
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) { ? v.properties.api_input_field_list.map((v: any) => {
ApplicationAPI.getApplicationSetting(id).then((ok) => { return {
detail.value = { ...detail.value, ...ok.data } 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) { function saveApplication(bool?: boolean, back?: boolean) {
@ -424,9 +442,9 @@ function saveApplication(bool?: boolean, back?: boolean) {
work_flow: getGraphData(), work_flow: getGraphData(),
} }
loading.value = back || false loading.value = back || false
application loadSharedApi({ type: 'application', systemType: apiType.value })
.asyncPutApplication(id, obj) .putApplication(id, obj)
.then((res) => { .then(() => {
saveTime.value = new Date() saveTime.value = new Date()
if (bool) { if (bool) {
cloneWorkFlow.value = getGraphData() cloneWorkFlow.value = getGraphData()
@ -627,5 +645,4 @@ onBeforeUnmount(() => {
height: 600px; height: 600px;
} }
} }
</style> </style>

View File

@ -16,7 +16,7 @@
<el-card shadow="hover" class="border-none cursor"> <el-card shadow="hover" class="border-none cursor">
<div class="flex-between"> <div class="flex-between">
<div class="flex align-center ml-8 mr-8"> <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"> <div class="ml-12">
<h5 class="mb-4">{{ item.name }}</h5> <h5 class="mb-4">{{ item.name }}</h5>
<el-text type="info" style="font-size: 12px">{{ item.description }}</el-text> <el-text type="info" style="font-size: 12px">{{ item.description }}</el-text>
@ -31,11 +31,12 @@
v-if="permissionPrecise.access_edit(id)" v-if="permissionPrecise.access_edit(id)"
/> />
<el-divider direction="vertical" /> <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)" v-if="permissionPrecise.access_edit(id)"
>{{ >{{ $t('views.application.applicationAccess.setting') }}</el-button
$t('views.application.applicationAccess.setting') >
}}</el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
@ -48,16 +49,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref, onMounted, computed } from 'vue' import { reactive, ref, onMounted, computed } from 'vue'
import AccessSettingDrawer from './component/AccessSettingDrawer.vue' import AccessSettingDrawer from './component/AccessSettingDrawer.vue'
import applicationApi from '@/api/application/application'
import { MsgSuccess } from '@/utils/message' import { MsgSuccess } from '@/utils/message'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { t } from '@/locales' import { t } from '@/locales'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const apiType = computed<'workspace'>(() => { const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace' return 'workspace'
}
}) })
const permissionPrecise = computed(() => { const permissionPrecise = computed(() => {
return permissionMap['application'][apiType.value] return permissionMap['application'][apiType.value]
@ -123,13 +127,15 @@ function refresh() {
function getPlatformStatus() { function getPlatformStatus() {
loading.value = true loading.value = true
applicationApi.getPlatformStatus(id).then((res: any) => { loadSharedApi({ type: 'application', systemType: apiType.value })
platforms.forEach((platform) => { .getPlatformStatus(id)
platform.isActive = res.data[platform.key][1] .then((res: any) => {
platform.exists = res.data[platform.key][0] 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) { function changeStatus(type: string, value: boolean) {
@ -137,9 +143,11 @@ function changeStatus(type: string, value: boolean) {
type: type, type: type,
status: value, status: value,
} }
applicationApi.updatePlatformStatus(id, data).then(() => { loadSharedApi({ type: 'application', systemType: apiType.value })
MsgSuccess(t('common.saveSuccess')) .updatePlatformStatus(id, data)
}) .then(() => {
MsgSuccess(t('common.saveSuccess'))
})
} }
onMounted(() => { onMounted(() => {

View File

@ -446,28 +446,31 @@ import type { FormInstance, FormRules } from 'element-plus'
import type { ApplicationFormType } from '@/api/type/application' import type { ApplicationFormType } from '@/api/type/application'
import { relatedObject } from '@/utils/array' import { relatedObject } from '@/utils/array'
import { MsgSuccess, MsgWarning } from '@/utils/message' import { MsgSuccess, MsgWarning } from '@/utils/message'
import useStore from '@/stores'
import { t } from '@/locales' import { t } from '@/locales'
import TTSModeParamSettingDialog from './component/TTSModeParamSettingDialog.vue' import TTSModeParamSettingDialog from './component/TTSModeParamSettingDialog.vue'
import ReasoningParamSettingDialog from './component/ReasoningParamSettingDialog.vue' import ReasoningParamSettingDialog from './component/ReasoningParamSettingDialog.vue'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import ApplicationAPI from '@/api/application/application'
import { EditionConst } from '@/utils/permission/data' import { EditionConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index' import { hasPermission } from '@/utils/permission/index'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const apiType = computed<'workspace'>(() => { const {
return 'workspace' params: { id },
} = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
}) })
const permissionPrecise = computed(() => { const permissionPrecise = computed(() => {
return permissionMap['application'][apiType.value] return permissionMap['application'][apiType.value]
}) })
const { knowledge, model, application } = useStore()
const {
params: { id },
} = route as any
// @ts-ignore // @ts-ignore
const defaultPrompt = t('views.application.form.prompt.defaultPrompt', { const defaultPrompt = t('views.application.form.prompt.defaultPrompt', {
data: '{data}', data: '{data}',
@ -562,11 +565,16 @@ function submitReasoningDialog(val: any) {
const publish = (formEl: FormInstance | undefined) => { const publish = (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
formEl.validate().then(() => { formEl.validate().then(() => {
return ApplicationAPI.putApplication(id, applicationForm.value, loading) return loadSharedApi({ type: 'application', systemType: apiType.value })
.then((ok) => { .putApplication(id, applicationForm.value, loading)
return ApplicationAPI.publish(id, {}, loading) .then(() => {
return loadSharedApi({ type: 'application', systemType: apiType.value }).publish(
id,
{},
loading,
)
}) })
.then((res) => { .then(() => {
MsgSuccess(t('views.application.tip.publishSuccess')) MsgSuccess(t('views.application.tip.publishSuccess'))
}) })
}) })
@ -575,9 +583,11 @@ const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
await formEl.validate((valid, fields) => { await formEl.validate((valid, fields) => {
if (valid) { if (valid) {
application.asyncPutApplication(id, applicationForm.value, loading).then((res) => { loadSharedApi({ type: 'application', systemType: apiType.value })
MsgSuccess(t('common.saveSuccess')) .putApplication(id, applicationForm.value, loading)
}) .then(() => {
MsgSuccess(t('common.saveSuccess'))
})
} }
}) })
} }
@ -648,29 +658,43 @@ function openKnowledgeDialog() {
} }
function getDetail() { function getDetail() {
application.asyncGetApplicationDetail(id, loading).then((res: any) => { loadSharedApi({ type: 'application', systemType: apiType.value })
applicationForm.value = res.data .getApplicationDetail(id, loading)
applicationForm.value.model_id = res.data.model .then((res: any) => {
applicationForm.value.stt_model_id = res.data.stt_model applicationForm.value = res.data
applicationForm.value.tts_model_id = res.data.tts_model applicationForm.value.model_id = res.data.model
applicationForm.value.tts_type = res.data.tts_type applicationForm.value.stt_model_id = res.data.stt_model
knowledgeList.value = res.data.knowledge_list applicationForm.value.tts_model_id = res.data.tts_model
applicationForm.value.model_setting.no_references_prompt = applicationForm.value.tts_type = res.data.tts_type
res.data.model_setting.no_references_prompt || '{question}' 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')) { if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
ApplicationAPI.getApplicationSetting(id).then((ok) => { loadSharedApi({ type: 'application', systemType: apiType.value })
applicationForm.value = { ...applicationForm.value, ...ok.data } .getApplicationSetting(id)
}) .then((ok: any) => {
} applicationForm.value = { ...applicationForm.value, ...ok.data }
}) })
}
})
} }
function getSelectModel() { function getSelectModel() {
loading.value = true 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) => { .then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider') modelOptions.value = groupBy(res?.data, 'provider')
loading.value = false loading.value = false
@ -682,8 +706,17 @@ function getSelectModel() {
function getSTTModel() { function getSTTModel() {
loading.value = true loading.value = true
model const obj =
.asyncGetSelectModel({ model_type: 'STT' }) 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) => { .then((res: any) => {
sttModelOptions.value = groupBy(res?.data, 'provider') sttModelOptions.value = groupBy(res?.data, 'provider')
loading.value = false loading.value = false
@ -695,8 +728,17 @@ function getSTTModel() {
function getTTSModel() { function getTTSModel() {
loading.value = true loading.value = true
model const obj =
.asyncGetSelectModel({ model_type: 'TTS' }) 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) => { .then((res: any) => {
ttsModelOptions.value = groupBy(res?.data, 'provider') ttsModelOptions.value = groupBy(res?.data, 'provider')
loading.value = false loading.value = false

View File

@ -24,7 +24,10 @@
<el-button @click.prevent="dialogVisible = false"> <el-button @click.prevent="dialogVisible = false">
{{ $t('common.cancel') }} {{ $t('common.cancel') }}
</el-button> </el-button>
<el-button type="primary" @click="submit" :loading="loading" <el-button
type="primary"
@click="submit"
:loading="loading"
v-if="permissionPrecise.paramSetting(modelID)" v-if="permissionPrecise.paramSetting(modelID)"
> >
{{ $t('common.confirm') }} {{ $t('common.confirm') }}
@ -37,11 +40,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import type { FormField } from '@/components/dynamics-form/type' import type { FormField } from '@/components/dynamics-form/type'
import modelAPi from '@/api/model/model' import { useRoute } from 'vue-router'
import applicationApi from '@/api/application/application'
import DynamicsForm from '@/components/dynamics-form/index.vue' import DynamicsForm from '@/components/dynamics-form/index.vue'
import permissionMap from '@/permission' 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 model_form_field = ref<Array<FormField>>([])
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>() const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
@ -49,20 +60,23 @@ const form_data = ref<any>({})
const dialogVisible = ref(false) const dialogVisible = ref(false)
const loading = ref(false) const loading = ref(false)
const getApi = (model_id: string, application_id?: string) => { 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 modelID = ref('')
const permissionPrecise = computed(() => { const permissionPrecise = computed(() => {
return permissionMap['model']['workspace'] return permissionMap['model'][apiType.value]
}) })
const open = (model_id: string, application_id?: string, model_setting_data?: any) => { const open = (model_id: string, application_id?: string, model_setting_data?: any) => {
modelID.value = model_id modelID.value = model_id
form_data.value = {} form_data.value = {}
const api = getApi(model_id, application_id) const api = getApi(model_id, application_id)
api.then((ok) => { api.then((ok: any) => {
model_form_field.value = ok.data model_form_field.value = ok.data
// //
dynamicsFormRef.value?.render(model_form_field.value, model_setting_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 reset_default = (model_id: string, application_id?: string) => {
const api = getApi(model_id, application_id) const api = getApi(model_id, application_id)
api.then((ok) => { api.then((ok: any) => {
model_form_field.value = ok.data model_form_field.value = ok.data
const model_setting_data = ok.data const model_setting_data = ok.data
.map((item) => { .map((item: any) => {
if (item.show_default_value === false) { if (item.show_default_value === false) {
return { [item.field]: undefined } return { [item.field]: undefined }
} else { } else {
return { [item.field]: item.default_value } return { [item.field]: item.default_value }
} }
}) })
.reduce((x, y) => ({ ...x, ...y }), {}) .reduce((x: any, y: any) => ({ ...x, ...y }), {})
emit('refresh', model_setting_data) emit('refresh', model_setting_data)
}) })

View File

@ -101,24 +101,31 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive, computed } from 'vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import applicationApi from '@/api/application/application'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { MsgError, MsgSuccess } from '@/utils/message' import { MsgError, MsgSuccess } from '@/utils/message'
import { copyClick } from '@/utils/clipboard' import { copyClick } from '@/utils/clipboard'
import { t } from '@/locales' import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
type PlatformType = 'wechat' | 'dingtalk' | 'wecom' | 'lark' | 'slack' 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 formRef = ref<FormInstance>()
const visible = ref(false) const visible = ref(false)
const loading = ref(false) const loading = ref(false)
const dataLoaded = ref(false) const dataLoaded = ref(false)
const configType = ref<PlatformType>('wechat') const configType = ref<PlatformType>('wechat')
const route = useRoute()
const emit = defineEmits(['refresh'])
const {
params: { id }
} = route as any
const form = reactive<any>({ const form = reactive<any>({
wechat: { wechat: {
@ -127,7 +134,7 @@ const form = reactive<any>({
token: '', token: '',
encoding_aes_key: '', encoding_aes_key: '',
is_certification: false, is_certification: false,
callback_url: '' callback_url: '',
}, },
dingtalk: { client_id: '', client_secret: '', callback_url: '' }, dingtalk: { client_id: '', client_secret: '', callback_url: '' },
wecom: { wecom: {
@ -136,10 +143,10 @@ const form = reactive<any>({
secret: '', secret: '',
token: '', token: '',
encoding_aes_key: '', encoding_aes_key: '',
callback_url: '' callback_url: '',
}, },
lark: { app_id: '', app_secret: '', verification_token: '', 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 }>({ const rules = reactive<{ [propName: string]: any }>({
@ -148,164 +155,164 @@ const rules = reactive<{ [propName: string]: any }>({
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wechatSetting.appIdPlaceholder'), message: t('views.application.applicationAccess.wechatSetting.appIdPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
app_secret: [ app_secret: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wechatSetting.appSecretPlaceholder'), message: t('views.application.applicationAccess.wechatSetting.appSecretPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
token: [ token: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wechatSetting.tokenPlaceholder'), message: t('views.application.applicationAccess.wechatSetting.tokenPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
encoding_aes_key: [ encoding_aes_key: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wechatSetting.aesKeyPlaceholder'), message: t('views.application.applicationAccess.wechatSetting.aesKeyPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
] ],
}, },
dingtalk: { dingtalk: {
client_id: [ client_id: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.dingtalkSetting.clientIdPlaceholder'), message: t('views.application.applicationAccess.dingtalkSetting.clientIdPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
client_secret: [ client_secret: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.dingtalkSetting.clientSecretPlaceholder'), message: t('views.application.applicationAccess.dingtalkSetting.clientSecretPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
] ],
}, },
wecom: { wecom: {
app_id: [ app_id: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wecomSetting.cropIdPlaceholder'), message: t('views.application.applicationAccess.wecomSetting.cropIdPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
agent_id: [ agent_id: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wecomSetting.agentIdPlaceholder'), message: t('views.application.applicationAccess.wecomSetting.agentIdPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
secret: [ secret: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wecomSetting.secretPlaceholder'), message: t('views.application.applicationAccess.wecomSetting.secretPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
token: [ token: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wecomSetting.tokenPlaceholder'), message: t('views.application.applicationAccess.wecomSetting.tokenPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
encoding_aes_key: [ encoding_aes_key: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.wecomSetting.encodingAesKeyPlaceholder'), message: t('views.application.applicationAccess.wecomSetting.encodingAesKeyPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
] ],
}, },
lark: { lark: {
app_id: [ app_id: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.larkSetting.appIdPlaceholder'), message: t('views.application.applicationAccess.larkSetting.appIdPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
app_secret: [ app_secret: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.larkSetting.appSecretPlaceholder'), message: t('views.application.applicationAccess.larkSetting.appSecretPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
verification_token: [ verification_token: [
{ {
required: false, required: false,
message: t('views.application.applicationAccess.larkSetting.verificationTokenPlaceholder'), message: t('views.application.applicationAccess.larkSetting.verificationTokenPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
] ],
}, },
slack: { slack: {
signing_secret: [ signing_secret: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.slackSetting.signingSecretPlaceholder'), message: t('views.application.applicationAccess.slackSetting.signingSecretPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
], ],
bot_user_token: [ bot_user_token: [
{ {
required: true, required: true,
message: t('views.application.applicationAccess.slackSetting.botUserTokenPlaceholder'), message: t('views.application.applicationAccess.slackSetting.botUserTokenPlaceholder'),
trigger: 'blur' trigger: 'blur',
} },
] ],
} },
}) })
const configFields: { [propName: string]: { [propName: string]: any } } = { const configFields: { [propName: string]: { [propName: string]: any } } = {
wechat: { wechat: {
app_id: { app_id: {
label: t('views.application.applicationAccess.wechatSetting.appId'), label: t('views.application.applicationAccess.wechatSetting.appId'),
placeholder: '' placeholder: '',
}, },
app_secret: { app_secret: {
label: t('views.application.applicationAccess.wechatSetting.appSecret'), label: t('views.application.applicationAccess.wechatSetting.appSecret'),
placeholder: '' placeholder: '',
}, },
token: { label: t('views.application.applicationAccess.wechatSetting.token'), placeholder: '' }, token: { label: t('views.application.applicationAccess.wechatSetting.token'), placeholder: '' },
encoding_aes_key: { encoding_aes_key: {
label: t('views.application.applicationAccess.wechatSetting.aesKey'), label: t('views.application.applicationAccess.wechatSetting.aesKey'),
placeholder: '' placeholder: '',
} },
}, },
dingtalk: { dingtalk: {
client_id: { label: 'Client ID', placeholder: '' }, client_id: { label: 'Client ID', placeholder: '' },
client_secret: { label: 'Client Secret', placeholder: '' } client_secret: { label: 'Client Secret', placeholder: '' },
}, },
wecom: { wecom: {
app_id: { app_id: {
label: t('views.application.applicationAccess.wecomSetting.cropId'), label: t('views.application.applicationAccess.wecomSetting.cropId'),
placeholder: '' placeholder: '',
}, },
agent_id: { label: 'Agent ID', placeholder: '' }, agent_id: { label: 'Agent ID', placeholder: '' },
secret: { label: 'Secret', placeholder: '' }, secret: { label: 'Secret', placeholder: '' },
token: { label: 'Token', placeholder: '' }, token: { label: 'Token', placeholder: '' },
encoding_aes_key: { label: 'EncodingAESKey', placeholder: '' } encoding_aes_key: { label: 'EncodingAESKey', placeholder: '' },
}, },
lark: { lark: {
app_id: { label: 'App ID', placeholder: '' }, app_id: { label: 'App ID', placeholder: '' },
app_secret: { label: 'App Secret', placeholder: '' }, app_secret: { label: 'App Secret', placeholder: '' },
verification_token: { label: 'Verification Token', placeholder: '' } verification_token: { label: 'Verification Token', placeholder: '' },
}, },
slack: { slack: {
signing_secret: { label: 'Signing Secret', placeholder: '' }, 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([ const passwordFields = new Set([
@ -313,7 +320,7 @@ const passwordFields = new Set([
'client_secret', 'client_secret',
'secret', 'secret',
'bot_user_token', 'bot_user_token',
'signing_secret' 'signing_secret',
]) ])
const drawerTitle = computed( const drawerTitle = computed(
@ -323,8 +330,8 @@ const drawerTitle = computed(
dingtalk: t('views.application.applicationAccess.dingtalkSetting.title'), dingtalk: t('views.application.applicationAccess.dingtalkSetting.title'),
wecom: t('views.application.applicationAccess.wecomSetting.title'), wecom: t('views.application.applicationAccess.wecomSetting.title'),
lark: t('views.application.applicationAccess.larkSetting.title'), lark: t('views.application.applicationAccess.larkSetting.title'),
slack: t('views.application.applicationAccess.slackSetting.title') slack: t('views.application.applicationAccess.slackSetting.title'),
}[configType.value]) })[configType.value],
) )
const infoTitle = computed( const infoTitle = computed(
@ -334,8 +341,8 @@ const infoTitle = computed(
dingtalk: t('views.applicationOverview.appInfo.header'), dingtalk: t('views.applicationOverview.appInfo.header'),
wecom: t('views.applicationOverview.appInfo.header'), wecom: t('views.applicationOverview.appInfo.header'),
lark: t('views.applicationOverview.appInfo.header'), lark: t('views.applicationOverview.appInfo.header'),
slack: t('views.applicationOverview.appInfo.header') slack: t('views.applicationOverview.appInfo.header'),
}[configType.value]) })[configType.value],
) )
const passwordVisible = reactive<Record<string, boolean>>( const passwordVisible = reactive<Record<string, boolean>>(
@ -346,8 +353,8 @@ const passwordVisible = reactive<Record<string, boolean>>(
} }
return acc return acc
}, },
{} as Record<string, boolean> {} as Record<string, boolean>,
) ),
) )
const isPasswordField = (key: any) => passwordFields.has(key) const isPasswordField = (key: any) => passwordFields.has(key)
@ -362,7 +369,7 @@ const submit = async () => {
formRef.value?.validate(async (valid) => { formRef.value?.validate(async (valid) => {
if (valid) { if (valid) {
try { try {
applicationApi loadSharedApi({ type: 'application', systemType: apiType.value })
.updatePlatformConfig(id, configType.value, form[configType.value], loading) .updatePlatformConfig(id, configType.value, form[configType.value], loading)
.then(() => { .then(() => {
MsgSuccess(t('common.saveSuccess')) MsgSuccess(t('common.saveSuccess'))
@ -383,7 +390,10 @@ const open = async (id: string, type: PlatformType) => {
dataLoaded.value = false dataLoaded.value = false
formRef.value?.resetFields() formRef.value?.resetFields()
try { try {
const res = await applicationApi.getPlatformConfig(id, type) const res = await loadSharedApi({
type: 'application',
systemType: apiType.value,
}).getPlatformConfig(id, type)
if (res.data) { if (res.data) {
form[configType.value] = res.data form[configType.value] = res.data
} }
@ -392,7 +402,8 @@ const open = async (id: string, type: PlatformType) => {
MsgError(t('views.application.tip.loadingErrorMessage')) MsgError(t('views.application.tip.loadingErrorMessage'))
} finally { } finally {
loading.value = false 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}`
} }
} }

View File

@ -56,7 +56,6 @@ import { MsgSuccess, MsgAlert } from '@/utils/message'
import { isWorkFlow } from '@/utils/application' import { isWorkFlow } from '@/utils/application'
import { t } from '@/locales' import { t } from '@/locales'
import useStore from '@/stores' import useStore from '@/stores'
import { ValidType, ValidCount } from '@/enums/common'
const router = useRouter() const router = useRouter()
const { common, user } = useStore() const { common, user } = useStore()

View File

@ -41,18 +41,23 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref, computed } from 'vue'
import type { FormField } from '@/components/dynamics-form/type' 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 DynamicsForm from '@/components/dynamics-form/index.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { MsgError } from '@/utils/message' import { MsgError } from '@/utils/message'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const tts_model_id = ref('') const tts_model_id = ref('')
const model_form_field = ref<Array<FormField>>([]) const model_form_field = ref<Array<FormField>>([])
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
@ -65,39 +70,43 @@ const playLoading = ref(false)
const open = (model_id: string, application_id?: string, model_setting_data?: any) => { const open = (model_id: string, application_id?: string, model_setting_data?: any) => {
form_data.value = {} form_data.value = {}
tts_model_id.value = model_id tts_model_id.value = model_id
ModelAPI.getModelParamsForm(model_id, loading).then((ok) => { loadSharedApi({ type: 'model', systemType: apiType.value })
model_form_field.value = ok.data .getModelParamsForm(model_id, loading)
const resp = ok.data .then((ok: any) => {
.map((item: any) => ({ model_form_field.value = ok.data
[item.field]: item.show_default_value !== false ? item.default_value : undefined, const resp = ok.data
})) .map((item: any) => ({
.reduce((x, y) => ({ ...x, ...y }), {}) [item.field]: item.show_default_value !== false ? item.default_value : undefined,
// }))
if (model_setting_data) { .reduce((x: any, y: any) => ({ ...x, ...y }), {})
Object.keys(model_setting_data).forEach((key) => { //
if (!(key in resp)) { if (model_setting_data) {
delete model_setting_data[key] 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) model_setting_data = { ...resp, ...model_setting_data }
}) //
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
})
dialogVisible.value = true dialogVisible.value = true
} }
const reset_default = (model_id: string, application_id?: string) => { const reset_default = (model_id: string, application_id?: string) => {
ModelAPI.getModelParamsForm(model_id, loading).then((ok) => { loadSharedApi({ type: 'model', systemType: apiType.value })
model_form_field.value = ok.data .getModelParamsForm(model_id, loading)
const model_setting_data = ok.data .then((ok: any) => {
.map((item) => ({ model_form_field.value = ok.data
[item.field]: item.show_default_value !== false ? item.default_value : undefined, const model_setting_data = ok.data
})) .map((item: any) => ({
.reduce((x, y) => ({ ...x, ...y }), {}) [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 () => { const submit = async () => {
@ -113,7 +122,7 @@ const testPlay = () => {
...form_data.value, ...form_data.value,
tts_model_id: tts_model_id.value, tts_model_id: tts_model_id.value,
} }
applicationApi loadSharedApi({ type: 'application', systemType: apiType.value })
.playDemoText(id as string, data, playLoading) .playDemoText(id as string, data, playLoading)
.then(async (res: any) => { .then(async (res: any) => {
if (res.type === 'application/json') { if (res.type === 'application/json') {
@ -135,7 +144,7 @@ const testPlay = () => {
console.error('audioPlayer.value is not an instance of HTMLAudioElement') console.error('audioPlayer.value is not an instance of HTMLAudioElement')
} }
}) })
.catch((err) => { .catch((err: any) => {
console.log('err: ', err) console.log('err: ', err)
}) })
} }

View File

@ -228,7 +228,7 @@
</el-button> </el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click.stop="getAccessToken(item.id)"> <el-dropdown-item @click.stop="toChat(item)">
<AppIcon iconName="app-create-chat"></AppIcon> <AppIcon iconName="app-create-chat"></AppIcon>
{{ $t('views.application.operation.toChat') }} {{ $t('views.application.operation.toChat') }}
</el-dropdown-item> </el-dropdown-item>
@ -386,7 +386,7 @@ const get_route = (item: any) => {
'OR', 'OR',
) )
) { ) {
return `/application/${item.id}/${item.type}/overview` return `/application/workspace/${item.id}/${item.type}/overview`
} else if ( } else if (
hasPermission( hasPermission(
[ [
@ -404,9 +404,9 @@ const get_route = (item: any) => {
) )
) { ) {
if (item.type == 'WORK_FLOW') { if (item.type == 'WORK_FLOW') {
return `/application/${item.id}/workflow` return `/application/workspace/${item.id}/workflow`
} else { } else {
return `/application/${item.id}/${item.type}/setting` return `/application/workspace/${item.id}/${item.type}/setting`
} }
} else if ( } else if (
hasPermission( hasPermission(
@ -437,7 +437,7 @@ const get_route = (item: any) => {
'OR', 'OR',
) )
) { ) {
return `/application/${item.id}/${item.type}/access` return `/application/workspace/${item.id}/${item.type}/access`
} else if ( } else if (
hasPermission( hasPermission(
[ [
@ -467,7 +467,7 @@ const get_route = (item: any) => {
'OR', 'OR',
) )
) { ) {
return `/application/${item.id}/${item.type}/chat-user` return `/application/workspace/${item.id}/${item.type}/chat-user`
} else if ( } else if (
hasPermission( hasPermission(
[ [
@ -485,7 +485,7 @@ const get_route = (item: any) => {
'OR', 'OR',
) )
) { ) {
return `/application/${item.id}/${item.type}/chat-log` return `/application//workspace${item.id}/${item.type}/chat-log`
} else return `/application/` } else return `/application/`
} }
@ -499,10 +499,11 @@ const search_type_change = () => {
search_form.value = { name: '', create_user: '' } search_form.value = { name: '', create_user: '' }
} }
function getAccessToken(id: string) { const apiInputParams = ref([])
applicationList.value
.filter((app) => app.id === id)[0] function toChat(row: any) {
?.work_flow?.nodes?.filter((v: any) => v.id === 'base-node') row?.work_flow?.nodes
?.filter((v: any) => v.id === 'base-node')
.map((v: any) => { .map((v: any) => {
apiInputParams.value = v.properties.api_input_field_list apiInputParams.value = v.properties.api_input_field_list
? v.properties.api_input_field_list.map((v: any) => { ? v.properties.api_input_field_list.map((v: any) => {
@ -525,15 +526,23 @@ function getAccessToken(id: string) {
const apiParams = mapToUrlParams(apiInputParams.value) const apiParams = mapToUrlParams(apiInputParams.value)
? '?' + 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) 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) { function copyApplication(row: any) {
application.asyncGetApplicationDetail(row.id, loading).then((res: any) => { ApplicationApi.getApplicationDetail(row.id, loading).then((res: any) => {
if (res?.data) { if (res?.data) {
CopyApplicationDialogRef.value.open( CopyApplicationDialogRef.value.open(
{ ...res.data, model_id: res.data.model }, { ...res.data, model_id: res.data.model },
@ -545,22 +554,12 @@ function copyApplication(row: any) {
function settingApplication(row: any) { function settingApplication(row: any) {
if (isWorkFlow(row.type)) { if (isWorkFlow(row.type)) {
router.push({ path: `/application/${row.id}/workflow` }) router.push({ path: `/application/workspace/${row.id}/workflow` })
} else { } 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) { function deleteApplication(row: any) {
MsgConfirm( MsgConfirm(
// @ts-ignore // @ts-ignore

View File

@ -31,12 +31,11 @@
</template> </template>
<script setup lang="ts"> <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 { useRoute } from 'vue-router'
import { type ApplicationFormType, type chatType } from '@/api/type/application' 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 AiChatRef = ref()
const { chatLog } = useStore()
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
/** /**
@ -70,6 +69,14 @@ const route = useRoute()
const { const {
params: { id }, params: { id },
} = route } = route
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const loading = ref(false) const loading = ref(false)
const visible = ref(false) const visible = ref(false)
const recordList = ref<chatType[]>([]) const recordList = ref<chatType[]>([])
@ -87,8 +94,8 @@ function closeHandle() {
} }
function getChatRecord() { function getChatRecord() {
return chatLog return loadSharedApi({ type: 'chatLog', systemType: apiType.value })
.asyncChatRecordLog(id as string, props.chatId, paginationConfig, loading) .getChatRecordLog(id as string, props.chatId, paginationConfig, loading)
.then((res: any) => { .then((res: any) => {
paginationConfig.total = res.data.total paginationConfig.total = res.data.total
const list = res.data.records const list = res.data.records

View File

@ -71,20 +71,23 @@ import { ref, watch, reactive, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue' import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import chatLogApi from '@/api/application/chat-log'
import imageApi from '@/api/image' import imageApi from '@/api/image'
import { t } from '@/locales' import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
const apiType = computed<'workspace'>(() => {
return 'workspace'
})
const formRef = ref() const formRef = ref()
const toolbars = [ const toolbars = [
@ -197,7 +200,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
content: form.value.content, content: form.value.content,
problem_text: form.value.problem_text, problem_text: form.value.problem_text,
} }
chatLogApi loadSharedApi({ type: 'chatLog', systemType: apiType.value })
.putChatRecordLog( .putChatRecordLog(
id, id,
form.value.chat_id, form.value.chat_id,

View File

@ -13,15 +13,15 @@
<div class="text-right"> <div class="text-right">
<el-button text @click="isEdit = true" v-if="!isEdit"> <el-button text @click="isEdit = true" v-if="!isEdit">
<el-icon> <el-icon>
<EditPen/> <EditPen />
</el-icon> </el-icon>
</el-button> </el-button>
<el-button text style="margin-left: 4px" @click="deleteMark"> <el-button text style="margin-left: 4px" @click="deleteMark">
<el-icon> <el-icon>
<Delete/> <Delete />
</el-icon> </el-icon>
</el-button> </el-button>
<el-divider direction="vertical"/> <el-divider direction="vertical" />
</div> </div>
</div> </div>
</template> </template>
@ -64,18 +64,24 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref, watch, reactive} from 'vue' import { ref, watch, reactive, computed } from 'vue'
import {useRoute} from 'vue-router' import { useRoute } from 'vue-router'
import type {FormInstance, FormRules} from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import chatLogApi from '@/api/application/chat-log' import { t } from '@/locales'
import paragraphApi from '@/api/knowledge/paragraph' import { MsgSuccess, MsgConfirm } from '@/utils/message'
import {t} from '@/locales'
import {MsgSuccess, MsgConfirm} from '@/utils/message'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: {id}, params: { id },
} = route as any } = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const emit = defineEmits(['refresh']) const emit = defineEmits(['refresh'])
@ -90,7 +96,7 @@ const detail = ref<any>({})
const rules = reactive<FormRules>({ const rules = reactive<FormRules>({
content: [ 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() { function deleteMark() {
chatLogApi loadSharedApi({ type: 'chatLog', systemType: apiType.value })
.delMarkChatRecord( .delMarkChatRecord(
id as string, id as string,
detail.value.chat_id, detail.value.chat_id,
@ -120,7 +126,7 @@ function deleteMark() {
} }
function getMark(data: any) { function getMark(data: any) {
chatLogApi loadSharedApi({ type: 'chatLog', systemType: apiType.value })
.getMarkChatRecord(id as string, data.chat_id, data.id, loading) .getMarkChatRecord(id as string, data.chat_id, data.id, loading)
.then((res: any) => { .then((res: any) => {
if (res.data.length > 0) { if (res.data.length > 0) {
@ -138,7 +144,7 @@ const submit = async (formEl: FormInstance) => {
if (!formEl) return if (!formEl) return
await formEl.validate((valid, fields) => { await formEl.validate((valid, fields) => {
if (valid) { if (valid) {
paragraphApi loadSharedApi({ type: 'paragraph', systemType: apiType.value })
.putParagraph( .putParagraph(
form.value.knowledge, form.value.knowledge,
form.value.document, form.value.document,
@ -148,14 +154,14 @@ const submit = async (formEl: FormInstance) => {
}, },
loading, loading,
) )
.then((res) => { .then(() => {
dialogVisible.value = false dialogVisible.value = false
}) })
} }
}) })
} }
defineExpose({open}) defineExpose({ open })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.edit-mark-dialog { .edit-mark-dialog {

View File

@ -230,24 +230,25 @@ import { cloneDeep } from 'lodash'
import ChatRecordDrawer from './component/ChatRecordDrawer.vue' import ChatRecordDrawer from './component/ChatRecordDrawer.vue'
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue' import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
import { MsgSuccess, MsgConfirm } from '@/utils/message' import { MsgSuccess, MsgConfirm } from '@/utils/message'
import chatLogApi from '@/api/application/chat-log'
import { beforeDay, datetimeFormat, nowDate } from '@/utils/time' import { beforeDay, datetimeFormat, nowDate } from '@/utils/time'
import useStore from '@/stores'
import type { Dict } from '@/api/type/common' import type { Dict } from '@/api/type/common'
import { t } from '@/locales' import { t } from '@/locales'
import { ElTable } from 'element-plus' import { ElTable } from 'element-plus'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const apiType = computed<'workspace'>(() => { const apiType = computed(() => {
return 'workspace' if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
}) })
const permissionPrecise = computed(() => { const permissionPrecise = computed(() => {
return permissionMap['application'][apiType.value] return permissionMap['application'][apiType.value]
}) })
const { application, chatLog, user } = useStore()
const { const {
params: { id }, params: { id },
} = route as any } = route as any
@ -326,8 +327,6 @@ const filter = ref<any>({
comparer: 'and', comparer: 'and',
}) })
const documentList = ref<any[]>([])
function filterChange(val: string) { function filterChange(val: string) {
if (val === 'clear') { if (val === 'clear') {
filter.value = cloneDeep(defaultFilter) filter.value = cloneDeep(defaultFilter)
@ -420,18 +419,20 @@ function getList() {
if (search.value) { if (search.value) {
obj = { ...obj, abstract: search.value } obj = { ...obj, abstract: search.value }
} }
return chatLog.asyncGetChatLog(id as string, paginationConfig, obj, loading).then((res: any) => { return loadSharedApi({ type: 'chatLog', systemType: apiType.value })
tableData.value = res.data.records .getChatLog(id as string, paginationConfig, obj, loading)
if (currentChatId.value) { .then((res: any) => {
currentChatId.value = tableData.value[0]?.id tableData.value = res.data.records
} if (currentChatId.value) {
paginationConfig.total = res.data.total currentChatId.value = tableData.value[0]?.id
}) }
paginationConfig.total = res.data.total
})
} }
function getDetail(isLoading = false) { function getDetail(isLoading = false) {
application loadSharedApi({ type: 'application', systemType: apiType.value })
.asyncGetApplicationDetail(id as string, isLoading ? loading : undefined) .getApplicationDetail(id as string, isLoading ? loading : undefined)
.then((res: any) => { .then((res: any) => {
detail.value = res.data detail.value = res.data
days.value = res.data.clean_time days.value = res.data.clean_time
@ -455,7 +456,7 @@ const exportLog = () => {
obj = { ...obj, abstract: search.value } obj = { ...obj, abstract: search.value }
} }
chatLogApi.postExportChatLog( loadSharedApi({ type: 'chatLog', systemType: apiType.value }).postExportChatLog(
detail.value.id, detail.value.id,
detail.value.name, detail.value.name,
obj, obj,
@ -487,8 +488,8 @@ function saveCleanTime() {
const obj = { const obj = {
clean_time: days.value, clean_time: days.value,
} }
application loadSharedApi({ type: 'application', systemType: apiType.value })
.asyncPutApplication(id as string, obj, loading) .putApplication(id as string, obj, loading)
.then(() => { .then(() => {
MsgSuccess(t('common.saveSuccess')) MsgSuccess(t('common.saveSuccess'))
dialogVisible.value = false dialogVisible.value = false
@ -512,10 +513,12 @@ const submitForm = async () => {
...SelectKnowledgeDocumentRef.value.form, ...SelectKnowledgeDocumentRef.value.form,
chat_ids: arr, chat_ids: arr,
} }
chatLogApi.postChatLogAddKnowledge(id, obj, documentLoading).then((res: any) => { loadSharedApi({ type: 'chatLog', systemType: apiType.value })
multipleTableRef.value?.clearSelection() .postChatLogAddKnowledge(id, obj, documentLoading)
documentDialogVisible.value = false .then((res: any) => {
}) multipleTableRef.value?.clearSelection()
documentDialogVisible.value = false
})
} }
} }

View File

@ -938,7 +938,7 @@ function rowClickHandle(row: any, column: any) {
router.push({ router.push({
path: `/paragraph/${id}/${row.id}`, path: `/paragraph/${id}/${row.id}`,
query: { type: apiType.value, isShared: isShared.value ? 'true' : 'false' }, query: { from: apiType.value, isShared: isShared.value ? 'true' : 'false' },
}) })
} }

View File

@ -184,7 +184,6 @@ import { useRoute } from 'vue-router'
import BaseForm from '@/views/knowledge/component/BaseForm.vue' import BaseForm from '@/views/knowledge/component/BaseForm.vue'
import { MsgSuccess, MsgConfirm } from '@/utils/message' import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { t } from '@/locales' import { t } from '@/locales'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api' import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
@ -192,13 +191,12 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id, folderId }, params: { id, folderId },
query: { type },
} = route as any } = route as any
const apiType = computed(() => { const apiType = computed(() => {
if (route.path.includes('shared')) { if (route.path.includes('shared')) {
return 'systemShare' return 'systemShare'
} else if (route.path.includes('resource-management') || type === 'systemManage') { } else if (route.path.includes('resource-management')) {
return 'systemManage' return 'systemManage'
} else { } else {
return 'workspace' return 'workspace'

View File

@ -47,7 +47,7 @@ import { groupBy } from 'lodash'
import type { knowledgeData } from '@/api/type/knowledge' import type { knowledgeData } from '@/api/type/knowledge'
import { t } from '@/locales' import { t } from '@/locales'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api' import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import modelResourceApi from '@/api/system-resource-management/model'
const props = defineProps<{ const props = defineProps<{
data?: { data?: {
type: Object type: Object
@ -98,7 +98,6 @@ watch(
form.value.desc = value.desc form.value.desc = value.desc
form.value.embedding_model_id = value.embedding_model_id form.value.embedding_model_id = value.embedding_model_id
workspace_id.value = value.workspace_id || '' workspace_id.value = value.workspace_id || ''
// //
getSelectModel() getSelectModel()
} }
@ -120,8 +119,17 @@ function validate() {
function getSelectModel() { function getSelectModel() {
loading.value = true 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 }) loadSharedApi({ type: 'model', systemType: props.apiType })
.getSelectModelList({ model_type: 'EMBEDDING', workspace_id: workspace_id.value }) .getSelectModelList(obj)
.then((res: any) => { .then((res: any) => {
modelOptions.value = groupBy(res?.data, 'provider') modelOptions.value = groupBy(res?.data, 'provider')
loading.value = false loading.value = false
@ -132,7 +140,9 @@ function getSelectModel() {
} }
onMounted(() => { onMounted(() => {
getSelectModel() if (props.apiType !== 'systemManage') {
getSelectModel()
}
}) })
onUnmounted(() => { onUnmounted(() => {

View File

@ -43,12 +43,12 @@ import { t } from '@/locales'
const route = useRoute() const route = useRoute()
const { const {
query: { type }, query: { from },
} = route } = route
const apiType = computed(() => { const apiType = computed(() => {
if (route.path.includes('shared')) { if (route.path.includes('shared')) {
return 'systemShare' return 'systemShare'
} else if (route.path.includes('resource-management') || type === 'systemManage') { } else if (route.path.includes('resource-management') || from === 'systemManage') {
return 'systemManage' return 'systemManage'
} else { } else {
return 'workspace' return 'workspace'

View File

@ -170,7 +170,7 @@ const submitHandle = async () => {
router.push({ router.push({
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`, path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`,
query: { query: {
type: apiType.value, from: apiType.value,
}, },
}) })
emit('refresh') emit('refresh')

View File

@ -124,7 +124,7 @@ const submitHandle = async () => {
router.push({ router.push({
path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`, path: `/knowledge/${res.data.id}/${currentFolder.value.id || 'shared'}/document`,
query: { query: {
type: apiType.value, from: apiType.value,
}, },
}) })
emit('refresh') emit('refresh')

View File

@ -146,11 +146,11 @@ const props = defineProps<{
const route = useRoute() const route = useRoute()
const { const {
params: { id, documentId }, params: { id, documentId },
query: { type }, query: { from },
} = route as any } = route as any
const apiType = computed(() => { const apiType = computed(() => {
return type as 'systemShare' | 'workspace' | 'systemManage' return from as 'systemShare' | 'workspace' | 'systemManage'
}) })
const permissionPrecise = computed (() => { const permissionPrecise = computed (() => {
@ -158,8 +158,8 @@ const permissionPrecise = computed (() => {
}) })
const MoreFieldPermission = (id:any) => { const MoreFieldPermission = (id:any) => {
return permissionPrecise.value.doc_generate(id) || return permissionPrecise.value.doc_generate(id) ||
permissionPrecise.value.doc_edit(id) permissionPrecise.value.doc_edit(id)
} }
const emit = defineEmits(['dialogVisibleChange','clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move']) const emit = defineEmits(['dialogVisibleChange','clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move'])

View File

@ -12,7 +12,7 @@
> >
</el-text> </el-text>
</div> </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"> <el-button @click="batchSelectedHandle(true)" v-if="isBatch === false">
{{ $t('views.paragraph.setting.batchSelected') }} {{ $t('views.paragraph.setting.batchSelected') }}
</el-button> </el-button>
@ -85,7 +85,12 @@
<VueDraggable <VueDraggable
ref="el" ref="el"
v-model="paragraphDetail" v-model="paragraphDetail"
:disabled="isBatch === true || shareDisabled || dialogVisible || !permissionPrecise.doc_edit(id)" :disabled="
isBatch === true ||
shareDisabled ||
dialogVisible ||
!permissionPrecise.doc_edit(id)
"
handle=".handle" handle=".handle"
:animation="150" :animation="150"
ghostClass="ghost" ghostClass="ghost"
@ -96,7 +101,12 @@
<!-- 批量操作 --> <!-- 批量操作 -->
<div class="paragraph-card flex w-full" v-if="isBatch === true"> <div class="paragraph-card flex w-full" v-if="isBatch === true">
<el-checkbox :value="item.id" /> <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>
<!-- 非批量操作 --> <!-- 非批量操作 -->
<div class="handle paragraph-card flex w-full" :id="item.id" v-else> <div class="handle paragraph-card flex w-full" :id="item.id" v-else>
@ -110,11 +120,21 @@
<ParagraphCard <ParagraphCard
:data="item" :data="item"
:showMoveUp="index !== 0" :showMoveUp="index !== 0"
:showMoveDown="index < paragraphDetail.length-1" :showMoveDown="index < paragraphDetail.length - 1"
class="mb-8 w-full" class="mb-8 w-full"
@changeState="changeState" @changeState="changeState"
@deleteParagraph="deleteParagraph" @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" @refresh="refresh"
@refreshMigrateParagraph="refreshMigrateParagraph" @refreshMigrateParagraph="refreshMigrateParagraph"
:disabled="shareDisabled" :disabled="shareDisabled"
@ -175,15 +195,15 @@ import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api' import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import permissionMap from '@/permission' import permissionMap from '@/permission'
import { t } from '@/locales' import { t } from '@/locales'
import {cloneDeep} from "lodash"; import { cloneDeep } from 'lodash'
const route = useRoute() const route = useRoute()
const { const {
params: { id, documentId }, params: { id, documentId },
query: { type, isShared }, query: { from, isShared },
} = route as any } = route as any
const apiType = computed(() => { const apiType = computed(() => {
return type as 'systemShare' | 'workspace' | 'systemManage' return from as 'systemShare' | 'workspace' | 'systemManage'
}) })
const shareDisabled = computed(() => { const shareDisabled = computed(() => {
return isShared === 'true' return isShared === 'true'
@ -192,7 +212,6 @@ const permissionPrecise = computed(() => {
return permissionMap['knowledge'][apiType.value] return permissionMap['knowledge'][apiType.value]
}) })
const SelectDocumentDialogRef = ref() const SelectDocumentDialogRef = ref()
const ParagraphDialogRef = ref() const ParagraphDialogRef = ref()
const loading = ref(false) const loading = ref(false)
@ -204,9 +223,12 @@ const search = ref('')
const searchType = ref('title') const searchType = ref('title')
const dialogVisible = ref(false) const dialogVisible = ref(false)
watch(()=>ParagraphDialogRef.value?.dialogVisible, (val: boolean) => { watch(
dialogVisible.value = val () => ParagraphDialogRef.value?.dialogVisible,
}) (val: boolean) => {
dialogVisible.value = val
},
)
function dialogVisibleChange(val: boolean) { function dialogVisibleChange(val: boolean) {
dialogVisible.value = val dialogVisible.value = val
} }
@ -353,7 +375,7 @@ function openGenerateDialog(row?: any) {
function onEnd(event?: any, params?: any, index?: number) { function onEnd(event?: any, params?: any, index?: number) {
// console.log('onEnd', event, params, index) // console.log('onEnd', event, params, index)
const p = cloneDeep(params) const p = cloneDeep(params)
if (p) { if (p) {
p.new_position = p.new_position + 1 // 1 p.new_position = p.new_position + 1 // 1
} }
@ -367,7 +389,7 @@ function onEnd(event?: any, params?: any, index?: number) {
obj, obj,
loading, loading,
) )
if(params) { if (params) {
const movedItem = paragraphDetail.value.splice(index as number, 1)[0] const movedItem = paragraphDetail.value.splice(index as number, 1)[0]
paragraphDetail.value.splice(params.new_position, 0, movedItem) paragraphDetail.value.splice(params.new_position, 0, movedItem)
} }

View File

@ -219,6 +219,66 @@
{{ datetimeFormat(row.create_time) }} {{ datetimeFormat(row.create_time) }}
</template> </template>
</el-table-column> </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> </app-table>
</el-card> </el-card>
</div> </div>
@ -226,6 +286,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, reactive, computed } from 'vue' import { onMounted, ref, reactive, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import ApplicationResourceApi from '@/api/system-resource-management/application' import ApplicationResourceApi from '@/api/system-resource-management/application'
import { t } from '@/locales' import { t } from '@/locales'
import { isAppIcon, resetUrl } from '@/utils/common' 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 { loadPermissionApi } from '@/utils/dynamics-api/permission-api.ts'
import { isWorkFlow } from '@/utils/application.ts' import { isWorkFlow } from '@/utils/application.ts'
import UserApi from '@/api/user/user.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_type = ref('name')
const search_form = ref<any>({ const search_form = ref<any>({
@ -245,13 +389,139 @@ const search_form = ref<any>({
const user_options = ref<any[]>([]) const user_options = ref<any[]>([])
const loading = ref(false) const loading = ref(false)
const changeStateloading = ref(false)
const applicationList = ref<any[]>([]) const applicationList = ref<any[]>([])
const paginationConfig = reactive({ const paginationConfig = reactive({
current_page: 1, current_page: 1,
page_size: 20, page_size: 20,
total: 0, 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 workspaceOptions = ref<any[]>([])
const workspaceVisible = ref(false) const workspaceVisible = ref(false)
const workspaceArr = ref<any[]>([]) const workspaceArr = ref<any[]>([])

View File

@ -195,7 +195,7 @@
" "
@click.stop="openParamSetting(row)" @click.stop="openParamSetting(row)"
> >
<el-icon><Delete /></el-icon> <el-icon><Setting /></el-icon>
</el-button> </el-button>
</span> </span>
</el-tooltip> </el-tooltip>

View File

@ -173,15 +173,27 @@ import { cloneDeep, set, groupBy } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue' import NodeContainer from '@/workflow/common/NodeContainer.vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import useStore from '@/stores'
import { isLastNode } from '@/workflow/common/data' import { isLastNode } from '@/workflow/common/data'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue' import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
import { t } from '@/locales' import { t } from '@/locales'
import ReasoningParamSettingDialog from '@/views/application/component/ReasoningParamSettingDialog.vue' import ReasoningParamSettingDialog from '@/views/application/component/ReasoningParamSettingDialog.vue'
import McpServersDialog from '@/views/application/component/McpServersDialog.vue' import McpServersDialog from '@/views/application/component/McpServersDialog.vue'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
const route = useRoute() 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) => { const wheel = (e: any) => {
if (e.ctrlKey === true) { if (e.ctrlKey === true) {
@ -208,9 +220,6 @@ const model_change = (model_id?: string) => {
refreshParam({}) refreshParam({})
} }
} }
const {
params: { id },
} = route as any
// @ts-ignore // @ts-ignore
const defaultPrompt = `${t('views.applicationWorkflow.nodes.aiChatNode.defaultPrompt')} const defaultPrompt = `${t('views.applicationWorkflow.nodes.aiChatNode.defaultPrompt')}
@ -269,9 +278,20 @@ const validate = () => {
} }
function getSelectModel() { function getSelectModel() {
model.asyncGetSelectModel({ model_type: 'LLM' }).then((res: any) => { const obj =
modelOptions.value = groupBy(res?.data, 'provider') 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) => { const openAIParamSettingDialog = (modelId: string) => {

View File

@ -147,8 +147,8 @@
<div class="flex align-center"> <div class="flex align-center">
<div class="mr-4"> <div class="mr-4">
<span>{{ <span>{{
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label') $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
}}</span> }}</span>
</div> </div>
<el-tooltip effect="dark" placement="right" popper-class="max-w-200"> <el-tooltip effect="dark" placement="right" popper-class="max-w-200">
<template #content> <template #content>
@ -158,7 +158,7 @@
</el-tooltip> </el-tooltip>
</div> </div>
</template> </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-item>
</el-form> </el-form>
</el-card> </el-card>
@ -166,16 +166,24 @@
</template> </template>
<script setup lang="ts"> <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 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 NodeCascader from '@/workflow/common/NodeCascader.vue'
import type {FormInstance} from 'element-plus' import type { FormInstance } from 'element-plus'
import applicationApi from '@/api/application/application' import { isWorkFlow } from '@/utils/application'
import {isWorkFlow} from '@/utils/application' import { useRoute } from 'vue-router'
import {useRoute} from 'vue-router' import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const form = { const form = {
question_reference_address: ['start-node', 'question'], question_reference_address: ['start-node', 'question'],
api_input_field_list: [], api_input_field_list: [],
@ -185,10 +193,6 @@ const form = {
audio_list: ['start-node', 'audio'], audio_list: ['start-node', 'audio'],
} }
const {
params: {id},
} = route as any
const applicationNodeFormRef = ref<FormInstance>() const applicationNodeFormRef = ref<FormInstance>()
const form_data = computed({ const form_data = computed({
@ -222,9 +226,9 @@ const update_field = () => {
set(props.nodeModel.properties, 'status', 500) set(props.nodeModel.properties, 'status', 500)
return return
} }
applicationApi loadSharedApi({ type: 'application', systemType: apiType.value })
.getApplicationDetail(props.nodeModel.properties.node_data.application_id) .getApplicationDetail(props.nodeModel.properties.node_data.application_id)
.then((ok) => { .then((ok: any) => {
const old_api_input_field_list = cloneDeep( const old_api_input_field_list = cloneDeep(
props.nodeModel.properties.node_data.api_input_field_list, 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) set(props.nodeModel.properties, 'status', ok.data.id ? 200 : 500)
} }
}) })
.catch((err) => { .catch((err: any) => {
console.log(err) console.log(err)
set(props.nodeModel.properties, 'status', 500) set(props.nodeModel.properties, 'status', 500)
}) })
@ -309,7 +313,7 @@ const props = defineProps<{ nodeModel: any }>()
const validate = () => { const validate = () => {
return applicationNodeFormRef.value?.validate().catch((err) => { return applicationNodeFormRef.value?.validate().catch((err) => {
return Promise.reject({node: props.nodeModel, errMessage: err}) return Promise.reject({ node: props.nodeModel, errMessage: err })
}) })
} }

View File

@ -178,13 +178,22 @@ import ApiInputFieldTable from './component/ApiInputFieldTable.vue'
import UserInputFieldTable from './component/UserInputFieldTable.vue' import UserInputFieldTable from './component/UserInputFieldTable.vue'
import FileUploadSettingDialog from '@/workflow/nodes/base-node/component/FileUploadSettingDialog.vue' import FileUploadSettingDialog from '@/workflow/nodes/base-node/component/FileUploadSettingDialog.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import useStore from '@/stores' import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = 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 props = defineProps<{ nodeModel: any }>()
const sttModelOptions = ref<any>(null) const sttModelOptions = ref<any>(null)
@ -253,15 +262,37 @@ const validate = () => {
} }
function getSTTModel() { function getSTTModel() {
model.asyncGetSelectModel({ model_type: 'STT' }).then((res: any) => { const obj =
sttModelOptions.value = groupBy(res?.data, 'provider') 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() { function getTTSModel() {
model.asyncGetSelectModel({ model_type: 'TTS' }).then((res: any) => { const obj =
ttsModelOptions.value = groupBy(res?.data, 'provider') 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() { function ttsModelChange() {

View File

@ -153,21 +153,28 @@
<script setup lang="ts"> <script setup lang="ts">
import NodeContainer from '@/workflow/common/NodeContainer.vue' 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 { groupBy, set } from 'lodash'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue' import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
import { t } from '@/locales' import { t } from '@/locales'
const { model } = useStore()
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const props = defineProps<{ nodeModel: any }>() const props = defineProps<{ nodeModel: any }>()
const modelOptions = ref<any>(null) const modelOptions = ref<any>(null)
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>() const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
@ -219,13 +226,24 @@ const form_data = computed({
}) })
function getSelectModel() { function getSelectModel() {
model.asyncGetSelectModel({ model_type: 'TTI' }).then((res: any) => { const obj =
modelOptions.value = groupBy(res?.data, 'provider') 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 = () => { const model_change = () => {
nextTick(()=>{ nextTick(() => {
if (form_data.value.model_id) { if (form_data.value.model_id) {
AIModeParamSettingDialogRef.value?.reset_default(form_data.value.model_id, id) AIModeParamSettingDialogRef.value?.reset_default(form_data.value.model_id, id)
} else { } else {

View File

@ -171,20 +171,27 @@
import NodeContainer from '@/workflow/common/NodeContainer.vue' import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { groupBy, set } from 'lodash' import { groupBy, set } from 'lodash'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import NodeCascader from '@/workflow/common/NodeCascader.vue' import NodeCascader from '@/workflow/common/NodeCascader.vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue' import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
import { t } from '@/locales' import { t } from '@/locales'
const { model } = useStore()
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const props = defineProps<{ nodeModel: any }>() const props = defineProps<{ nodeModel: any }>()
const modelOptions = ref<any>(null) const modelOptions = ref<any>(null)
const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>() const AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
@ -239,9 +246,20 @@ const form_data = computed({
}) })
function getSelectModel() { function getSelectModel() {
model.asyncGetSelectModel({ model_type: 'IMAGE' }).then((res: any) => { const obj =
modelOptions.value = groupBy(res?.data, 'provider') 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) { function submitSystemDialog(val: string) {

View File

@ -203,12 +203,12 @@ import { cloneDeep, set } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue' import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { isLastNode } from '@/workflow/common/data' import { isLastNode } from '@/workflow/common/data'
import applicationApi from '@/api/application/application'
import { t } from '@/locales' import { t } from '@/locales'
import { MsgError, MsgSuccess } from '@/utils/message' import { MsgError, MsgSuccess } from '@/utils/message'
import TooltipLabel from '@/components/dynamics-form/items/label/TooltipLabel.vue' import TooltipLabel from '@/components/dynamics-form/items/label/TooltipLabel.vue'
import NodeCascader from '@/workflow/common/NodeCascader.vue' import NodeCascader from '@/workflow/common/NodeCascader.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const props = defineProps<{ nodeModel: any }>() const props = defineProps<{ nodeModel: any }>()
const route = useRoute() const route = useRoute()
@ -216,6 +216,14 @@ const {
params: { id }, params: { id },
} = route as any } = route as any
const apiType = computed(() => {
if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const dynamicsFormRef = ref() const dynamicsFormRef = ref()
const loading = ref(false) const loading = ref(false)
@ -260,14 +268,16 @@ function getTools() {
MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip')) MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip'))
return return
} }
applicationApi.getMcpTools(id, form_data.value.mcp_servers, loading).then((res: any) => { loadSharedApi({ type: 'application', systemType: apiType.value })
form_data.value.mcp_tools = res.data .getMcpTools(id, form_data.value.mcp_servers, loading)
MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess')) .then((res: any) => {
// jsonmcp_server form_data.value.mcp_tools = res.data
form_data.value.mcp_server = form_data.value.mcp_tools.find( MsgSuccess(t('views.applicationWorkflow.nodes.mcpNode.getToolsSuccess'))
(item: any) => item.name === form_data.value.mcp_tool, // jsonmcp_server
)?.server form_data.value.mcp_server = form_data.value.mcp_tools.find(
}) (item: any) => item.name === form_data.value.mcp_tool,
)?.server
})
} }
function changeTool() { function changeTool() {

View File

@ -137,16 +137,25 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue' import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import { isLastNode } from '@/workflow/common/data' import { isLastNode } from '@/workflow/common/data'
import { t } from '@/locales' import { t } from '@/locales'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = 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 AIModeParamSettingDialogRef = ref<InstanceType<typeof AIModeParamSettingDialog>>()
const wheel = (e: any) => { const wheel = (e: any) => {
@ -220,9 +229,20 @@ const validate = () => {
} }
function getSelectModel() { function getSelectModel() {
model.asyncGetSelectModel({ model_type: 'LLM' }).then((res: any) => { const obj =
modelOptions.value = groupBy(res?.data, 'provider') 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(() => { onMounted(() => {

View File

@ -185,14 +185,22 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
import NodeCascader from '@/workflow/common/NodeCascader.vue' import NodeCascader from '@/workflow/common/NodeCascader.vue'
import ParamSettingDialog from './ParamSettingDialog.vue' import ParamSettingDialog from './ParamSettingDialog.vue'
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = 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 props = defineProps<{ nodeModel: any }>()
const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>() const ParamSettingDialogRef = ref<InstanceType<typeof ParamSettingDialog>>()
@ -244,9 +252,20 @@ function refreshParam(data: any) {
set(props.nodeModel.properties.node_data, 'reranker_setting', data) set(props.nodeModel.properties.node_data, 'reranker_setting', data)
} }
function getSelectModel() { function getSelectModel() {
model.asyncGetSelectModel({ model_type: 'RERANKER' }).then((res: any) => { const obj =
modelOptions.value = groupBy(res?.data, 'provider') 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 = () => { const add_reranker_reference = () => {

View File

@ -142,8 +142,6 @@ import type { FormInstance } from 'element-plus'
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { relatedObject } from '@/utils/array' import { relatedObject } from '@/utils/array'
import { SearchMode } from '@/enums/application' import { SearchMode } from '@/enums/application'
import useStore from '@/stores'
const { knowledge, application, user } = useStore()
const props = defineProps<{ nodeModel: any }>() const props = defineProps<{ nodeModel: any }>()
const nodeCascaderRef = ref() const nodeCascaderRef = ref()

View File

@ -98,16 +98,24 @@
import NodeContainer from '@/workflow/common/NodeContainer.vue' import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { groupBy, set } from 'lodash' import { groupBy, set } from 'lodash'
import applicationApi from '@/api/application/application'
import useStore from '@/stores'
import NodeCascader from '@/workflow/common/NodeCascader.vue' import NodeCascader from '@/workflow/common/NodeCascader.vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id },
} = route as any } = 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 props = defineProps<{ nodeModel: any }>()
const modelOptions = ref<any>(null) const modelOptions = ref<any>(null)
@ -154,9 +162,20 @@ const form_data = computed({
}) })
function getSelectModel() { function getSelectModel() {
model.asyncGetSelectModel({ model_type: 'STT' }).then((res: any) => { const obj =
modelOptions.value = groupBy(res?.data, 'provider') 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(() => { onMounted(() => {
getSelectModel() getSelectModel()

View File

@ -109,22 +109,30 @@ import { computed, onMounted, ref } from 'vue'
import { groupBy, set } from 'lodash' import { groupBy, set } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue' import NodeContainer from '@/workflow/common/NodeContainer.vue'
import TTSModeParamSettingDialog from '@/views/application/component/TTSModeParamSettingDialog.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 NodeCascader from '@/workflow/common/NodeCascader.vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { MsgSuccess } from '@/utils/message' import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales' import { t } from '@/locales'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute() const route = useRoute()
const { const {
params: { id }, params: { id },
} = route as any } = route as any
const TTSModeParamSettingDialogRef = ref<InstanceType<typeof TTSModeParamSettingDialog>>() const apiType = computed(() => {
const { model } = useStore() if (route.path.includes('resource-management')) {
return 'systemManage'
} else {
return 'workspace'
}
})
const props = defineProps<{ nodeModel: any }>() const props = defineProps<{ nodeModel: any }>()
const TTSModeParamSettingDialogRef = ref<InstanceType<typeof TTSModeParamSettingDialog>>()
const modelOptions = ref<any>(null) const modelOptions = ref<any>(null)
const aiChatNodeFormRef = ref<FormInstance>() const aiChatNodeFormRef = ref<FormInstance>()
@ -170,9 +178,20 @@ const form_data = computed({
}) })
function getSelectModel() { function getSelectModel() {
model.asyncGetSelectModel({ model_type: 'TTS' }).then((res: any) => { const obj =
modelOptions.value = groupBy(res?.data, 'provider') 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 = () => { const openTTSParamSettingDialog = () => {

View File

@ -83,16 +83,26 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { set } from 'lodash' import { set } from 'lodash'
import { useRoute } from 'vue-router'
import NodeContainer from '@/workflow/common/NodeContainer.vue' import NodeContainer from '@/workflow/common/NodeContainer.vue'
import NodeCascader from '@/workflow/common/NodeCascader.vue' import NodeCascader from '@/workflow/common/NodeCascader.vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { isLastNode } from '@/workflow/common/data' import { isLastNode } from '@/workflow/common/data'
import applicationApi from '@/api/application/application' import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
import ToolApi from '@/api/tool/tool'
const props = defineProps<{ nodeModel: any }>() 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 nodeCascaderRef = ref()
const form = { const form = {
@ -127,8 +137,9 @@ const update_field = () => {
set(props.nodeModel.properties, 'status', 500) set(props.nodeModel.properties, 'status', 500)
return return
} }
ToolApi.getToolById(props.nodeModel.properties.node_data.tool_lib_id) loadSharedApi({ type: 'tool', systemType: apiType.value })
.then((ok) => { .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 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 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) const find_field = old_input_field_list.find((old_item: any) => old_item.name == item.name)