Skip to content

Commit

Permalink
fix user message history
Browse files Browse the repository at this point in the history
  • Loading branch information
loudar committed Jun 19, 2024
1 parent 228d25f commit 00414c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/features/context/Context.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ export class Context {

static getMessageHistoryWithOnlyLastUserMessage(context) {
const history = Context.getMessageHistory(context);
const userMessages = history.filter(h => h.type === MessageTypes.userMessage);
const excludeMessages = userMessages.slice(0, -1);
return history.filter(h => !excludeMessages.includes(h));
const userMessages = history.filter(h => h.role === "user");
return history.filter(h => !userMessages.includes(h));
}

static getToolFunction() {
Expand Down

0 comments on commit 00414c3

Please sign in to comment.