diff --git a/ui/package.json b/ui/package.json index e3c35c123..c35647042 100644 --- a/ui/package.json +++ b/ui/package.json @@ -32,6 +32,7 @@ "pinia": "^2.1.6", "pinyin-pro": "^3.18.2", "vue": "^3.3.4", + "vue-clipboard3": "^2.0.0", "vue-router": "^4.2.4" }, "devDependencies": { diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index a2d3a2d35..e0852bb42 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -29,32 +29,6 @@ const getApplication: (param: pageRequest) => Promise> = (param) => ) } -/** - * 获得临时回话Id - * @param 参数 - * { - "model_id": "string", - "multiple_rounds_dialogue": true, - "dataset_id_list": [ - "string" - ] -} - */ -const postChatOpen: (data: ApplicationFormType) => Promise> = (data) => { - return post(`${prefix}/chat/open`, data) -} -/** - * 对话 - * @param 参数 - * chat_id: string - * { - "message": "string", - } - */ -const postChatMessage: (chat_id: string, message: string) => Promise = (chat_id, message) => { - return postStream(`/api/${prefix}/chat_message/${chat_id}`, { message }) -} - /** * 创建应用 * @param 参数 @@ -156,16 +130,85 @@ const getAccessToken: (applicaiton_id: string, loading?: Ref) => Promis return get(`${prefix}/${applicaiton_id}/access_token`, undefined, loading) } +/** + * 应用认证 + * @param 参数 + { + "access_token": "string" +} + */ +const postAppAuthentication: (access_token: string, loading?: Ref) => Promise = ( + access_token, + loading +) => { + return post(`${prefix}/authentication`, { access_token }, undefined, loading) +} + +/** + * 对话获取应用相关信息 + * @param 参数 + { + "access_token": "string" +} + */ +const getProfile: (loading?: Ref) => Promise = (loading) => { + return get(`${prefix}/profile`, undefined, loading) +} + +/** + * 获得临时回话Id + * @param 参数 + * { + "model_id": "string", + "multiple_rounds_dialogue": true, + "dataset_id_list": [ + "string" + ] +} + */ +const postChatOpen: (data: ApplicationFormType) => Promise> = (data) => { + return post(`${prefix}/chat/open`, data) +} + +/** + * 正式回话Id + * @param 参数 + * { + "model_id": "string", + "multiple_rounds_dialogue": true, + "dataset_id_list": [ + "string" + ] +} + */ +const getChatOpen: (applicaiton_id: String) => Promise> = (applicaiton_id) => { + return get(`${prefix}/${applicaiton_id}/chat/open`) +} +/** + * 对话 + * @param 参数 + * chat_id: string + * { + "message": "string", + } + */ +const postChatMessage: (chat_id: string, message: string) => Promise = (chat_id, message) => { + return postStream(`/api/${prefix}/chat_message/${chat_id}`, { message }) +} + export default { getAllAppilcation, getApplication, postApplication, putApplication, postChatOpen, + getChatOpen, postChatMessage, delApplication, getApplicationDetail, getApplicationDataset, getAPIKey, - getAccessToken + getAccessToken, + postAppAuthentication, + getProfile } diff --git a/ui/src/components/ai-dialog/index.vue b/ui/src/components/ai-dialog/index.vue index ffbff0e1e..27ffbdcaa 100644 --- a/ui/src/components/ai-dialog/index.vue +++ b/ui/src/components/ai-dialog/index.vue @@ -107,14 +107,21 @@