Update package-lock.json and fix error handling in newChatView
This commit is contained in:
parent
5c9bced5ef
commit
c5d84549a4
2 changed files with 13 additions and 7 deletions
10
src/frontend/package-lock.json
generated
10
src/frontend/package-lock.json
generated
|
|
@ -4476,9 +4476,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/browserslist": {
|
"node_modules/browserslist": {
|
||||||
"version": "4.22.3",
|
"version": "4.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz",
|
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz",
|
||||||
"integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==",
|
"integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
|
|
@ -4494,8 +4494,8 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"caniuse-lite": "^1.0.30001580",
|
"caniuse-lite": "^1.0.30001587",
|
||||||
"electron-to-chromium": "^1.4.648",
|
"electron-to-chromium": "^1.4.668",
|
||||||
"node-releases": "^2.0.14",
|
"node-releases": "^2.0.14",
|
||||||
"update-browserslist-db": "^1.0.13"
|
"update-browserslist-db": "^1.0.13"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -66,13 +66,19 @@ export default function newChatView(): JSX.Element {
|
||||||
});
|
});
|
||||||
const chatMessages: ChatMessageType[] = chatOutputResponses
|
const chatMessages: ChatMessageType[] = chatOutputResponses
|
||||||
.sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp))
|
.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) => {
|
.map((output) => {
|
||||||
|
try{
|
||||||
const { sender, message, sender_name } = output.data
|
const { sender, message, sender_name } = output.data
|
||||||
.artifacts as ChatOutputType;
|
.artifacts as ChatOutputType;
|
||||||
console.log(output.data.artifacts);
|
console.log(output.data.artifacts);
|
||||||
const is_ai = sender === "Machine";
|
const is_ai = sender === "Machine";
|
||||||
return { isSend: !is_ai, message: message, sender_name };
|
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);
|
setChatHistory(chatMessages);
|
||||||
}, [flowPool]);
|
}, [flowPool]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue