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_INPUT_SEND_MESSAGE = "No input message provided.";
export const EMPTY_OUTPUT_SEND_MESSAGE = "Message empty.";
export const TABS_ORDER = [ export const TABS_ORDER = [
"run curl", "run curl",
"python api", "python api",

View file

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