fix(web): app bugfix
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-02 16:35:43
|
* @Date: 2026-02-02 16:35:43
|
||||||
* @Last Modified by: ZhaoYing
|
* @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
|
* 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 500:
|
||||||
case 502:
|
case 502:
|
||||||
const errorData = await response.json();
|
const errorData = await response.json();
|
||||||
let errorInfo = errorData.error || i18n.t('common.serviceUpgrading')
|
const errorInfo = errorData.error || i18n.t('common.serviceUpgrading');
|
||||||
message.warning(errorInfo);
|
message.warning(errorInfo);
|
||||||
throw errorInfo;
|
throw new Error(errorData);
|
||||||
case 400:
|
case 400:
|
||||||
const error = await response.json();
|
const error = await response.json();
|
||||||
message.warning(error.error);
|
const error400 = error.error || 'Bad Request';
|
||||||
throw 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:
|
case 504:
|
||||||
const errorJson = await response.json();
|
const errorJson = await response.json();
|
||||||
message.warning(errorJson.error || i18n.t('common.serverError'));
|
const errorMsg = errorJson.error || i18n.t('common.serverError');
|
||||||
throw errorData.error;
|
message.warning(errorMsg);
|
||||||
|
throw new Error(errorJson);
|
||||||
case 401:
|
case 401:
|
||||||
if (url?.includes('/public')) {
|
if (url?.includes('/public')) {
|
||||||
return message.warning(i18n.t('common.publicApiCannotRefreshToken'));
|
return message.warning(i18n.t('common.publicApiCannotRefreshToken'));
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 16:29:41
|
* @Date: 2026-02-03 16:29:41
|
||||||
* @Last Modified by: ZhaoYing
|
* @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 { type FC, useState, useEffect, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -70,7 +70,8 @@ const ReleasePage: FC<{data: Application; refresh: () => void}> = ({data, refres
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const handleExport = () => {
|
const handleExport = () => {
|
||||||
appExport(data.id, data.name)
|
if (!selectedVersion) return
|
||||||
|
appExport(data.id, data.name, {release_version: selectedVersion.id})
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="rb:flex rb:h-[calc(100vh-64px)]">
|
<div className="rb:flex rb:h-[calc(100vh-64px)]">
|
||||||
|
|||||||
@@ -193,7 +193,10 @@ const TestChat: FC<TestChatProps> = ({
|
|||||||
formatParams(message, conversationId, files, params),
|
formatParams(message, conversationId, files, params),
|
||||||
handleStreamMessage
|
handleStreamMessage
|
||||||
)
|
)
|
||||||
.catch(() => setLoading(false))
|
.catch(() => {
|
||||||
|
updateErrorAssistantMessage(0)
|
||||||
|
setLoading(false)
|
||||||
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
setStreamLoading(false)
|
setStreamLoading(false)
|
||||||
@@ -243,11 +246,12 @@ const TestChat: FC<TestChatProps> = ({
|
|||||||
handleWorkflowStreamMessage
|
handleWorkflowStreamMessage
|
||||||
)
|
)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
const errorInfo = JSON.parse(error.message)
|
||||||
setChatList(prev => {
|
setChatList(prev => {
|
||||||
const newList = [...prev]
|
const newList = [...prev]
|
||||||
const lastIndex = newList.length - 1
|
const lastIndex = newList.length - 1
|
||||||
if (lastIndex >= 0) {
|
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
|
return newList
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-06 21:10:56
|
* @Date: 2026-02-06 21:10:56
|
||||||
* @Last Modified by: ZhaoYing
|
* @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
|
* Workflow Chat Component
|
||||||
@@ -359,7 +359,7 @@ const Chat = forwardRef<ChatRef, { appId: string; graphRef: GraphRef; data: Work
|
|||||||
setStreamLoading(true)
|
setStreamLoading(true)
|
||||||
draftRun(appId, data, handleStreamMessage)
|
draftRun(appId, data, handleStreamMessage)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log('draftRun error', error)
|
const errorInfo = JSON.parse(error.message)
|
||||||
setChatList(prev => {
|
setChatList(prev => {
|
||||||
const newList = [...prev]
|
const newList = [...prev]
|
||||||
const lastIndex = newList.length - 1
|
const lastIndex = newList.length - 1
|
||||||
@@ -368,7 +368,7 @@ const Chat = forwardRef<ChatRef, { appId: string; graphRef: GraphRef; data: Work
|
|||||||
...newList[lastIndex],
|
...newList[lastIndex],
|
||||||
status: 'failed',
|
status: 'failed',
|
||||||
content: null,
|
content: null,
|
||||||
subContent: error.error
|
subContent: errorInfo.error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newList
|
return newList
|
||||||
|
|||||||
Reference in New Issue
Block a user