From 4bb2ccfba7a2d7997ae6222bb564308e22132bc9 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Wed, 18 Mar 2026 14:36:23 +0800 Subject: [PATCH] fix(web): app bugfix --- web/src/utils/stream.ts | 20 ++++++++++++------- .../views/ApplicationConfig/ReleasePage.tsx | 5 +++-- .../ApplicationConfig/TestChat/index.tsx | 8 ++++++-- .../views/Workflow/components/Chat/Chat.tsx | 6 +++--- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/web/src/utils/stream.ts b/web/src/utils/stream.ts index 846af9f7..ba966159 100644 --- a/web/src/utils/stream.ts +++ b/web/src/utils/stream.ts @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-02 16:35:43 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-04 18:19:24 + * @Last Modified time: 2026-03-18 14:32:40 */ /** * Server-Sent Events (SSE) Stream Utility Module @@ -176,17 +176,23 @@ export const handleSSE = async (url: string, data: any, onMessage?: (data: SSEMe case 500: case 502: const errorData = await response.json(); - let errorInfo = errorData.error || i18n.t('common.serviceUpgrading') + const errorInfo = errorData.error || i18n.t('common.serviceUpgrading'); message.warning(errorInfo); - throw errorInfo; + throw new Error(errorData); case 400: const error = await response.json(); - message.warning(error.error); - throw error.error || 'Bad Request'; + const error400 = error.error || 'Bad Request'; + message.warning(error400); + throw new Error(error); + case 403: + const errors = await response.json(); + message.warning(i18n.t('common.permissionDenied')); + throw new Error(errors); case 504: const errorJson = await response.json(); - message.warning(errorJson.error || i18n.t('common.serverError')); - throw errorData.error; + const errorMsg = errorJson.error || i18n.t('common.serverError'); + message.warning(errorMsg); + throw new Error(errorJson); case 401: if (url?.includes('/public')) { return message.warning(i18n.t('common.publicApiCannotRefreshToken')); diff --git a/web/src/views/ApplicationConfig/ReleasePage.tsx b/web/src/views/ApplicationConfig/ReleasePage.tsx index ab9225f6..efa62578 100644 --- a/web/src/views/ApplicationConfig/ReleasePage.tsx +++ b/web/src/views/ApplicationConfig/ReleasePage.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 16:29:41 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-11 17:44:24 + * @Last Modified time: 2026-03-18 14:30:41 */ import { type FC, useState, useEffect, useRef } from 'react'; import { useTranslation } from 'react-i18next'; @@ -70,7 +70,8 @@ const ReleasePage: FC<{data: Application; refresh: () => void}> = ({data, refres }) } const handleExport = () => { - appExport(data.id, data.name) + if (!selectedVersion) return + appExport(data.id, data.name, {release_version: selectedVersion.id}) } return (
diff --git a/web/src/views/ApplicationConfig/TestChat/index.tsx b/web/src/views/ApplicationConfig/TestChat/index.tsx index bb37c5a8..b7ce167e 100644 --- a/web/src/views/ApplicationConfig/TestChat/index.tsx +++ b/web/src/views/ApplicationConfig/TestChat/index.tsx @@ -193,7 +193,10 @@ const TestChat: FC = ({ formatParams(message, conversationId, files, params), handleStreamMessage ) - .catch(() => setLoading(false)) + .catch(() => { + updateErrorAssistantMessage(0) + setLoading(false) + }) .finally(() => { setLoading(false) setStreamLoading(false) @@ -243,11 +246,12 @@ const TestChat: FC = ({ handleWorkflowStreamMessage ) .catch((error) => { + const errorInfo = JSON.parse(error.message) setChatList(prev => { const newList = [...prev] const lastIndex = newList.length - 1 if (lastIndex >= 0) { - newList[lastIndex] = { ...newList[lastIndex], status: 'failed', content: null, subContent: error.error } + newList[lastIndex] = { ...newList[lastIndex], status: 'failed', content: null, subContent: errorInfo.error } } return newList }) diff --git a/web/src/views/Workflow/components/Chat/Chat.tsx b/web/src/views/Workflow/components/Chat/Chat.tsx index 8e744d6a..37cb215e 100644 --- a/web/src/views/Workflow/components/Chat/Chat.tsx +++ b/web/src/views/Workflow/components/Chat/Chat.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-06 21:10:56 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-17 15:05:21 + * @Last Modified time: 2026-03-18 14:34:20 */ /** * Workflow Chat Component @@ -359,7 +359,7 @@ const Chat = forwardRef { - console.log('draftRun error', error) + const errorInfo = JSON.parse(error.message) setChatList(prev => { const newList = [...prev] const lastIndex = newList.length - 1 @@ -368,7 +368,7 @@ const Chat = forwardRef