From eec3c8dfce2748372f5ff7547c946703a724a299 Mon Sep 17 00:00:00 2001 From: zttProjectSpace Date: Wed, 16 Apr 2025 17:41:05 +0800 Subject: [PATCH 01/60] =?UTF-8?q?yaml=E8=A7=A3=E6=9E=90=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E5=8E=BB=E6=8E=89loading=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- Gitee From 59d03dfb52fe8a32ac5ac1897bd8d98d9fdd085f Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot Date: Thu, 17 Apr 2025 01:58:27 +0000 Subject: [PATCH 02/60] =?UTF-8?q?!179=20yaml=E8=A7=A3=E6=9E=90=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=8E=BB=E6=8E=89loading=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: @zttProjectSpace Reviewed-by: @hongyu-shi Signed-off-by: @hongyu-shi -- Gitee From 7ad1db47f4f57be43f7a5af38781131c236fc5a9 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Wed, 16 Apr 2025 10:13:16 +0800 Subject: [PATCH 03/60] =?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 --- src/views/dialogue/components/InitalPanel.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/dialogue/components/InitalPanel.vue b/src/views/dialogue/components/InitalPanel.vue index 4dd881ea..445f00ee 100644 --- a/src/views/dialogue/components/InitalPanel.vue +++ b/src/views/dialogue/components/InitalPanel.vue @@ -7,7 +7,6 @@ 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 ac4d3e57c7d7c34ba478e887ef76e7814e79e695 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Fri, 18 Apr 2025 17:11:06 +0800 Subject: [PATCH 04/60] =?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 | 25 +++++----- 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, 89 insertions(+), 48 deletions(-) diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index bfeb68e4..75be08cb 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -122,28 +122,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, @@ -244,4 +280,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 8c8c3a2f..cc4f27dc 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -24,6 +24,8 @@ export interface DialoguePanelProps { key: number; // cid: number; + // groupid + groupId: string; // 用来区分是用户还是ai的输入 type: DialoguePanelType; // 文本内容 @@ -47,7 +49,7 @@ export interface DialoguePanelProps { // recordList?: string[] | undefined; // - isLikeList?: number[] | undefined; + isCommentList?: string[] | undefined; // search_suggestions?: any; // @@ -68,7 +70,6 @@ export interface DialoguePanelProps { import JsonFormComponent from './JsonFormComponent.vue'; import { Metadata } from 'src/apis/paths/type'; import DialogueFlow from './DialogueFlow.vue'; - var option = ref(); var show = ref(false); const size = reactive({ @@ -97,12 +98,13 @@ const { thoughtContent, contentAfterMark } = useMarkdownParser( toRef(props, 'currentSelected'), ); const index = ref(0); -const isLike = ref(props.isLikeList); +const isComment = ref(props.isCommentList); const emits = defineEmits<{ ( - e: 'commont', - type: 'support' | 'against', + e: 'comment', + type: 'liked' | 'disliked' | 'none', qaRecordId: string, + groupId: string | undefined, reason?: string, reasion_link?: string, reason_description?: string, @@ -154,7 +156,7 @@ const unbindDocumentClick = () => { // 举报功能 目前未实现 const handleReport = async (reason: string): Promise => { const qaRecordId = props.recordList[index.value]; - emits('report', qaRecordId, reason); + emits('report', qaRecordId, reason_type, reason); isAgainstVisible.value = false; }; @@ -186,14 +188,15 @@ const prePageHandle = (cid: number) => { } else { index.value--; // handleIsLike(); + // handleIsLike(); } }; const nextPageHandle = (cid: number) => { thoughtContent.value = ''; nextPage(cid); - if (index.value === (props.isLikeList as number[]).length - 1) { - index.value = (props.isLikeList as number[]).length - 1; + if (index.value === (props.isCommentList as number[]).length - 1) { + index.value = (props.isCommentList as number[]).length - 1; } else { index.value++; // handleIsLike(); @@ -246,7 +249,7 @@ watch( ); onBeforeUnmount(() => { - isLike.value = undefined; + isComment.value = undefined; index.value = 0; }); @@ -495,7 +498,7 @@ const searchAppName = (appId) => { > { > { re?.messageList.addItem( record.content.answer, record.id, - typeof record.is_like === 'object' ? 2 : Number(record.is_like), + // is_like字段改为 comment = "liked", "disliked", "none" + record.comment ); if (re?.currentInd !== undefined) { re.currentInd = re.currentInd + 1; @@ -752,7 +753,8 @@ export const useSessionStore = defineStore('conversation', () => { a.addItem( record.content.answer, record.id, - typeof record.is_like === 'object' ? 2 : Number(record.is_like), + // is_like字段改为 comment = "liked", "disliked", "none" + record.comment ); conversationList.value.unshift( { diff --git a/src/views/app/index.vue b/src/views/app/index.vue index 959a26f7..a8996507 100644 --- a/src/views/app/index.vue +++ b/src/views/app/index.vue @@ -305,7 +305,6 @@ onMounted(() => { }); onMounted(() => { - console.log(router.currentRoute.value.query); if (router.currentRoute.value.query.to === 'createdByMe') { handleSearchAppList('createdByMe'); } diff --git a/src/views/createapp/components/workFlowDebug.vue b/src/views/createapp/components/workFlowDebug.vue index c614210e..8447e5c3 100644 --- a/src/views/createapp/components/workFlowDebug.vue +++ b/src/views/createapp/components/workFlowDebug.vue @@ -11,6 +11,7 @@ v-for="(item, index) in conversationList" :cid="item.cid" :key="index" + :groupId="item.groupId" :type="item.belong" :inputParams="item.params" :content="item.message" @@ -25,7 +26,7 @@ :search_suggestions="getItem(item, 'search_suggestions')" :paramsList="getItem(item, 'paramsList')" :isWorkFlowDebug="true" - @commont="handleCommont" + @comment ="handlecomment " @report="handleReport" @handleSendMessage="handleSendMessage" @clearSuggestion="clearSuggestion(index)" diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index ad31c264..8be28725 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -24,10 +24,6 @@ export interface DialogueSession { const props = withDefaults(defineProps(), {}); -enum SupportMap { - support = 1, - against = 0, -} const Form = ref(props.createAppForm); const AppForm = ref(props.createAppForm); const { pausedStream } = useSessionStore(); @@ -240,30 +236,34 @@ const inputRef = ref(null); * @param type * @param cid */ -const handleCommont = async ( - type: 'support' | 'against', +const handlecomment = async ( + type: 'liked' | 'disliked' | 'none', cid: number, qaRecordId: number, index: number, + groupId: string | undefined, reason?: string, reasonLink?: string, reasonDescription?: string, ) => { const params: { + type: 'liked' | 'disliked' | 'none'; qaRecordId: string; - isLike: number; + comment: string; dislikeReason?: string; reasonLink?: string; reasonDescription?: string; + groupId: string | undefined; } = { + type, qaRecordId: qaRecordId, - isLike: SupportMap[type], + comment: type, dislikeReason: reason, reasonLink: reasonLink, reasonDescription: reasonDescription, + groupId: groupId, }; - - const [_, res] = await api.commentConversation(params); + const [_, res] = await api.comment(params); if (!_ && res) { successMsg(i18n.global.t('feedback.feedbackSuccesful')); } @@ -274,11 +274,13 @@ const handleCommont = async ( * @param type * @param cid */ -const handleReport = async (qaRecordId: string, reason: string) => { +const handleReport = async (qaRecordId: string,reason_type:string,reason: string) => { const params: { qaRecordId: string; + reason_type:string; reason: string; } = { + reason_type: reason_type, record_id: qaRecordId, reason: reason, }; @@ -781,6 +783,7 @@ watch( v-for="(item, index) in conversationList" :cid="item.cid" :key="index" + :groupId="getItem(item, 'groupId')" :type="item.belong" :inputParams="item.params" :content="item.message" @@ -788,12 +791,10 @@ watch( :recordList=" item.belong === 'robot' ? item.messageList.getRecordIdList() : '' " - :isLikeList=" - item.belong === 'robot' ? item.messageList.getIslikeList() : '' + :isCommentList=" + item.belong === 'robot' ? item.messageList.getCommentList() : '' " :is-finish="getItem(item, 'isFinish')" - :is-support="getItem(item, 'isSupport')" - :is-against="getItem(item, 'isAgainst')" :test="getItem(item, 'test')" :metadata="getItem(item, 'metadata')" :flowdata="getItem(item, 'flowdata')" @@ -804,7 +805,7 @@ watch( :search_suggestions="getItem(item, 'search_suggestions')" :paramsList="getItem(item, 'paramsList')" :modeOptions="modeOptions" - @commont="handleCommont" + @comment ="handlecomment " @report="handleReport" @handleSendMessage="handleSendMessage" @clearSuggestion="clearSuggestion(index)" diff --git a/src/views/dialogue/components/ReportPopover.vue b/src/views/dialogue/components/ReportPopover.vue index a0941b6a..85627433 100644 --- a/src/views/dialogue/components/ReportPopover.vue +++ b/src/views/dialogue/components/ReportPopover.vue @@ -45,20 +45,17 @@ const descText = ref(''); const isErrorInputVisiable = computed(() => list.value[2].isChecked); const emits = defineEmits<{ - (e: 'report', reason: string): void; + (e: 'report', reason_type: string,reason: string): void; (e: 'close'): void; }>(); /** 举报 */ const handleComplaint = () => { - const str = descText.value.length - ? radio.value + ';' + descText.value - : radio.value; if (!isErrorInputVisiable.value) { - emits('report', str); + emits('report', radio.value, descText.value); return; } - emits('report', str); + emits('report', radio.value, descText.value); }; diff --git a/src/views/dialogue/types.ts b/src/views/dialogue/types.ts index 2789fff9..f0d40828 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 5fdce05ae78060c0d7135f76a7317e2b05314238 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 10:05:44 +0800 Subject: [PATCH 05/60] =?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 | 8 ++--- .../dialogue/components/DialogueSession.vue | 6 ++-- src/views/dialogue/types.ts | 12 ++++---- 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 75be08cb..5c703bac 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -121,37 +121,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; @@ -165,6 +140,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, @@ -177,7 +153,6 @@ export const comment = (params: { comment : comment, }); } - }; export const getRecognitionMode = (): Promise< @@ -280,5 +255,4 @@ export const sessionApi = { getUploadFiles, uploadFiles, deleteUploadedFile, - comment }; diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index cc4f27dc..af1ad6fe 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -101,7 +101,7 @@ 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, @@ -109,7 +109,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, @@ -156,7 +156,7 @@ const unbindDocumentClick = () => { // 举报功能 目前未实现 const handleReport = async (reason: string): Promise => { const qaRecordId = props.recordList[index.value]; - emits('report', qaRecordId, reason_type, reason); + emits('handleReport', qaRecordId, reason_type, reason); isAgainstVisible.value = false; }; @@ -199,7 +199,7 @@ const nextPageHandle = (cid: number) => { index.value = (props.isCommentList as number[]).length - 1; } else { index.value++; - // handleIsLike(); + handleIsLike(); } }; diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index 8be28725..4ecdd68c 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -263,7 +263,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')); } @@ -805,8 +805,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 f0d40828..b8f26eb4 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 327d819c2e082ada80c6d4b6cfc8d7dd1e8fa7d0 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 10:13:31 +0800 Subject: [PATCH 06/60] =?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 --- .../dialoguePanel/DialoguePanel.vue | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index af1ad6fe..da262b07 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -141,6 +141,64 @@ const handlePauseAndReGenerate = (cid?: number) => { // #endregion +// 复制 +const handleCopy = (): void => { + if (!props.content || !Array.isArray(props.content)) { + errorMsg(i18n.global.t('feedback.copied_failed')); + return; + } + writeText(props.content[props.currentSelected]); + successMsg(i18n.global.t('feedback.copied_successfully')); + return; +}; +/** + * 赞同与反对 + */ +const handleLike = async ( + type: 'liked' | 'disliked' | 'report', +): Promise => { + if (type === 'liked') { + const qaRecordId = props.recordList[index.value]; + 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 { + isReportVisible.value = true; + } +}; + +/** + * 反对 + * @param reason + * @param reasionLink + * @param reasonDescription + */ +const handleDislike = async ( + reason: string, + reasionLink?: string, + reasonDescription?: string, +): Promise => { + const qaRecordId = props.recordList[index.value]; + emits( + 'handleComment', + !isAgainst.value ? 'disliked' : 'none', + props.cid, + qaRecordId, + index.value, + props.groupId, + reason, + reasionLink, + reasonDescription, + ).then((res) => { + isAgainstVisible.value = false; + isComment.value[index.value] = 'disliked'; + handleIsLike(); + }); +}; + const handleOutsideClick = () => { isAgainstVisible.value = false; }; -- Gitee From 8901f2b5a2bbae8cbf4b0e20cbdcf091d8d99bf1 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 10:54:31 +0800 Subject: [PATCH 07/60] =?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 | 25 +++++---- .../dialoguePanel/DialoguePanel.vue | 53 ++++++++++--------- src/store/conversation.ts | 4 +- .../createapp/components/workFlowDebug.vue | 1 - .../dialogue/components/DialogueSession.vue | 39 -------------- 5 files changed, 45 insertions(+), 77 deletions(-) diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 5c703bac..f7998279 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -129,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, @@ -146,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 da262b07..bdfe08aa 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -70,6 +70,7 @@ export interface DialoguePanelProps { import JsonFormComponent from './JsonFormComponent.vue'; import { Metadata } from 'src/apis/paths/type'; import DialogueFlow from './DialogueFlow.vue'; +import { api } from 'src/apis'; var option = ref(); var show = ref(false); const size = reactive({ @@ -100,15 +101,6 @@ const { thoughtContent, contentAfterMark } = useMarkdownParser( const index = ref(0); const isComment = ref(props.isCommentList); const emits = defineEmits<{ - ( - e: 'handleComment', - type: 'liked' | 'disliked' | 'none', - qaRecordId: string, - groupId: string | undefined, - reason?: string, - reasion_link?: string, - reason_description?: string, - ): void; (e: 'handleReport', qaRecordId: string, reason?: string): void; ( e: 'handleSendMessage', @@ -159,10 +151,17 @@ const handleLike = async ( ): Promise => { if (type === 'liked') { const qaRecordId = props.recordList[index.value]; - emits('handleComment',!isSupport.value ? 'liked' : 'none', props.cid,qaRecordId,index.value,props.groupId).then((res) => { - isComment.value[index.value] = 'liked'; - handleIsLike(); - }); + await api.commentConversation({ + type: !isSupport.value ? 'liked' : 'none', + qaRecordId: qaRecordId, + comment: !isSupport.value ? 'liked' : 'none', + groupId: props.groupId, + }).then((res) => { + if(res[0].status === 200){ + isComment.value[index.value] = 'liked'; + handleIsLike(); + } + }) } else if (type === 'disliked') { isAgainstVisible.value = true; } else { @@ -182,20 +181,22 @@ const handleDislike = async ( reasonDescription?: string, ): Promise => { const qaRecordId = props.recordList[index.value]; - emits( - 'handleComment', - !isAgainst.value ? 'disliked' : 'none', - props.cid, - qaRecordId, - index.value, - props.groupId, - reason, - reasionLink, - reasonDescription, + await api.commentConversation( + { + type: 'disliked', + qaRecordId: qaRecordId, + comment: reason, + groupId: props.groupId, + reasonLink: reasionLink, + reasonDescription: reasonDescription, + } ).then((res) => { - isAgainstVisible.value = false; - isComment.value[index.value] = 'disliked'; - handleIsLike(); + if(res[0].status === 200){ + console.log('handleDislike'); + isAgainstVisible.value = false; + isComment.value[index.value] = 'disliked'; + handleIsLike(); + }; }); }; diff --git a/src/store/conversation.ts b/src/store/conversation.ts index a1963928..89ace555 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -741,7 +741,7 @@ export const useSessionStore = defineStore('conversation', () => { record.content.answer, record.id, // is_like字段改为 comment = "liked", "disliked", "none" - record.comment + record.comment, ); if (re?.currentInd !== undefined) { re.currentInd = re.currentInd + 1; @@ -754,7 +754,7 @@ export const useSessionStore = defineStore('conversation', () => { record.content.answer, record.id, // is_like字段改为 comment = "liked", "disliked", "none" - record.comment + record.comment, ); conversationList.value.unshift( { diff --git a/src/views/createapp/components/workFlowDebug.vue b/src/views/createapp/components/workFlowDebug.vue index 8447e5c3..4c3628b3 100644 --- a/src/views/createapp/components/workFlowDebug.vue +++ b/src/views/createapp/components/workFlowDebug.vue @@ -26,7 +26,6 @@ :search_suggestions="getItem(item, 'search_suggestions')" :paramsList="getItem(item, 'paramsList')" :isWorkFlowDebug="true" - @comment ="handlecomment " @report="handleReport" @handleSendMessage="handleSendMessage" @clearSuggestion="clearSuggestion(index)" diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index 4ecdd68c..5a134fac 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -231,44 +231,6 @@ const getItem = (item: ConversationItem, field: string): T | undefined => { // textarea实例 const inputRef = ref(null); -/** - * 支持、反对 更改逻辑的钩子函数。 - * @param type - * @param cid - */ -const handlecomment = async ( - type: 'liked' | 'disliked' | 'none', - cid: number, - qaRecordId: number, - index: number, - groupId: string | undefined, - reason?: string, - reasonLink?: string, - reasonDescription?: string, -) => { - const params: { - type: 'liked' | 'disliked' | 'none'; - qaRecordId: string; - comment: string; - dislikeReason?: string; - reasonLink?: string; - reasonDescription?: string; - groupId: string | undefined; - } = { - type, - qaRecordId: qaRecordId, - comment: type, - dislikeReason: reason, - reasonLink: reasonLink, - reasonDescription: reasonDescription, - groupId: groupId, - }; - const [_, res] = await api.commentConversation(params); - if (!_ && res) { - successMsg(i18n.global.t('feedback.feedbackSuccesful')); - } -}; - /** * 举报逻辑的钩子函数。 * @param type @@ -805,7 +767,6 @@ watch( :search_suggestions="getItem(item, 'search_suggestions')" :paramsList="getItem(item, 'paramsList')" :modeOptions="modeOptions" - @handleComment ="handlecomment " @handleReport="handleReport" @handleSendMessage="handleSendMessage" @clearSuggestion="clearSuggestion(index)" -- Gitee From a405482232c0d4dabe766ac650d3ab00d2760d7f Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 14:49:12 +0800 Subject: [PATCH 08/60] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=89=8D=E5=85=88=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/createapp/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/createapp/index.vue b/src/views/createapp/index.vue index 4ab7504d..1c857182 100644 --- a/src/views/createapp/index.vue +++ b/src/views/createapp/index.vue @@ -42,7 +42,8 @@ onUnmounted(() => { // 需要界面配置校验与工作流校验同时通过 const handlePulishApp = () => { loading.value = true; - // 发布接口 + // 发布接口前,先保存界面配置与工作流 + saveConfigOrFlow(); api .releaseSingleAppData({ id: route.query?.appId as string, -- Gitee From abe94579a48590468f701ffeb877519601b6088f Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 15:41:57 +0800 Subject: [PATCH 09/60] =?UTF-8?q?=E6=8F=90=E5=87=BA=E5=85=AC=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E4=BF=9D=E5=AD=98=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E4=BE=9B=E4=BF=9D=E5=AD=98=E5=92=8C=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialoguePanel/DialoguePanel.vue | 1 - src/views/createapp/components/workFlow.vue | 1 - src/views/createapp/index.vue | 29 ++++++++++++++----- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index bdfe08aa..91ea2dda 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -192,7 +192,6 @@ const handleDislike = async ( } ).then((res) => { if(res[0].status === 200){ - console.log('handleDislike'); isAgainstVisible.value = false; isComment.value[index.value] = 'disliked'; handleIsLike(); diff --git a/src/views/createapp/components/workFlow.vue b/src/views/createapp/components/workFlow.vue index aab31aa4..879cbee0 100644 --- a/src/views/createapp/components/workFlow.vue +++ b/src/views/createapp/components/workFlow.vue @@ -908,7 +908,6 @@ defineExpose({ >
{ }); // 需要界面配置校验与工作流校验同时通过 -const handlePulishApp = () => { - loading.value = true; +const handlePulishApp = async() => { // 发布接口前,先保存界面配置与工作流 - saveConfigOrFlow(); - api + await handleCreateOrUpdateApp().then((res) => { + api .releaseSingleAppData({ id: route.query?.appId as string, }) @@ -55,6 +54,10 @@ const handlePulishApp = () => { loading.value = false; } }); + }).catch((error) => { + ElMessage.error(`发布失败: ${error.message}`); + }) + ; }; const handleValidateContent = (valid) => { @@ -92,10 +95,9 @@ const judgeAppFlowsDebug = (flowDataList) => { // 初始化时,获取发布的校验结果---必须有工作流且所有工作流必须debug通过 publishValidate.value = flowDataList?.length > 0 && flowsDebug; }; - -// 保存按钮 -const saveConfigOrFlow = () => { - if (createAppType.value === 'appConfig') { +// 保存功能 +const handleCreateOrUpdateApp = (): Promise => { + return new Promise((resolve, reject) => { loading.value = true; let appFormValue = appConfigRef.value.createAppForm; if (appFormValue) { @@ -123,8 +125,19 @@ const saveConfigOrFlow = () => { }); } loading.value = false; + resolve(); }); + }else{ + loading.value = false; + reject(); } + }) +} + +// 保存按钮处理方法 +const saveConfigOrFlow = async () => { + if (createAppType.value === 'appConfig') { + await handleCreateOrUpdateApp(); } else { // 工作流页面保存当前的工作流 workFlowRef.value.saveFlow(); -- Gitee From 6d4333e2ab090edebf4e74872a9751ba64d090f3 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 16:07:10 +0800 Subject: [PATCH 10/60] =?UTF-8?q?=E4=BF=AE=E6=94=B9chat=E6=8E=A5=E5=8F=A3S?= =?UTF-8?q?uggestion'=E5=8F=98=E9=87=8F=E5=91=BD=E5=90=8D=E4=B8=BA?= =?UTF-8?q?=E9=A9=BC=E5=B3=B0=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/paths/type.ts | 4 ++-- src/components/dialoguePanel/DialoguePanel.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts index 7a2d7ea4..598f0fc0 100644 --- a/src/apis/paths/type.ts +++ b/src/apis/paths/type.ts @@ -71,10 +71,10 @@ export interface ConversationRecordList { * "flow_description": "查询机器192.168.10.1的CVE信息", //推荐项关联的工作流描述,若不关联则为空 * "question": "查询机器192.168.10.1的CVE信息", //推荐问题的内容 */ -export interface Suggest { +export interface Suggestion { appId: string; flowId: string; - flow_description: string; + flowDescription: string; question: string; } diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 91ea2dda..44191600 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -15,7 +15,7 @@ import color from 'src/assets/color'; import { storeToRefs } from 'pinia'; import { useLangStore, useChangeThemeStore, useSessionStore } from '@/store'; const { user_selected_app } = storeToRefs(useHistorySessionStore()); -import { Suggest } from 'src/apis/paths/type'; +import { Suggestion } from 'src/apis/paths/type'; const { params } = storeToRefs(useHistorySessionStore()); const { language } = storeToRefs(useLangStore()); const echartsDraw = ref(); @@ -322,7 +322,7 @@ const zoom_out = () => { answer_zoom.value = false; }; -const selectQuestion = (item: Suggest) => { +const selectQuestion = (item: Suggestion) => { let question = item.question; let user_selected_flow = item.flowId; if (user_selected_flow) { -- Gitee From 7b76bae7e8f5d25ad1fb13339483053229291d6a Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 16:17:14 +0800 Subject: [PATCH 11/60] =?UTF-8?q?=E4=BF=AE=E6=94=B9chat=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/conversation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/conversation.ts b/src/store/conversation.ts index 89ace555..fa9cbd77 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -300,7 +300,7 @@ export const useSessionStore = defineStore('conversation', () => { ...conversationItem.files, message.content, ]; - } else if (message['event'] === 'suggest') { + } else if (message['event'] === 'Suggestion') { if (conversationItem.search_suggestions) { conversationItem.search_suggestions.push( Object(message.content), -- Gitee From 0d3bf0a9a8ed58cd4591376c6903671a0b336537 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 16:53:21 +0800 Subject: [PATCH 12/60] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=20Su?= =?UTF-8?q?ggestion=20=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/paths/type.ts | 2 +- src/components/dialoguePanel/DialoguePanel.vue | 4 ++-- src/views/dialogue/types.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts index 598f0fc0..7dc6443d 100644 --- a/src/apis/paths/type.ts +++ b/src/apis/paths/type.ts @@ -72,7 +72,7 @@ export interface ConversationRecordList { * "question": "查询机器192.168.10.1的CVE信息", //推荐问题的内容 */ export interface Suggestion { - appId: string; + flowName: string; flowId: string; flowDescription: string; question: string; diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 44191600..a31ae8ee 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -628,8 +628,8 @@ const searchAppName = (appId) => {
  • -

    - #{{ searchAppName(item.appId) }} +

    + #{{ searchAppName(item.flowName) }}

    {{ item.question }}
    diff --git a/src/views/dialogue/types.ts b/src/views/dialogue/types.ts index b8f26eb4..c7052d34 100644 --- a/src/views/dialogue/types.ts +++ b/src/views/dialogue/types.ts @@ -11,7 +11,7 @@ import type { UserDialoguePanelType, RobotDialoguePanelType, } from 'src/components/dialoguePanel/type'; -import { Metadata } from 'src/apis/paths/type'; +import { Metadata, Suggestion } from 'src/apis/paths/type'; // 工具类型 export type LinkType = 'redirect' | 'action'; @@ -94,7 +94,7 @@ export interface RobotConversationItem { isAgainst?: boolean; createdAt?: string | Date; groupId: string | undefined; - search_suggestions?: string[]; + search_suggestions?: Suggestion[]; echartsObj?: any; metadata?: undefined | Metadata; flowdata?: FlowType | undefined; -- Gitee From 70959212c47d199f823cded239970674ebbba5c2 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Sat, 19 Apr 2025 17:28:26 +0800 Subject: [PATCH 13/60] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=B1=95=E7=A4=BA=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dialoguePanel/DialoguePanel.vue | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index a31ae8ee..a90f7ae6 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -359,14 +359,6 @@ const chatWithParams = async () => { ); }; -const searchAppName = (appId) => { - for (let item in props.modeOptions) { - if (props.modeOptions[item].value == appId) { - return props.modeOptions[item].label; - } - } - return ''; -};