diff --git a/web/containers/Providers/ModelHandler.tsx b/web/containers/Providers/ModelHandler.tsx index ad6d817f1..cceb88a4c 100644 --- a/web/containers/Providers/ModelHandler.tsx +++ b/web/containers/Providers/ModelHandler.tsx @@ -143,8 +143,7 @@ export default function ModelHandler() { return } - // The thread title should not be updated if the message is less than 10 words - // And no new line character is present + // No new line character is presented in the title // And non-alphanumeric characters should be removed if (messageContent.includes('\n')) { messageContent = messageContent.replace(/\n/g, ' ') @@ -290,13 +289,7 @@ export default function ModelHandler() { .catch(() => undefined) if (updatedMessage) { deleteMessage(message.id) - addNewMessage({ - ...updatedMessage, - metadata: { - ...updatedMessage.metadata, - reserve_id: message.id, - }, - }) + addNewMessage(updatedMessage) setTokenSpeed((prev) => prev ? { ...prev, message: updatedMessage.id } : undefined ) diff --git a/web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx b/web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx index 1f4308bf3..99c79534f 100644 --- a/web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx @@ -160,12 +160,7 @@ const ChatBody = memo( > {items.map((virtualRow) => (
@@ -175,6 +170,7 @@ const ChatBody = memo( ((message, ref) => { @@ -78,6 +79,7 @@ const ChatItem = forwardRef((message, ref) => { {...message} content={content} status={status} + index={message.index} isCurrentMessage={message.isCurrentMessage ?? false} />
diff --git a/web/screens/Thread/ThreadCenterPanel/TextMessage/ThinkingBlock.tsx b/web/screens/Thread/ThreadCenterPanel/TextMessage/ThinkingBlock.tsx index bda541b68..0c9ded123 100644 --- a/web/screens/Thread/ThreadCenterPanel/TextMessage/ThinkingBlock.tsx +++ b/web/screens/Thread/ThreadCenterPanel/TextMessage/ThinkingBlock.tsx @@ -8,10 +8,10 @@ import { MarkdownTextMessage } from './MarkdownTextMessage' interface Props { text: string status: string - id: string + id: number } -const thinkingBlockStateAtom = atom<{ [id: string]: boolean }>({}) +const thinkingBlockStateAtom = atom<{ [id: number]: boolean }>({}) const ThinkingBlock = ({ id, text, status }: Props) => { const [thinkingState, setThinkingState] = useAtom(thinkingBlockStateAtom) diff --git a/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx b/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx index efa2b084c..4ce65d031 100644 --- a/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx @@ -27,7 +27,7 @@ import { import { chatWidthAtom } from '@/helpers/atoms/Setting.atom' const MessageContainer: React.FC< - ThreadMessage & { isCurrentMessage: boolean } + ThreadMessage & { isCurrentMessage: boolean; index: number } > = (props) => { const isUser = props.role === ChatCompletionRole.User const isSystem = props.role === ChatCompletionRole.System @@ -162,7 +162,7 @@ const MessageContainer: React.FC< > {reasoningSegment && (