Update package-lock.json and fix error handling in newChatView

This commit is contained in:
anovazzi1 2024-02-14 15:39:44 -03:00
commit c5d84549a4
2 changed files with 13 additions and 7 deletions

View file

@ -4476,9 +4476,9 @@
}
},
"node_modules/browserslist": {
"version": "4.22.3",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz",
"integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==",
"version": "4.23.0",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz",
"integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==",
"funding": [
{
"type": "opencollective",
@ -4494,8 +4494,8 @@
}
],
"dependencies": {
"caniuse-lite": "^1.0.30001580",
"electron-to-chromium": "^1.4.648",
"caniuse-lite": "^1.0.30001587",
"electron-to-chromium": "^1.4.668",
"node-releases": "^2.0.14",
"update-browserslist-db": "^1.0.13"
},

View file

@ -66,13 +66,19 @@ export default function newChatView(): JSX.Element {
});
const chatMessages: ChatMessageType[] = chatOutputResponses
.sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp))
.filter((output) => !!output.data.artifacts.message)
.filter((output) => !!output.data.artifacts?.message)
.map((output) => {
const { sender, message, sender_name } = output.data
try{
const { sender, message, sender_name } = output.data
.artifacts as ChatOutputType;
console.log(output.data.artifacts);
const is_ai = sender === "Machine";
return { isSend: !is_ai, message: message, sender_name };
}
catch(e){
console.error(e);
return { isSend: false, message: "Error parsing message", sender_name: "Error" };
}
});
setChatHistory(chatMessages);
}, [flowPool]);