is_ai is set to true if sender is null
This commit is contained in:
parent
4ad215e4cd
commit
9adb4b97d4
1 changed files with 15 additions and 12 deletions
|
|
@ -41,9 +41,8 @@ export default function newChatView(): JSX.Element {
|
||||||
const outputTypes = outputs.map((obj) => obj.type);
|
const outputTypes = outputs.map((obj) => obj.type);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(!outputTypes.includes("ChatOutput"))
|
if (!outputTypes.includes("ChatOutput")) {
|
||||||
{
|
setNoticeData({ title: "There is no ChatOutput node in the flow." });
|
||||||
setNoticeData({title:"There is no ChatOutput node in the flow."})
|
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
@ -71,12 +70,16 @@ export default function newChatView(): JSX.Element {
|
||||||
try {
|
try {
|
||||||
const { sender, message, sender_name } = output.data
|
const { sender, message, sender_name } = output.data
|
||||||
.artifacts as ChatOutputType;
|
.artifacts as ChatOutputType;
|
||||||
const is_ai = sender === "Machine";
|
|
||||||
|
const is_ai = sender === "Machine" || sender === null;
|
||||||
return { isSend: !is_ai, message: message, sender_name };
|
return { isSend: !is_ai, message: message, sender_name };
|
||||||
}
|
} catch (e) {
|
||||||
catch(e){
|
|
||||||
console.error(e);
|
console.error(e);
|
||||||
return { isSend: false, message: "Error parsing message", sender_name: "Error" };
|
return {
|
||||||
|
isSend: false,
|
||||||
|
message: "Error parsing message",
|
||||||
|
sender_name: "Error",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setChatHistory(chatMessages);
|
setChatHistory(chatMessages);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue