From a058710fedf4cf861aa3effb5e661f8aca9c2ac8 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 3 Dec 2024 13:25:54 +0700 Subject: [PATCH 1/2] fix: 4178 - current generated message options should be visible --- .../ThreadCenterPanel/ChatItem/index.tsx | 7 +- .../ThreadCenterPanel/TextMessage/index.tsx | 90 ++++++++++--------- 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/web/screens/Thread/ThreadCenterPanel/ChatItem/index.tsx b/web/screens/Thread/ThreadCenterPanel/ChatItem/index.tsx index 10d4082113..1fa3ef1155 100644 --- a/web/screens/Thread/ThreadCenterPanel/ChatItem/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/ChatItem/index.tsx @@ -54,7 +54,12 @@ const ChatItem = forwardRef((message, ref) => { <> {status !== MessageStatus.Error && content?.length > 0 && (
- +
)} {errorMessage && !message.loadModelError && ( diff --git a/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx b/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx index fa39f8209f..f65b9b967f 100644 --- a/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/TextMessage/index.tsx @@ -19,19 +19,18 @@ import { MarkdownTextMessage } from './MarkdownTextMessage' import { editMessageAtom, - getCurrentChatMessagesAtom, tokenSpeedAtom, } from '@/helpers/atoms/ChatMessage.atom' import { activeThreadAtom } from '@/helpers/atoms/Thread.atom' -const MessageContainer: React.FC = (props) => { +const MessageContainer: React.FC< + ThreadMessage & { isCurrentMessage: boolean } +> = (props) => { const isUser = props.role === ChatCompletionRole.User const isSystem = props.role === ChatCompletionRole.System const editMessage = useAtomValue(editMessageAtom) const activeThread = useAtomValue(activeThreadAtom) - const tokenSpeed = useAtomValue(tokenSpeedAtom) - const messages = useAtomValue(getCurrentChatMessagesAtom) const text = useMemo( () => props.content[0]?.text?.value ?? '', @@ -81,16 +80,6 @@ const MessageContainer: React.FC = (props) => {

{displayDate(props.created)}

-
- -
{tokenSpeed && tokenSpeed.message === props.id && tokenSpeed.tokenSpeed > 0 && ( @@ -100,39 +89,52 @@ const MessageContainer: React.FC = (props) => { )} -
- <> - {messageType === ContentType.Image && ( - +
+
+ > + +
+
+ <> + {messageType === ContentType.Image && ( + + )} + {messageType === ContentType.Pdf && ( + + )} - {editMessage === props.id ? ( -
- -
- ) : ( -
- -
- )} - + {editMessage === props.id ? ( +
+ +
+ ) : ( +
+ +
+ )} + +
) From bfd66c421c23ec62a0263700616425ec1288cf2f Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 3 Dec 2024 13:53:26 +0700 Subject: [PATCH 2/2] fix: error message should not be capitalized --- web/containers/ErrorMessage/index.tsx | 5 ++++- .../Thread/ThreadCenterPanel/LoadModelError/index.tsx | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/web/containers/ErrorMessage/index.tsx b/web/containers/ErrorMessage/index.tsx index 4c97da14be..b2f6bc23af 100644 --- a/web/containers/ErrorMessage/index.tsx +++ b/web/containers/ErrorMessage/index.tsx @@ -52,7 +52,10 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => { ) default: return ( -

+

{message.content[0]?.text?.value && ( )} diff --git a/web/screens/Thread/ThreadCenterPanel/LoadModelError/index.tsx b/web/screens/Thread/ThreadCenterPanel/LoadModelError/index.tsx index 569e93d62b..d6fed48043 100644 --- a/web/screens/Thread/ThreadCenterPanel/LoadModelError/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/LoadModelError/index.tsx @@ -49,7 +49,9 @@ const LoadModelError = () => { } else { return (

- {loadModelError &&

{loadModelError}

} + {loadModelError && ( +

{loadModelError}

+ )}

{`Something's wrong.`} Access