From 09025ec44d2ee8cc5ded0722d841f9573eed00c8 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Wed, 16 Apr 2025 10:13:16 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +---- src/views/dialogue/components/DialogueSession.vue | 12 ------------ src/views/dialogue/components/InitalPanel.vue | 2 -- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/package.json b/package.json index d0e62013..834fe569 100644 --- a/package.json +++ b/package.json @@ -45,10 +45,7 @@ "vue-echarts": "^7.0.3", "vue-i18n": "^9.14.0", "vue-router": "4.2.4", - "xss": "1.0.14", - "xterm": "4.17.0", - "xterm-addon-attach": "0.5.0", - "xterm-addon-fit": "0.6.0" + "xss": "1.0.14" }, "devDependencies": { "@eslint/js": "9.16.0", diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index b7d1ee80..0cef2b5f 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -13,7 +13,6 @@ import CommonFooter from 'src/components/commonFooter/CommonFooter.vue'; import { api } from 'src/apis'; import { useHistorySessionStore } from 'src/store/historySession'; import { successMsg, errorMsg } from 'src/components/Message'; -import 'xterm/css/xterm.css'; import i18n from 'src/i18n'; const { user_selected_app, selectMode } = storeToRefs(useHistorySessionStore()); const { getHistorySession } = useHistorySessionStore(); @@ -1180,17 +1179,6 @@ button[disabled]:hover { } } -.dialogue-shell { - flex: 1; - height: calc(100% - 36px); - width: 500px; - - :deep(.xterm) { - padding: 10px; - height: 100%; - } -} - .problem { display: flex; margin-top: 16px; diff --git a/src/views/dialogue/components/InitalPanel.vue b/src/views/dialogue/components/InitalPanel.vue index 127ac038..9ab5662b 100644 --- a/src/views/dialogue/components/InitalPanel.vue +++ b/src/views/dialogue/components/InitalPanel.vue @@ -3,12 +3,10 @@ import { onMounted, ref } from 'vue'; import { EG_LIST } from '../constants'; import { IconLoad } from '@computing/opendesign-icons'; import { useChangeThemeStore } from 'src/store'; -import 'xterm/css/xterm.css'; import router from 'src/router'; const themeStore = useChangeThemeStore(); import { useRoute } from 'vue-router'; import { api } from 'src/apis'; -import { emit } from 'process'; const route = useRoute(); const appName = ref(); -- Gitee From ed1b88edbce88282666065a1f4a639a0e6a9dc19 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Fri, 18 Apr 2025 17:11:06 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/paths/conversation.ts | 47 ++++++- src/apis/paths/type.ts | 2 +- .../dialoguePanel/DialoguePanel.vue | 122 +++++++++--------- src/store/conversation.ts | 6 +- src/views/app/index.vue | 1 - .../createapp/components/workFlowDebug.vue | 3 +- .../dialogue/components/DialogueSession.vue | 33 ++--- .../dialogue/components/ReportPopover.vue | 9 +- src/views/dialogue/types.ts | 11 +- 9 files changed, 137 insertions(+), 97 deletions(-) diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 08a052f2..373e03a9 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -128,28 +128,64 @@ export const getHistoryConversation = ( }; /** - * 评论对话 + * 点赞对话 * @param params * @returns */ export const commentConversation = (params: { qaRecordId: string; - isLike: number; + comment : string; dislikeReason?: string; reasonLink?: string; reasonDescription?: string; + groupId: string | undefined; }): Promise<[any, FcResponse> | undefined]> => { - const { qaRecordId, isLike, dislikeReason, reasonLink, reasonDescription } = + const { qaRecordId, comment , dislikeReason, reasonLink, reasonDescription, groupId} = params; - return post(`/api/comment`, { + return post(`/api/comment`, { record_id: qaRecordId, - is_like: isLike, + group_id: groupId, + comment : comment, dislike_reason: dislikeReason, reason_link: reasonLink, reason_description: reasonDescription, }); }; +/** + * 点踩 + * @param params + * @returns + */ +export const comment = (params: { + type: string; + qaRecordId: string; + comment : string; + dislikeReason?: string; + reasonLink?: string; + reasonDescription?: string; + groupId: string | undefined; +}): Promise<[any, FcResponse> | undefined]> => { + const { qaRecordId, comment , dislikeReason, reasonLink, reasonDescription, groupId,type} = + params; + if(type === 'disliked'){ + return post(`/api/comment`, { + record_id: qaRecordId, + group_id: groupId, + dislike_reason: dislikeReason, + reason_link: reasonLink, + reason_description: reasonDescription, + }); + }else{ + return post(`/api/comment`, { + record_id: qaRecordId, + group_id: groupId, + comment : comment, + }); + } + +}; + export const getRecognitionMode = (): Promise< [ any, @@ -250,4 +286,5 @@ export const sessionApi = { getUploadFiles, uploadFiles, deleteUploadedFile, + comment }; diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts index 54e012e9..7a2d7ea4 100644 --- a/src/apis/paths/type.ts +++ b/src/apis/paths/type.ts @@ -56,7 +56,7 @@ export interface ConversationRecord { flow: Flow; content: Content; metadata: Metadata; - is_like?: boolean; + comment: string; created_at: string; } diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 2203b49c..2ffeed38 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -1,7 +1,7 @@ diff --git a/src/views/dialogue/types.ts b/src/views/dialogue/types.ts index 8ede5f9a..a64b16e8 100644 --- a/src/views/dialogue/types.ts +++ b/src/views/dialogue/types.ts @@ -89,6 +89,7 @@ export interface RobotConversationItem { // 当前选中第n次回答的索引值 currentInd: number; isFinish?: boolean; + comment?: string; isSupport?: boolean; isAgainst?: boolean; createdAt?: string | Date; @@ -103,16 +104,16 @@ export interface RobotConversationItem { export interface MessageRecord { message: string; record_id: string; - is_like: number | undefined; + comment: string; } export class MessageArray { private items: MessageRecord[] = []; - addItem(message: string, record_id: string, is_like: number): void { + addItem(message: string, record_id: string, comment: string): void { const newItem: MessageRecord = { message, record_id, - is_like, + comment, }; this.items.push(newItem); } @@ -137,9 +138,9 @@ export class MessageArray { return this.items.map((item) => item.record_id); } - getIslikeList(): number[] { + getCommentList(): string[] { //类型断言,将undefined转换为0。 - return this.items.map((item) => item.is_like ?? 0); + return this.items.map((item) => item.comment); } getisLikeByIndex(index: number): number { -- Gitee From b95102f381a3625cb9205f284c4c00b3f07ab9f7 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 10:05:44 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=E7=82=B9=E8=B5=9E=E7=82=B9=E8=B8=A9=E7=9A=84?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/paths/conversation.ts | 30 ++----------------- .../dialoguePanel/DialoguePanel.vue | 24 +++++++-------- .../dialogue/components/DialogueSession.vue | 6 ++-- src/views/dialogue/types.ts | 12 ++++---- 4 files changed, 23 insertions(+), 49 deletions(-) diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 373e03a9..b26852e4 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -127,37 +127,12 @@ export const getHistoryConversation = ( // 修改 chat 格式 }; -/** - * 点赞对话 - * @param params - * @returns - */ -export const commentConversation = (params: { - qaRecordId: string; - comment : string; - dislikeReason?: string; - reasonLink?: string; - reasonDescription?: string; - groupId: string | undefined; -}): Promise<[any, FcResponse> | undefined]> => { - const { qaRecordId, comment , dislikeReason, reasonLink, reasonDescription, groupId} = - params; - return post(`/api/comment`, { - record_id: qaRecordId, - group_id: groupId, - comment : comment, - dislike_reason: dislikeReason, - reason_link: reasonLink, - reason_description: reasonDescription, - }); -}; - /** * 点踩 * @param params * @returns */ -export const comment = (params: { +export const commentConversation = (params: { type: string; qaRecordId: string; comment : string; @@ -171,6 +146,7 @@ export const comment = (params: { if(type === 'disliked'){ return post(`/api/comment`, { record_id: qaRecordId, + comment: comment, group_id: groupId, dislike_reason: dislikeReason, reason_link: reasonLink, @@ -183,7 +159,6 @@ export const comment = (params: { comment : comment, }); } - }; export const getRecognitionMode = (): Promise< @@ -286,5 +261,4 @@ export const sessionApi = { getUploadFiles, uploadFiles, deleteUploadedFile, - comment }; diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 2ffeed38..f2b29c5e 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -92,13 +92,12 @@ const props = withDefaults(defineProps(), { // currentSelected: 0, needRegernerate: false, }); -const { groupId } = toRefs(props); const thoughtContent = ref(''); const index = ref(0); const isComment = ref(props.isCommentList); const emits = defineEmits<{ ( - e: 'comment', + e: 'handleComment', type: 'liked' | 'disliked' | 'none', qaRecordId: string, groupId: string | undefined, @@ -106,7 +105,7 @@ const emits = defineEmits<{ reasion_link?: string, reason_description?: string, ): void; - (e: 'report', qaRecordId: string, reason?: string): void; + (e: 'handleReport', qaRecordId: string, reason?: string): void; ( e: 'handleSendMessage', groupId: string | undefined, @@ -157,9 +156,9 @@ const handleLike = async ( ): Promise => { if (type === 'liked') { const qaRecordId = props.recordList[index.value]; - emits('comment', type, props.cid,qaRecordId,index.value,props.groupId); + emits('handleComment', type, props.cid,qaRecordId,index.value,props.groupId); isComment.value[index.value] = 'liked'; - // handleIsLike(); + handleIsLike(); } else if (type === 'disliked') { isAgainstVisible.value = true; } else { @@ -180,7 +179,7 @@ const handleDislike = async ( ): Promise => { const qaRecordId = props.recordList[index.value]; emits( - 'comment', + 'handleComment', 'disliked', props.cid, qaRecordId, @@ -192,7 +191,7 @@ const handleDislike = async ( ); isAgainstVisible.value = false; isComment.value[index.value] = 0; - // handleIsLike(); + handleIsLike(); }; const handleOutsideClick = () => { @@ -210,7 +209,7 @@ const unbindDocumentClick = () => { // 举报功能 const handleReport = async (reason_type:string,reason: string): Promise => { const qaRecordId = props.recordList[index.value]; - emits('report', qaRecordId, reason_type, reason); + emits('handleReport', qaRecordId, reason_type, reason); isAgainstVisible.value = false; }; @@ -276,7 +275,7 @@ const prePageHandle = (cid: number) => { index.value = 0; } else { index.value--; - // handleIsLike(); + handleIsLike(); } }; @@ -287,12 +286,13 @@ const nextPageHandle = (cid: number) => { index.value = (props.isCommentList as number[]).length - 1; } else { index.value++; - // handleIsLike(); + handleIsLike(); } }; const isSupport = ref(false); const isAgainst = ref(false); + const handleIsLike = () => { if (isComment.value === undefined) { return; @@ -303,8 +303,8 @@ const handleIsLike = () => { isSupport.value = (comment === 'liked'); isAgainst.value = !isSupport.value; } else { - isSupport.value = 0; - isAgainst.value = 0; + isSupport.value = false; + isAgainst.value = false; } } } diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index 112f1d0a..f6cc0326 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -264,7 +264,7 @@ const handlecomment = async ( reasonDescription: reasonDescription, groupId: groupId, }; - const [_, res] = await api.comment(params); + const [_, res] = await api.commentConversation(params); if (!_ && res) { successMsg(i18n.global.t('feedback.feedbackSuccesful')); } @@ -806,8 +806,8 @@ watch( :search_suggestions="getItem(item, 'search_suggestions')" :paramsList="getItem(item, 'paramsList')" :modeOptions="modeOptions" - @comment ="handlecomment " - @report="handleReport" + @handleComment ="handlecomment " + @handleReport="handleReport" @handleSendMessage="handleSendMessage" @clearSuggestion="clearSuggestion(index)" /> diff --git a/src/views/dialogue/types.ts b/src/views/dialogue/types.ts index a64b16e8..9e2dfc4a 100644 --- a/src/views/dialogue/types.ts +++ b/src/views/dialogue/types.ts @@ -140,18 +140,18 @@ export class MessageArray { getCommentList(): string[] { //类型断言,将undefined转换为0。 - return this.items.map((item) => item.comment); + return this.items.map((item) => item.comment ? item.comment : 'none'); } - getisLikeByIndex(index: number): number { - return this.items.map((item) => item.is_like ?? 0)[index]; + getCommentyIndex(index: number): string { + return this.items.map((item) => item.comment ? item.comment : 'none')[index]; } - changeisLikeByCidAndIndex( + changeCommentByCidAndIndex( cid: number, index: number, - islike: number | boolean, + comment: string, ): void { - this.getisLikeByIndex(index)[cid] = islike; + } } -- Gitee From 8bc2faedbc74ece970fc23ec72b6c9f043daa093 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 10:13:31 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E7=82=B9=E8=B8=A9=E5=90=8E=E7=9A=84=E7=8A=B6=E6=80=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dialoguePanel/DialoguePanel.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index f2b29c5e..ff6b986e 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -156,9 +156,10 @@ const handleLike = async ( ): Promise => { if (type === 'liked') { const qaRecordId = props.recordList[index.value]; - emits('handleComment', type, props.cid,qaRecordId,index.value,props.groupId); - isComment.value[index.value] = 'liked'; - handleIsLike(); + emits('handleComment',!isSupport.value ? 'liked' : 'none', props.cid,qaRecordId,index.value,props.groupId).then((res) => { + isComment.value[index.value] = 'liked'; + handleIsLike(); + }); } else if (type === 'disliked') { isAgainstVisible.value = true; } else { @@ -180,7 +181,7 @@ const handleDislike = async ( const qaRecordId = props.recordList[index.value]; emits( 'handleComment', - 'disliked', + !isAgainst.value ? 'disliked' : 'none', props.cid, qaRecordId, index.value, @@ -188,10 +189,11 @@ const handleDislike = async ( reason, reasionLink, reasonDescription, - ); - isAgainstVisible.value = false; - isComment.value[index.value] = 0; - handleIsLike(); + ).then((res) => { + isAgainstVisible.value = false; + isComment.value[index.value] = 'disliked'; + handleIsLike(); + }); }; const handleOutsideClick = () => { -- Gitee From 9f5019892fe11a2b0c4cac38b1f5dbbeb9c7b1ee Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 10:54:31 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E7=82=B9=E8=B8=A9=E5=90=8E=E7=9A=84=E7=8A=B6=E6=80=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/paths/conversation.ts | 33 ++++---- .../dialoguePanel/DialoguePanel.vue | 76 ++++++++++--------- src/store/conversation.ts | 14 ++-- .../createapp/components/workFlowDebug.vue | 1 - .../dialogue/components/DialogueSession.vue | 39 ---------- 5 files changed, 64 insertions(+), 99 deletions(-) diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index b26852e4..1f5bba1b 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -18,13 +18,7 @@ const BASE_URL = '/api/conversation'; * @returns */ export const stopGeneration = (): Promise< - [ - any, - ( - | FcResponse - | undefined - ), - ] + [any, FcResponse | undefined] > => { return post(`/api/stop`); }; @@ -135,16 +129,23 @@ export const getHistoryConversation = ( export const commentConversation = (params: { type: string; qaRecordId: string; - comment : string; + comment: string; dislikeReason?: string; reasonLink?: string; reasonDescription?: string; groupId: string | undefined; }): Promise<[any, FcResponse> | undefined]> => { - const { qaRecordId, comment , dislikeReason, reasonLink, reasonDescription, groupId,type} = - params; - if(type === 'disliked'){ - return post(`/api/comment`, { + const { + qaRecordId, + comment, + dislikeReason, + reasonLink, + reasonDescription, + groupId, + type, + } = params; + if (type === 'disliked') { + return post(`/api/comment`, { record_id: qaRecordId, comment: comment, group_id: groupId, @@ -152,11 +153,11 @@ export const commentConversation = (params: { reason_link: reasonLink, reason_description: reasonDescription, }); - }else{ + } else { return post(`/api/comment`, { - record_id: qaRecordId, - group_id: groupId, - comment : comment, + record_id: qaRecordId, + group_id: groupId, + comment: comment, }); } }; diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index ff6b986e..8f1dfe83 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -1,7 +1,7 @@