fix: empty input message on empty streaming (#2729)

Fixed streaming bug where it shows a message before starting streaming
This commit is contained in:
Lucas Oliveira 2024-07-16 14:26:55 -03:00 committed by GitHub
commit caae43bc9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View file

@ -853,6 +853,8 @@ export const TITLE_ERROR_UPDATING_COMPONENT =
export const EMPTY_INPUT_SEND_MESSAGE = "No input message provided.";
export const EMPTY_OUTPUT_SEND_MESSAGE = "Message empty.";
export const TABS_ORDER = [
"run curl",
"python api",

View file

@ -9,7 +9,10 @@ import Robot from "../../../../../assets/robot.png";
import CodeTabsComponent from "../../../../../components/codeTabsComponent";
import IconComponent from "../../../../../components/genericIconComponent";
import SanitizedHTMLWrapper from "../../../../../components/sanitizedHTMLWrapper";
import { EMPTY_INPUT_SEND_MESSAGE } from "../../../../../constants/constants";
import {
EMPTY_INPUT_SEND_MESSAGE,
EMPTY_OUTPUT_SEND_MESSAGE,
} from "../../../../../constants/constants";
import useAlertStore from "../../../../../stores/alertStore";
import useFlowStore from "../../../../../stores/flowStore";
import { chatMessagePropsType } from "../../../../../types/components";
@ -251,8 +254,8 @@ export default function ChatMessage({
},
}}
>
{chatMessage === ""
? EMPTY_INPUT_SEND_MESSAGE
{chatMessage === "" && !chat.stream_url
? EMPTY_OUTPUT_SEND_MESSAGE
: chatMessage}
</Markdown>
),
@ -286,10 +289,8 @@ export default function ChatMessage({
className={cn(
"prose word-break-break-word dark:prose-invert",
chatMessage !== ""
? EMPTY_INPUT_SEND_MESSAGE
: chatMessage
? "text-primary"
: "text-chat-trigger-disabled",
? "text-primary"
: "text-chat-trigger-disabled",
)}
>
{promptOpen