Skip to content

Commit

Permalink
Merge pull request #300 from TBXark/dev
Browse files Browse the repository at this point in the history
fix: cohere history bug
  • Loading branch information
TBXark authored Oct 31, 2024
2 parents 49d9cb1 + eefdd92 commit a9b84c2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/buildinfo.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/timestamp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/agent/cohere.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ export class Cohere implements ChatAgent {
'Accept': onStream !== null ? 'text/event-stream' : 'application/json',
};

const messages = [...history || [], { role: 'user', content: message }];

const body = {
message,
model: context.COHERE_CHAT_MODEL,
stream: onStream != null,
preamble: prompt,
chat_history: history?.map(this.render),
chat_history: messages.map(this.render),
};
if (!body.preamble) {
delete body.preamble;
Expand Down

0 comments on commit a9b84c2

Please sign in to comment.