Skip to content

Commit

Permalink
feat: adapt action behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Mar 28, 2024
1 parent 6089c7e commit 957ed72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/backend/server/src/plugins/copilot/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export class ChatSession implements AsyncDisposable {
}

private takeMessages(): ChatMessage[] {
if (this.state.action) {
const messages = this.state.messages;
return messages.slice(messages.length - 1);
}
const ret = [];
const messages = [...this.state.messages];
messages.reverse();
Expand All @@ -76,7 +80,7 @@ export class ChatSession implements AsyncDisposable {

finish(): ChatMessage[] {
const messages = this.takeMessages();
return [...(this.state.prompt || []), ...messages];
return [...this.state.prompt, ...messages];
}

async save() {
Expand Down

0 comments on commit 957ed72

Please sign in to comment.