add empty text on empty value chat

This commit is contained in:
cristhianzl 2024-06-17 10:32:40 -03:00
commit 55496cd9de
3 changed files with 8 additions and 4 deletions

View file

@ -858,3 +858,5 @@ export const ERROR_UPDATING_COMPONENT =
"An unexpected error occurred while updating the Component. Please try again.";
export const TITLE_ERROR_UPDATING_COMPONENT =
"Error while updating the Component";
export const EMPTY_INPUT_SEND_MESSAGE = "No input message provided.";

View file

@ -14,6 +14,7 @@ import useFlowStore from "../../../../../stores/flowStore";
import { chatMessagePropsType } from "../../../../../types/components";
import { classNames, cn } from "../../../../../utils/utils";
import FileCardWrapper from "./components/fileCardWrapper";
import { EMPTY_INPUT_SEND_MESSAGE } from "../../../../../constants/constants";
export default function ChatMessage({
chat,
@ -310,7 +311,9 @@ export default function ChatMessage({
) : (
<div className="flex flex-col">
<span
className="prose text-primary word-break-break-word dark:prose-invert"
className={`prose word-break-break-word dark:prose-invert ${
chatMessage === EMPTY_INPUT_SEND_MESSAGE ? "text-gray-400" : "text-primary"
}`}
data-testid={
"chat-message-" + chat.sender_name + "-" + chatMessage
}

View file

@ -4,6 +4,7 @@ import { Button } from "../../../../components/ui/button";
import {
CHAT_FIRST_INITIAL_TEXT,
CHAT_SECOND_INITIAL_TEXT,
EMPTY_INPUT_SEND_MESSAGE,
} from "../../../../constants/constants";
import { deleteFlowPool } from "../../../../controllers/API";
import useAlertStore from "../../../../stores/alertStore";
@ -79,9 +80,7 @@ export default function ChatView({
return {
isSend: !is_ai,
message:
message === "" || !message
? "No input message provided."
: message,
message === "" || !message ? EMPTY_INPUT_SEND_MESSAGE : message,
sender_name,
componentId: output.id,
stream_url: stream_url,