From 095f4e3001529862e0bf2f9e074a3c5b1d3df619 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Mon, 13 Apr 2026 18:33:45 +0800 Subject: [PATCH 1/2] feat(web): app import and Overwrite --- web/src/i18n/en.ts | 2 ++ web/src/i18n/zh.ts | 2 ++ .../components/ConfigHeader.tsx | 18 ++++++++++--- .../components/UploadModal.tsx | 27 ++++++++++++------- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index c878476b..fc3a041d 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -1522,6 +1522,8 @@ export const en = { "version":"app_release_id" // string, optional, application version ID; specify a historical release version ID, or omit to use the currently active version; }`, + uploadCover: 'Import and Overwrite', + refresh: 'Refresh Current Page', }, userMemory: { userMemory: 'User Memory', diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts index da80fed2..01c766b8 100644 --- a/web/src/i18n/zh.ts +++ b/web/src/i18n/zh.ts @@ -857,6 +857,8 @@ export const zh = { "version":"app_release_id" //string,可选,应用版本ID;指定历史发布版本ID,不传则使用当前生效版本; }`, + uploadCover: '导入并覆盖', + refresh: '刷新当前页', }, table: { totalRecords: '共 {{total}} 条记录' diff --git a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx index d38a657a..a3a9bd7b 100644 --- a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx +++ b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 16:27:52 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-04-07 16:28:33 + * @Last Modified time: 2026-04-13 18:19:27 */ import { type FC, useRef, useMemo } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; @@ -12,13 +12,14 @@ import { useTranslation } from 'react-i18next'; import clsx from 'clsx'; import styles from '../index.module.css' -import type { Application, ApplicationModalRef } from '@/views/ApplicationManagement/types'; +import type { Application, ApplicationModalRef, UploadWorkflowModalRef } from '@/views/ApplicationManagement/types'; import ApplicationModal from '@/views/ApplicationManagement/components/ApplicationModal' import type { CopyModalRef, AgentRef, ClusterRef, WorkflowRef, FeaturesConfigForm } from '../types' import { deleteApplication, appExport } from '@/api/application' import CopyModal from './CopyModal' import PageHeader from '@/components/Layout/PageHeader' import CheckList from '@/views/Workflow/components/CheckList' +import UploadModal from '@/views/ApplicationManagement/components/UploadModal' /** * Tab keys for application configuration @@ -77,6 +78,7 @@ const ConfigHeader: FC = ({ const { id, source } = useParams(); const applicationModalRef = useRef(null); const copyModalRef = useRef(null); + const uploadModalRef = useRef(null); /** * Format tab items for display @@ -111,6 +113,9 @@ const ConfigHeader: FC = ({ case 'delete': handleDelete() break; + case 'uploadCover': + uploadModalRef.current?.handleOpen() + break } } /** @@ -165,11 +170,11 @@ const ConfigHeader: FC = ({ * Format dropdown menu items */ const formatMenuItems = useMemo(() => { - const items = (application?.type !== 'multi_agent' ? ['edit', 'copy', 'export', 'delete'] : ['edit', 'copy', 'delete']).map(key => ({ + const items = (application?.type !== 'multi_agent' ? ['edit', 'copy', 'export', 'uploadCover', 'delete'] : ['edit', 'copy', 'delete']).map(key => ({ key, icon:
, danger: key === 'delete', - label: t(`common.${key}`), + label: key === 'uploadCover' ? t('application.uploadCover') : t(`common.${key}`), })) return items }, [t, handleClick, application]) @@ -261,6 +266,11 @@ const ConfigHeader: FC = ({ refresh={refresh} /> + ); }; diff --git a/web/src/views/ApplicationManagement/components/UploadModal.tsx b/web/src/views/ApplicationManagement/components/UploadModal.tsx index a7acc093..4211e72b 100644 --- a/web/src/views/ApplicationManagement/components/UploadModal.tsx +++ b/web/src/views/ApplicationManagement/components/UploadModal.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-28 14:08:14 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-12 17:19:46 + * @Last Modified time: 2026-04-13 18:17:32 */ /** * UploadModal Component @@ -28,6 +28,7 @@ import { appImport } from '@/api/application' interface UploadModalProps { /** Function to refresh the parent component after workflow import */ refresh: () => void; + id?: string; } @@ -46,10 +47,11 @@ const steps = [ * @param {React.Ref} ref - Ref for imperative methods */ const UploadModal = forwardRef(({ - refresh + refresh, + id }, ref) => { const { t } = useTranslation(); - + // State management const [visible, setVisible] = useState(false); // Modal visibility const [form] = Form.useForm<{ file: File[] }>(); // Form instance @@ -87,8 +89,8 @@ const UploadModal = forwardRef(({ */ const handleSave = () => { const values = form.getFieldsValue(); - - switch(current) { + + switch (current) { case 0: // Step 1: Upload file if (!values.file || values.file.length === 0) { message.warning(t('application.pleaseUploadFile')); @@ -96,6 +98,9 @@ const UploadModal = forwardRef(({ } const formData = new FormData(); formData.append('file', values.file[0]); + if (id) { + formData.append('app_id', id) + } setLoading(true) // Call import API @@ -134,8 +139,12 @@ const UploadModal = forwardRef(({ setTimeout(() => { switch (type) { case 'detail': - // Open application detail page in new tab - window.open(`/#/application/config/${appId}`, '_blank'); + if (id) { + window.location.reload(); + } else { + // Open application detail page in new tab + window.open(`/#/application/config/${appId}`, '_blank'); + } break; } }, 100) @@ -171,7 +180,7 @@ const UploadModal = forwardRef(({ loading={loading} onClick={() => handleJump('detail')} > - {t('application.gotoDetail')} + {id ? t('application.refresh') : t('application.gotoDetail')} ] default: @@ -244,7 +253,7 @@ const UploadModal = forwardRef(({ loading={loading} onClick={() => handleJump('detail')} > - {t('application.gotoDetail')} + {id ? t('application.refresh') : t('application.gotoDetail')} ]} /> From 9032f50a1988dee1a9a6374292d81dfd30303f94 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Tue, 14 Apr 2026 10:20:50 +0800 Subject: [PATCH 2/2] feat(web): chat add file info --- web/src/components/Chat/ChatContent.tsx | 5 +++-- web/src/views/Conversation/index.tsx | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/web/src/components/Chat/ChatContent.tsx b/web/src/components/Chat/ChatContent.tsx index 5c722e45..f28b5dce 100644 --- a/web/src/components/Chat/ChatContent.tsx +++ b/web/src/components/Chat/ChatContent.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2025-12-10 16:46:17 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-04-10 18:46:57 + * @Last Modified time: 2026-04-14 10:13:56 */ import { type FC, useRef, useEffect, useState } from 'react' import clsx from 'clsx' @@ -174,6 +174,7 @@ const ChatContent: FC = ({ ) } + const documentType = (file.file_type || file.type)?.split('/') return ( = ({ >
{file.name}
-
{file.type?.split('/')[file.type?.split('/').length - 1]} · {file.size}
+
{documentType?.[documentType.length - 1]} · {file.size}
) diff --git a/web/src/views/Conversation/index.tsx b/web/src/views/Conversation/index.tsx index 8432b1c2..778279d3 100644 --- a/web/src/views/Conversation/index.tsx +++ b/web/src/views/Conversation/index.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 16:58:03 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-04-07 21:21:52 + * @Last Modified time: 2026-04-13 18:32:58 */ /** * Conversation Page @@ -397,7 +397,10 @@ const Conversation: FC = () => { return { type: file.type, transfer_method: 'local_file', - upload_file_id: file.response.data.file_id + upload_file_id: file.response.data.file_id, + file_type: file.response.data.file_type, + size: file.response.data.file_size, + name: file.response.data.file_name } } }), @@ -444,7 +447,7 @@ const Conversation: FC = () => { }) } - console.log('chatList', chatList, streamLoadingRef.current) + console.log('chatList', fileList, streamLoadingRef.current) return (