From c6a2bf09f11421aa4ff7f8db301599882351cb78 Mon Sep 17 00:00:00 2001 From: zhangyahui Date: Wed, 25 Mar 2026 16:58:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E8=AF=9D=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lang/en.ts | 38 +++++++++++++---------- src/lang/zh-cn.ts | 9 +++--- src/views/home/agent/components/Agent.vue | 28 +++++++++++++---- src/views/home/agent/components/Item.vue | 18 +++++------ src/views/home/left-nav.vue | 21 +++++++++++-- 5 files changed, 75 insertions(+), 39 deletions(-) diff --git a/src/lang/en.ts b/src/lang/en.ts index 0db9570..31f6a52 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -36,7 +36,7 @@ export default { wechatLogin: 'Sign in with Wechat', indexTip: 'A multi-agent canvas for rapid, trend driven design iteration.', sendCodeError: 'Send code error', - retrievePassword: 'Retrieve password', + retrievePassword: 'Retrieve password' }, Nuic: { hiName: 'Hi, {name}. This is Fiphant.', @@ -51,7 +51,7 @@ export default { basedIn: 'Based in', role: 'Role', allSet: 'All set!', - loadingTip: 'We’re customizing your dashboard.', + loadingTip: 'We’re customizing your dashboard.' }, Home: { creditsNum: 'Credits: {num}', @@ -81,9 +81,9 @@ export default { userAgreement: 'User Agreement', privacyPolicy: 'Privacy Policy', view: 'View', - remainingNum: 'Remaining number of times to upload profile picture:', + remainingNum: 'Remaining number of times to upload profile picture:' }, - Country:{ + Country: { unitedStates: 'United States', singapore: 'Singapore', australia: 'Australia', @@ -93,17 +93,18 @@ export default { france: 'France', japan: 'Japan', canada: 'Canada', - germany: 'Germany', + germany: 'Germany' }, Role: { designer: 'Designer', student: 'Student', teacher: 'Teacher', parent: 'Parent', - other: 'Other', + other: 'Other' }, Input: { - placeholder: 'Describe the design you want to create... e.g. Modern wooden chair, Bauhaus style', + placeholder: + 'Describe the design you want to create... e.g. Modern wooden chair, Bauhaus style', selectPlaceholder: 'Please select', typePlaceholder: 'Type', areaPlaceholder: 'Region', @@ -146,11 +147,12 @@ export default { france: 'France', japan: 'Japan', canada: 'Canada', - germany: 'Germany', + germany: 'Germany' }, agent: { copySuccess: 'Text copied to clipboard', - copyFaild: 'Copy failed. Your browser may be restricting clipboard access. Please try copying manually.', + copyFaild: + 'Copy failed. Your browser may be restricting clipboard access. Please try copying manually.', Download: 'Download', deleteSuccess: 'Successfully deleted', thinking: 'Thinking...', @@ -158,6 +160,8 @@ export default { quote: 'Quote', delete: 'Delete', edit: 'Edit', + generatingReport: + 'We are generating your report. This may take a few minutes, but you can continue with other tasks while it’s being generated.' }, // Version Tree @@ -172,13 +176,13 @@ export default { restore: 'Restore', newChat: 'New Chat', delete: 'Delete', - deleteChat:'Delete chat?', - deleteHint:'Once deleted, you won’t be able to view this conversation again.', - restoreChat:'Restore chat?', - restoreHint:'Once deleted, you won’t be able to view this conversation again.', + deleteChat: 'Delete chat?', + deleteHint: 'Once deleted, you won’t be able to view this conversation again.', + restoreChat: 'Restore chat?', + restoreHint: 'Once deleted, you won’t be able to view this conversation again.', Cancel: 'Cancel', Confirm: 'Confirm', - export: 'Export', + export: 'Export' }, flowCanvas: { deleteCardConfirm: 'Are you sure you want to delete this function card?', @@ -187,14 +191,14 @@ export default { confirmLeave: 'Are you sure you want to leave? You may have unsaved changes.', cannotFindSuperiorImage: 'Cannot find the superior image', deleteSubordinateCard: 'After deletion, all the function cards will also be deleted.', - initialNodeProhibited: 'Initial node is prohibited from being deleted.', + initialNodeProhibited: 'Initial node is prohibited from being deleted.' }, assistant: { - inputPlaceholder: 'Ask anything', + inputPlaceholder: 'Ask anything' }, //3d面板 threeModel: { loading: 'Loading', - download: 'Download', + download: 'Download' } } diff --git a/src/lang/zh-cn.ts b/src/lang/zh-cn.ts index 44e444c..e7e33e4 100644 --- a/src/lang/zh-cn.ts +++ b/src/lang/zh-cn.ts @@ -82,7 +82,7 @@ export default { userAgreement: '用户协议', privacyPolicy: '隐私政策', view: '查看', - remainingNum: '剩余上传头像次数:', + remainingNum: '剩余上传头像次数:' }, Country: { unitedStates: '美国', @@ -148,11 +148,12 @@ export default { '复制失败。您的浏览器可能限制了剪贴板访问,请允许浏览器访问剪贴板或尝试手动复制。', Download: '下载', deleteSuccess: '删除成功', - thinking:'已思考', + thinking: '已思考', thinkComplete: '思考完成。', quote: '引用', delete: '删除', edit: '编辑', + generatingReport:'正在为您生成报告,可能需要几分钟时间,生成期间你可以继续进行其他任务' }, // Version Tree @@ -173,7 +174,7 @@ export default { restoreHint: '恢复后将显示该对话。', Cancel: '取消', Confirm: '确认', - export: '导出', + export: '导出' }, //generateSketch generateSketch: { @@ -187,7 +188,7 @@ export default { cancel: '取消', confirmLeave: '您可能有未保存的更改,确定要离开吗?', cannotFindSuperiorImage: '找不到上级图片', - initialNodeProhibited: 'Initial node is prohibited from being deleted.', + initialNodeProhibited: 'Initial node is prohibited from being deleted.' }, assistant: { inputPlaceholder: '请输入' diff --git a/src/views/home/agent/components/Agent.vue b/src/views/home/agent/components/Agent.vue index 8c5fedb..c248b5f 100644 --- a/src/views/home/agent/components/Agent.vue +++ b/src/views/home/agent/components/Agent.vue @@ -28,6 +28,9 @@ import type { AgentParamsType } from '@/api/agent' import { useUserInfoStore, useProjectStore, useAgentStore } from '@/stores' import MyEvent from '@/utils/myEvent' + import { useI18n } from 'vue-i18n' + + const { t } = useI18n() const userStore = useUserInfoStore() const agentStore = useAgentStore() @@ -267,6 +270,7 @@ hasReportEvent = true // contentBody += `` hasReportStarted = true + ElMessage.success(t('agent.generatingReport')) } if ( @@ -337,6 +341,7 @@ } if (jsonData.title) { emits('setTitle', jsonData.title) + MyEvent.emit('newTitle', jsonData.title) } if (hasSketch) { @@ -460,7 +465,13 @@ } // 处理对话列表,将连续的 assistant 消息合并为一条 - const processDialogue = (dialogue, startIndex, existingImgList, sessionId) => { + const processDialogue = ( + dialogue, + startIndex, + existingImgList, + sessionId, + firstReportIndex = -1 + ) => { if (!dialogue || dialogue.length === 0) return [] const result = [] @@ -495,6 +506,11 @@ j++ } + // 如果 firstReportIndex 在当前合并范围内,则把 slot 追加到末尾 + if (firstReportIndex >= i && firstReportIndex < j) { + combinedContent += `` + } + result.push({ ...item, content: combinedContent, @@ -525,13 +541,12 @@ const processSession = (session, imgList, ancestorsList, idCounterRef) => { if (!session) return - // 1. 在 dialogue 第一个 report 有值的项的 content 中插入报告卡片 + // 1. 找到第一个 report 项的索引,供 processDialogue 使用 + let firstReportIndex = -1 if (session.dialogue) { for (let i = 0; i < session.dialogue.length; i++) { if (session.dialogue[i].report) { - session.dialogue[i].content = - `123` + - (session.dialogue[i].content || '') + firstReportIndex = i break } } @@ -554,10 +569,11 @@ } // 4. 处理 dialogue - const list = processDialogue(session.dialogue, 0, imgList, session.id) + const list = processDialogue(session.dialogue, 0, imgList, session.id, firstReportIndex) list.forEach((el) => { el.id = idCounterRef.value++ }) + ancestorsList.push(...list) } diff --git a/src/views/home/agent/components/Item.vue b/src/views/home/agent/components/Item.vue index b892d75..6ea5d8e 100644 --- a/src/views/home/agent/components/Item.vue +++ b/src/views/home/agent/components/Item.vue @@ -5,7 +5,7 @@ :class="{ 'is-user': content.isUser, 'is-loading': content.loading }" >
- +
@@ -120,6 +120,9 @@ import type { CustomAttrs } from '@crazydos/vue-markdown' import rehypeRaw from 'rehype-raw' import MyEvent from '@/utils/myEvent' + import { useUserInfoStore } from '@/stores' + + const userStore = useUserInfoStore() const { t } = useI18n() @@ -128,16 +131,12 @@ isLast: Boolean }>() - // watch( - // () => props, - // (newVal) => { - // console.log('newVal-----', newVal) - // }, - // { immediate: true } - // ) - const emit = defineEmits(['regenerate']) + const userAvatar = computed(() => { + return userStore.state.userInfo?.avatar || userThumb + }) + const imageList = computed(() => { const { imageUrls, role } = props.content const list = [] @@ -340,6 +339,7 @@ .img-list { column-gap: 1rem; margin-bottom: 1.4rem; + justify-content: flex-end; .img-item { width: 6.8rem; height: 6.8rem; diff --git a/src/views/home/left-nav.vue b/src/views/home/left-nav.vue index 4278c53..9f47937 100644 --- a/src/views/home/left-nav.vue +++ b/src/views/home/left-nav.vue @@ -84,7 +84,7 @@ - +