fix: frontend bug

This commit is contained in:
fdc
2025-07-31 10:34:36 +08:00
parent 5560a4f52d
commit cb88da7f02
2 changed files with 19 additions and 20 deletions
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef, useCallback } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { httpClient } from '@/app/infra/http/HttpClient'; import { httpClient } from '@/app/infra/http/HttpClient';
import { DialogContent } from '@/components/ui/dialog'; import { DialogContent } from '@/components/ui/dialog';
@@ -46,7 +46,7 @@ export default function DebugDialog({
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }); messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
}; };
const loadMessages = async (pipelineId: string) => { const loadMessages = useCallback(async (pipelineId: string) => {
try { try {
const response = await httpClient.getWebChatHistoryMessages( const response = await httpClient.getWebChatHistoryMessages(
pipelineId, pipelineId,
@@ -56,7 +56,7 @@ export default function DebugDialog({
} catch (error) { } catch (error) {
console.error('Failed to load messages:', error); console.error('Failed to load messages:', error);
} }
}; }, [sessionType]);
useEffect(() => { useEffect(() => {
scrollToBottom(); scrollToBottom();
@@ -214,7 +214,7 @@ export default function DebugDialog({
content: accumulatedContent, content: accumulatedContent,
message_chain: [ message_chain: [
{ type: 'Plain', text: accumulatedContent }, { type: 'Plain', text: accumulatedContent },
] ],
}; };
updatedMessages[botMessageIndex] = updatedBotMessage; updatedMessages[botMessageIndex] = updatedBotMessage;
} }
-1
View File
@@ -35,7 +35,6 @@ import {
import { GetBotLogsRequest } from '@/app/infra/http/requestParam/bots/GetBotLogsRequest'; import { GetBotLogsRequest } from '@/app/infra/http/requestParam/bots/GetBotLogsRequest';
import { GetBotLogsResponse } from '@/app/infra/http/requestParam/bots/GetBotLogsResponse'; import { GetBotLogsResponse } from '@/app/infra/http/requestParam/bots/GetBotLogsResponse';
type JSONValue = string | number | boolean | JSONObject | JSONArray | null; type JSONValue = string | number | boolean | JSONObject | JSONArray | null;
interface JSONObject { interface JSONObject {
[key: string]: JSONValue; [key: string]: JSONValue;