From 77950e48c76f4a3b29d01831d43039caba29888a Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期二, 18 十一月 2025 14:12:42 +0800
Subject: [PATCH] 修改
---
app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx | 39 ++++++++++++++++++---------------------
1 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx b/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx
index 8f45bc5..9285516 100644
--- a/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx
+++ b/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx
@@ -1,4 +1,11 @@
-import { memo, useCallback, useEffect, useImperativeHandle, useMemo } from 'react'
+import {
+ forwardRef,
+ memo,
+ useCallback,
+ useEffect,
+ useImperativeHandle,
+ useMemo,
+} from 'react'
import { useNodes } from 'reactflow'
import { BlockEnum } from '../../types'
import {
@@ -20,7 +27,6 @@
} from '@/service/debug'
import { useStore as useAppStore } from '@/app/components/app/store'
import { getLastAnswer, isValidGeneratedAnswer } from '@/app/components/base/chat/utils'
-import type { FileEntity } from '@/app/components/base/file-uploader/types'
type ChatWrapperProps = {
showConversationVariableModal: boolean
@@ -29,17 +35,12 @@
onHide: () => void
}
-const ChatWrapper = (
- {
- ref,
- showConversationVariableModal,
- onConversationModalHide,
- showInputsFieldsPanel,
- onHide,
- }: ChatWrapperProps & {
- ref: React.RefObject<ChatWrapperRefType>;
- },
-) => {
+const ChatWrapper = forwardRef<ChatWrapperRefType, ChatWrapperProps>(({
+ showConversationVariableModal,
+ onConversationModalHide,
+ showInputsFieldsPanel,
+ onHide,
+}, ref) => {
const nodes = useNodes<StartNodeType>()
const startNode = nodes.find(node => node.data.type === BlockEnum.Start)
const startVariables = startNode?.data.variables
@@ -95,14 +96,10 @@
)
}, [handleSend, workflowStore, conversationId, chatList, appDetail])
- const doRegenerate = useCallback((chatItem: ChatItemInTree, editedQuestion?: { message: string, files?: FileEntity[] }) => {
- const question = editedQuestion ? chatItem : chatList.find(item => item.id === chatItem.parentMessageId)!
+ const doRegenerate = useCallback((chatItem: ChatItemInTree) => {
+ const question = chatList.find(item => item.id === chatItem.parentMessageId)!
const parentAnswer = chatList.find(item => item.id === question.parentMessageId)
- doSend(editedQuestion ? editedQuestion.message : question.content,
- editedQuestion ? editedQuestion.files : question.message_files,
- true,
- isValidGeneratedAnswer(parentAnswer) ? parentAnswer : null,
- )
+ doSend(question.content, question.message_files, true, isValidGeneratedAnswer(parentAnswer) ? parentAnswer : null)
}, [chatList, doSend])
useImperativeHandle(ref, () => {
@@ -161,7 +158,7 @@
)}
</>
)
-}
+})
ChatWrapper.displayName = 'ChatWrapper'
--
Gitblit v1.8.0