From 8594fd4d0926f9ab437397e1072944e09e1e9b70 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Fri, 1 Dec 2023 18:21:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/application.ts | 28 +++++++- ui/src/api/type/application.ts | 2 + .../components/ai-dialog/OperationButton.vue | 64 +++++++++++++++---- ui/src/components/ai-dialog/index.vue | 33 ++++++++-- ui/src/request/index.ts | 2 +- ui/src/stores/modules/application.ts | 3 + ui/src/views/application/CreateAndSetting.vue | 6 +- ui/src/views/chat/index.vue | 2 +- 8 files changed, 117 insertions(+), 23 deletions(-) diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index e0852bb42..99b6ed742 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -196,6 +196,31 @@ const postChatMessage: (chat_id: string, message: string) => Promise = (cha return postStream(`/api/${prefix}/chat_message/${chat_id}`, { message }) } +/** + * 点赞、点踩 + * @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 +) => Promise = (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 + ) +} + export default { getAllAppilcation, getApplication, @@ -210,5 +235,6 @@ export default { getAPIKey, getAccessToken, postAppAuthentication, - getProfile + getProfile, + putChatVote } diff --git a/ui/src/api/type/application.ts b/ui/src/api/type/application.ts index 65605fbf5..713964d51 100644 --- a/ui/src/api/type/application.ts +++ b/ui/src/api/type/application.ts @@ -22,6 +22,8 @@ interface chatType { * 是否暂停 */ is_stop?: boolean + record_id: string + vote_status: string } export class ChatRecordManage { diff --git a/ui/src/components/ai-dialog/OperationButton.vue b/ui/src/components/ai-dialog/OperationButton.vue index 0690529d7..ed661187e 100644 --- a/ui/src/components/ai-dialog/OperationButton.vue +++ b/ui/src/components/ai-dialog/OperationButton.vue @@ -7,45 +7,85 @@ - + - - + + - - + + - - - + + + - - + + diff --git a/ui/src/components/ai-dialog/index.vue b/ui/src/components/ai-dialog/index.vue index dd186c63e..89eec2150 100644 --- a/ui/src/components/ai-dialog/index.vue +++ b/ui/src/components/ai-dialog/index.vue @@ -78,9 +78,9 @@ > - +
+ +
@@ -109,10 +109,16 @@