Fix streaming

This commit is contained in:
ogabrielluiz 2024-06-11 13:05:19 -03:00
commit 3a3055479f

View file

@ -10,7 +10,7 @@ import useAlertStore from "../../../../stores/alertStore";
import useFlowStore from "../../../../stores/flowStore"; import useFlowStore from "../../../../stores/flowStore";
import useFlowsManagerStore from "../../../../stores/flowsManagerStore"; import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
import { VertexBuildTypeAPI, sendAllProps } from "../../../../types/api"; import { VertexBuildTypeAPI, sendAllProps } from "../../../../types/api";
import { ChatMessageType, ChatOutputType } from "../../../../types/chat"; import { ChatMessageType } from "../../../../types/chat";
import { FilePreviewType, chatViewProps } from "../../../../types/components"; import { FilePreviewType, chatViewProps } from "../../../../types/components";
import { classNames } from "../../../../utils/utils"; import { classNames } from "../../../../utils/utils";
import ChatInput from "./chatInput"; import ChatInput from "./chatInput";
@ -67,11 +67,9 @@ export default function ChatView({
try { try {
console.log("output:", output); console.log("output:", output);
const { sender, message, sender_name, stream_url, files } = const { sender, message, sender_name, stream_url, files } =
output.data.message.message !== "" || output.data.message;
(output.data.message.files ?? []).length > 0 console.log("output.data.message:", output.data.message);
? output.data.message console.log("output.data.message.files:", output.data.message.files);
: output.data.artifacts;
const is_ai = const is_ai =
sender === "Machine" || sender === null || sender === undefined; sender === "Machine" || sender === null || sender === undefined;
return { return {
@ -136,7 +134,7 @@ export default function ChatView({
function updateChat( function updateChat(
chat: ChatMessageType, chat: ChatMessageType,
message: string, message: string,
stream_url?: string, stream_url?: string
) { ) {
// if (message === "") return; // if (message === "") return;
chat.message = message; chat.message = message;
@ -166,7 +164,7 @@ export default function ChatView({
setIsDragging, setIsDragging,
setFiles, setFiles,
currentFlowId, currentFlowId,
setErrorData, setErrorData
); );
return ( return (