feat: application
This commit is contained in:
parent
e0dcc4b29d
commit
ab256b980d
63
ui/src/api/application/application-key.ts
Normal file
63
ui/src/api/application/application-key.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import { Result } from '@/request/Result'
|
||||||
|
import { get, post, del, put } from '@/request/index'
|
||||||
|
|
||||||
|
import { type Ref } from 'vue'
|
||||||
|
|
||||||
|
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/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`, 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`, {}, 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/${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/${api_key_id}`, data, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getAPIKey,
|
||||||
|
postAPIKey,
|
||||||
|
delAPIKey,
|
||||||
|
putAPIKey,
|
||||||
|
}
|
||||||
@ -1,90 +0,0 @@
|
|||||||
import { Result } from '@/request/Result'
|
|
||||||
import { get, post, del, put } from '@/request/index'
|
|
||||||
|
|
||||||
import { type Ref } from 'vue'
|
|
||||||
|
|
||||||
const prefix = '/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}/api_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}/api_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}/api_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}/api_key/${api_key_id}`, 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}/statistics/chat_record_aggregate_trend`, data, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改应用icon
|
|
||||||
* @param 参数 application_id
|
|
||||||
* data: file
|
|
||||||
*/
|
|
||||||
const putAppIcon: (
|
|
||||||
application_id: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>
|
|
||||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
|
||||||
return put(`${prefix}/${application_id}/edit_icon`, data, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
getAPIKey,
|
|
||||||
postAPIKey,
|
|
||||||
delAPIKey,
|
|
||||||
putAPIKey,
|
|
||||||
getStatistics,
|
|
||||||
putAppIcon
|
|
||||||
}
|
|
||||||
@ -1,9 +1,9 @@
|
|||||||
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'
|
||||||
import type {FormField} from '@/components/dynamics-form/type'
|
import type { FormField } from '@/components/dynamics-form/type'
|
||||||
|
|
||||||
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/application'
|
const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/application'
|
||||||
|
|
||||||
@ -11,8 +11,11 @@ const prefix = '/workspace/' + localStorage.getItem('workspace_id') + '/applicat
|
|||||||
* 获取全部应用
|
* 获取全部应用
|
||||||
* @param 参数
|
* @param 参数
|
||||||
*/
|
*/
|
||||||
const getAllApplication: () => Promise<Result<any[]>> = () => {
|
const getAllApplication: (param?: any, loading?: Ref<boolean>) => Promise<Result<any[]>> = (
|
||||||
return get(`${prefix}`)
|
param,
|
||||||
|
loading,
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}`, param, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,11 +29,7 @@ const getApplication: (
|
|||||||
param: any,
|
param: any,
|
||||||
loading?: Ref<boolean>,
|
loading?: Ref<boolean>,
|
||||||
) => Promise<Result<any>> = (page, param, loading) => {
|
) => Promise<Result<any>> = (page, param, loading) => {
|
||||||
return get(
|
return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading)
|
||||||
`${prefix}/${page.current_page}/${page.page_size}`,
|
|
||||||
param,
|
|
||||||
loading,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,17 +77,6 @@ const getApplicationDetail: (
|
|||||||
return get(`${prefix}/${application_id}`, undefined, loading)
|
return get(`${prefix}/${application_id}`, undefined, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得当前应用可使用的知识库
|
|
||||||
* @param 参数 application_id
|
|
||||||
*/
|
|
||||||
const getApplicationDataset: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/list_dataset`, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取AccessToken
|
* 获取AccessToken
|
||||||
* @param 参数 application_id
|
* @param 参数 application_id
|
||||||
@ -116,406 +104,8 @@ const putAccessToken: (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用认证
|
* 导出应用
|
||||||
* @param 参数
|
|
||||||
{
|
|
||||||
"access_token": "string"
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
const postAppAuthentication: (
|
|
||||||
access_token: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
authentication_value?: any,
|
|
||||||
) => Promise<any> = (access_token, loading, authentication_value) => {
|
|
||||||
return post(
|
|
||||||
`${prefix}/authentication`,
|
|
||||||
{access_token: access_token, authentication_value},
|
|
||||||
undefined,
|
|
||||||
loading,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对话获取应用相关信息
|
|
||||||
* @param 参数
|
|
||||||
{
|
|
||||||
"access_token": "string"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
const getAppProfile: (loading?: Ref<boolean>) => Promise<any> = (loading) => {
|
|
||||||
return get(`${prefix}/profile`, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得临时回话Id
|
|
||||||
* @param 参数
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
const postChatOpen: (data: ApplicationFormType) => Promise<Result<any>> = (data) => {
|
|
||||||
return post(`${prefix}/chat/open`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得工作流临时回话Id
|
|
||||||
* @param 参数
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
const postWorkflowChatOpen: (data: ApplicationFormType) => Promise<Result<any>> = (data) => {
|
|
||||||
return post(`${prefix}/chat_workflow/open`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 正式回话Id
|
|
||||||
* @param 参数
|
|
||||||
* {
|
|
||||||
"model_id": "string",
|
|
||||||
"multiple_rounds_dialogue": true,
|
|
||||||
"dataset_id_list": [
|
|
||||||
"string"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
const getChatOpen: (application_id: string) => Promise<Result<any>> = (application_id) => {
|
|
||||||
return get(`${prefix}/${application_id}/chat/open`)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 对话
|
|
||||||
* @param 参数
|
|
||||||
* chat_id: string
|
|
||||||
* data
|
|
||||||
*/
|
|
||||||
const postChatMessage: (chat_id: string, data: any) => Promise<any> = (chat_id, data) => {
|
|
||||||
return postStream(`/api${prefix}/chat_message/${chat_id}`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点赞、点踩
|
|
||||||
* @param 参数
|
|
||||||
* application_id : string; chat_id : string; chat_record_id : string
|
|
||||||
* {
|
|
||||||
"vote_status": "string", // -1 0 1
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
const putChatVote: (
|
|
||||||
application_id: string,
|
|
||||||
chat_id: string,
|
|
||||||
chat_record_id: string,
|
|
||||||
vote_status: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<any> = (application_id, chat_id, chat_record_id, vote_status, loading) => {
|
|
||||||
return put(
|
|
||||||
`${prefix}/${application_id}/chat/${chat_id}/chat_record/${chat_record_id}/vote`,
|
|
||||||
{
|
|
||||||
vote_status,
|
|
||||||
},
|
|
||||||
undefined,
|
|
||||||
loading,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 命中测试列表
|
|
||||||
* @param application_id
|
|
||||||
* @param loading
|
|
||||||
* @query { query_text: string, top_number: number, similarity: number }
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getApplicationHitTest: (
|
|
||||||
application_id: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<any>>> = (application_id, data, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/hit_test`, data, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前用户可使用的模型列表
|
|
||||||
* @param application_id
|
|
||||||
* @param loading
|
|
||||||
* @query { query_text: string, top_number: number, similarity: number }
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getApplicationModel: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/model`, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前用户可使用的模型列表
|
|
||||||
* @param application_id
|
|
||||||
* @param loading
|
|
||||||
* @query { query_text: string, top_number: number, similarity: number }
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getApplicationRerankerModel: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/model`, {model_type: 'RERANKER'}, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前用户可使用的模型列表
|
|
||||||
* @param application_id
|
|
||||||
* @param loading
|
|
||||||
* @query { query_text: string, top_number: number, similarity: number }
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getApplicationSTTModel: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/model`, {model_type: 'STT'}, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前用户可使用的模型列表
|
|
||||||
* @param application_id
|
|
||||||
* @param loading
|
|
||||||
* @query { query_text: string, top_number: number, similarity: number }
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getApplicationTTSModel: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/model`, {model_type: 'TTS'}, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
const getApplicationImageModel: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/model`, {model_type: 'IMAGE'}, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
const getApplicationTTIModel: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<any>>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/model`, {model_type: 'TTI'}, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发布应用
|
|
||||||
* @param 参数
|
|
||||||
*/
|
|
||||||
const putPublishApplication: (
|
|
||||||
application_id: string,
|
|
||||||
data: ApplicationFormType,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
|
||||||
return put(`${prefix}/${application_id}/publish`, data, undefined, loading)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取应用所属的函数库列表
|
|
||||||
* @param application_id 应用id
|
|
||||||
* @param loading
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const listFunctionLib: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
|
||||||
application_id,
|
|
||||||
loading,
|
|
||||||
) => {
|
|
||||||
return get(`${prefix}/${application_id}/function_lib`, undefined, loading)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取当前人的所有应用列表
|
|
||||||
* @param application_id 应用id
|
|
||||||
* @param loading
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const getApplicationList: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/application`, undefined, loading)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取应用所属的函数库
|
|
||||||
* @param application_id
|
|
||||||
* @param function_lib_id
|
|
||||||
* @param loading
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getFunctionLib: (
|
|
||||||
application_id: string,
|
|
||||||
function_lib_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, function_lib_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/function_lib/${function_lib_id}`, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
const getMcpTools: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
|
||||||
data,
|
|
||||||
loading,
|
|
||||||
) => {
|
|
||||||
return get(`${prefix}/mcp_servers`, data, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
const getApplicationById: (
|
|
||||||
application_id: string,
|
|
||||||
app_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, app_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/application/${app_id}`, undefined, loading)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取模型参数表单
|
|
||||||
* @param application_id 应用id
|
|
||||||
* @param model_id 模型id
|
|
||||||
* @param loading
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getModelParamsForm: (
|
|
||||||
application_id: string,
|
|
||||||
model_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<Array<FormField>>> = (application_id, model_id, loading) => {
|
|
||||||
return get(`${prefix}/${application_id}/model_params_form/${model_id}`, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文档图片附件
|
|
||||||
*/
|
|
||||||
const uploadFile: (
|
|
||||||
application_id: string,
|
|
||||||
chat_id: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, chat_id, data, loading) => {
|
|
||||||
return post(`${prefix}/${application_id}/chat/${chat_id}/upload_file`, data, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 语音转文本
|
|
||||||
*/
|
|
||||||
const postSpeechToText: (
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文本转语音
|
|
||||||
*/
|
|
||||||
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 playDemoText: (
|
|
||||||
application_id: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, data, loading) => {
|
|
||||||
return download(`${prefix}/${application_id}/play_demo_text`, 'post', data, undefined, loading)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取平台状态
|
|
||||||
*/
|
|
||||||
const getPlatformStatus: (application_id: string) => Promise<Result<any>> = (application_id) => {
|
|
||||||
return get(`/platform/${application_id}/status`)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取平台配置
|
|
||||||
*/
|
|
||||||
const getPlatformConfig: (application_id: string, type: string) => Promise<Result<any>> = (
|
|
||||||
application_id,
|
|
||||||
type,
|
|
||||||
) => {
|
|
||||||
return get(`/platform/${application_id}/${type}`)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 更新平台配置
|
|
||||||
*/
|
|
||||||
const updatePlatformConfig: (
|
|
||||||
application_id: string,
|
|
||||||
type: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, type, data, loading) => {
|
|
||||||
return post(`/platform/${application_id}/${type}`, data, undefined, loading)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 更新平台状态
|
|
||||||
*/
|
|
||||||
const updatePlatformStatus: (application_id: string, data: any) => Promise<Result<any>> = (
|
|
||||||
application_id,
|
|
||||||
data,
|
|
||||||
) => {
|
|
||||||
return post(`/platform/${application_id}/status`, data)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 验证密码
|
|
||||||
*/
|
|
||||||
const validatePassword: (
|
|
||||||
application_id: string,
|
|
||||||
password: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, password, loading) => {
|
|
||||||
return get(`/application/${application_id}/auth/${password}`, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* workflow历史版本
|
|
||||||
*/
|
|
||||||
const getWorkFlowVersion: (
|
|
||||||
application_id: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) => Promise<Result<any>> = (application_id, loading) => {
|
|
||||||
return get(`/application/${application_id}/work_flow_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(
|
|
||||||
`/application/${application_id}/work_flow_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(
|
|
||||||
`/application/${application_id}/work_flow_version/${application_version_id}`,
|
|
||||||
data,
|
|
||||||
undefined,
|
|
||||||
loading,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const getUserList: (type: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
|
||||||
type,
|
|
||||||
loading,
|
|
||||||
) => {
|
|
||||||
return get(`/user/list/${type}`, undefined, loading)
|
|
||||||
}
|
|
||||||
|
|
||||||
const exportApplication = (
|
const exportApplication = (
|
||||||
application_id: string,
|
application_id: string,
|
||||||
@ -524,7 +114,7 @@ const exportApplication = (
|
|||||||
) => {
|
) => {
|
||||||
return exportFile(
|
return exportFile(
|
||||||
application_name + '.mk',
|
application_name + '.mk',
|
||||||
`/application/${application_id}/export`,
|
`${prefix}/${application_id}/export`,
|
||||||
undefined,
|
undefined,
|
||||||
loading,
|
loading,
|
||||||
)
|
)
|
||||||
@ -539,50 +129,29 @@ 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)
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getAllAppilcation: getAllApplication,
|
getAllApplication,
|
||||||
getApplication,
|
getApplication,
|
||||||
postApplication,
|
postApplication,
|
||||||
putApplication,
|
putApplication,
|
||||||
postChatOpen,
|
|
||||||
getChatOpen,
|
|
||||||
postChatMessage,
|
|
||||||
delApplication,
|
delApplication,
|
||||||
getApplicationDetail,
|
getApplicationDetail,
|
||||||
getApplicationDataset,
|
|
||||||
getAccessToken,
|
getAccessToken,
|
||||||
putAccessToken,
|
putAccessToken,
|
||||||
postAppAuthentication,
|
|
||||||
getAppProfile,
|
|
||||||
putChatVote,
|
|
||||||
getApplicationHitTest,
|
|
||||||
getApplicationModel,
|
|
||||||
putPublishApplication,
|
|
||||||
postWorkflowChatOpen,
|
|
||||||
listFunctionLib,
|
|
||||||
getFunctionLib,
|
|
||||||
getModelParamsForm,
|
|
||||||
getApplicationRerankerModel,
|
|
||||||
getApplicationSTTModel,
|
|
||||||
getApplicationTTSModel,
|
|
||||||
getApplicationImageModel,
|
|
||||||
getApplicationTTIModel,
|
|
||||||
postSpeechToText,
|
|
||||||
postTextToSpeech,
|
|
||||||
getPlatformStatus,
|
|
||||||
getPlatformConfig,
|
|
||||||
updatePlatformConfig,
|
|
||||||
updatePlatformStatus,
|
|
||||||
validatePassword,
|
|
||||||
getWorkFlowVersion,
|
|
||||||
getWorkFlowVersionDetail,
|
|
||||||
putWorkFlowVersion,
|
|
||||||
playDemoText,
|
|
||||||
getUserList,
|
|
||||||
getApplicationList,
|
|
||||||
uploadFile,
|
|
||||||
exportApplication,
|
exportApplication,
|
||||||
importApplication,
|
importApplication,
|
||||||
getApplicationById,
|
getStatistics,
|
||||||
getMcpTools,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@
|
|||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { copyClick } from '@/utils/clipboard'
|
import { copyClick } from '@/utils/clipboard'
|
||||||
import overviewApi from '@/api/application/application-overview'
|
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'
|
||||||
@ -100,7 +100,7 @@ function deleteApiKey(row: any) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
overviewApi.delAPIKey(id as string, row.id, loading).then(() => {
|
applicationKeyApi.delAPIKey(id as string, row.id, loading).then(() => {
|
||||||
MsgSuccess(t('common.deleteSuccess'))
|
MsgSuccess(t('common.deleteSuccess'))
|
||||||
getApiKeyList()
|
getApiKeyList()
|
||||||
})
|
})
|
||||||
@ -115,7 +115,7 @@ function changeState(row: any) {
|
|||||||
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')
|
||||||
overviewApi
|
applicationKeyApi
|
||||||
.putAPIKey(id as string, row.id, obj, loading)
|
.putAPIKey(id as string, row.id, obj, loading)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
MsgSuccess(str)
|
MsgSuccess(str)
|
||||||
@ -128,7 +128,7 @@ function changeState(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createApiKey() {
|
function createApiKey() {
|
||||||
overviewApi.postAPIKey(id as string, loading).then((res) => {
|
applicationKeyApi.postAPIKey(id as string, loading).then((res) => {
|
||||||
getApiKeyList()
|
getApiKeyList()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ const open = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getApiKeyList() {
|
function getApiKeyList() {
|
||||||
overviewApi.getAPIKey(id as string, loading).then((res) => {
|
applicationKeyApi.getAPIKey(id as string, loading).then((res) => {
|
||||||
apiKey.value = res.data
|
apiKey.value = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import overviewApi from '@/api/application/application-overview'
|
import overviewApi from '@/api/application/application-key'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||||
import { defaultIcon, isAppIcon } from '@/utils/common'
|
import { defaultIcon, isAppIcon } from '@/utils/common'
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
import { ref, watch } from 'vue'
|
import { ref, watch } 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 overviewApi from '@/api/application/application-overview'
|
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'
|
||||||
@ -95,7 +95,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
|
|
||||||
const apiCall =
|
const apiCall =
|
||||||
APIType.value === 'APPLICATION'
|
APIType.value === 'APPLICATION'
|
||||||
? overviewApi.putAPIKey(id as string, APIKeyId.value, obj, loading)
|
? applicationKeyApi.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((res) => {
|
||||||
|
|||||||
@ -211,7 +211,7 @@ import XPackDisplaySettingDialog from './component/XPackDisplaySettingDialog.vue
|
|||||||
import EditAvatarDialog from './component/EditAvatarDialog.vue'
|
import EditAvatarDialog from './component/EditAvatarDialog.vue'
|
||||||
import StatisticsCharts from './component/StatisticsCharts.vue'
|
import StatisticsCharts from './component/StatisticsCharts.vue'
|
||||||
import applicationApi from '@/api/application/application'
|
import applicationApi from '@/api/application/application'
|
||||||
import overviewApi from '@/api/application/application-overview'
|
import overviewApi from '@/api/application/application-key'
|
||||||
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'
|
||||||
@ -317,7 +317,7 @@ function changeDayRangeHandle(val: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAppStatistics() {
|
function getAppStatistics() {
|
||||||
overviewApi.getStatistics(id, daterange.value, statisticsLoading).then((res: any) => {
|
applicationApi.getStatistics(id, daterange.value, statisticsLoading).then((res: any) => {
|
||||||
statisticsData.value = res.data
|
statisticsData.value = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -424,8 +424,8 @@ function mapToUrlParams(map: any[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// getDetail()
|
getDetail()
|
||||||
// getAccessToken()
|
getAccessToken()
|
||||||
// changeDayHandle(history_day.value)
|
// changeDayHandle(history_day.value)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -166,7 +166,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<el-text type="info" v-if="applicationForm.dataset_id_list?.length === 0"
|
<el-text type="info" v-if="applicationForm.knowledge_id_list?.length === 0"
|
||||||
>{{ $t('views.application.form.relatedKnowledge.placeholder') }}
|
>{{ $t('views.application.form.relatedKnowledge.placeholder') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-row :gutter="12" v-else>
|
<el-row :gutter="12" v-else>
|
||||||
@ -177,7 +177,7 @@
|
|||||||
:lg="12"
|
:lg="12"
|
||||||
:xl="12"
|
:xl="12"
|
||||||
class="mb-8"
|
class="mb-8"
|
||||||
v-for="(item, index) in applicationForm.dataset_id_list"
|
v-for="(item, index) in applicationForm.knowledge_id_list"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<el-card class="relate-dataset-card border-r-4" shadow="never">
|
<el-card class="relate-dataset-card border-r-4" shadow="never">
|
||||||
@ -540,8 +540,8 @@ const applicationForm = ref<ApplicationFormType>({
|
|||||||
model_id: '',
|
model_id: '',
|
||||||
dialogue_number: 1,
|
dialogue_number: 1,
|
||||||
prologue: t('views.application.form.defaultPrologue'),
|
prologue: t('views.application.form.defaultPrologue'),
|
||||||
dataset_id_list: [],
|
knowledge_id_list: [],
|
||||||
dataset_setting: {
|
knowledge_setting: {
|
||||||
top_n: 3,
|
top_n: 3,
|
||||||
similarity: 0.6,
|
similarity: 0.6,
|
||||||
max_paragraph_char_number: 5000,
|
max_paragraph_char_number: 5000,
|
||||||
@ -661,20 +661,20 @@ function refreshTTSForm(data: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeDataset(id: any) {
|
function removeDataset(id: any) {
|
||||||
if (applicationForm.value.dataset_id_list) {
|
if (applicationForm.value.knowledge_id_list) {
|
||||||
applicationForm.value.dataset_id_list.splice(
|
applicationForm.value.knowledge_id_list.splice(
|
||||||
applicationForm.value.dataset_id_list.indexOf(id),
|
applicationForm.value.knowledge_id_list.indexOf(id),
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDataset(val: Array<string>) {
|
function addDataset(val: Array<string>) {
|
||||||
applicationForm.value.dataset_id_list = val
|
applicationForm.value.knowledge_id_list = val
|
||||||
}
|
}
|
||||||
|
|
||||||
function openDatasetDialog() {
|
function openDatasetDialog() {
|
||||||
AddDatasetDialogRef.value.open(applicationForm.value.dataset_id_list)
|
AddDatasetDialogRef.value.open(applicationForm.value.knowledge_id_list)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDetail() {
|
function getDetail() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user