Skip to content

Commit

Permalink
Fix: close chat while AI is responding
Browse files Browse the repository at this point in the history
  • Loading branch information
UdaraJay committed May 12, 2024
1 parent 31cfa22 commit b86760c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/renderer/pages/Pile/Chat/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ export default function Chat() {

const appendToLastSystemMessage = (token) => {
setHistory((history) => {
if (!history || history.length === 0) return [];
const last = history[history.length - 1];
if (last.role === 'system') {
if (last?.role === 'system') {
return [
...history.slice(0, -1),
{ role: 'system', content: last.content + (token ?? '') },
{ role: 'system', content: last?.content + (token ?? '') },
];
}
});
Expand Down

0 comments on commit b86760c

Please sign in to comment.