diff --git a/dist/buildinfo.json b/dist/buildinfo.json index a7e1dd43..89851f0f 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha":"e756436","timestamp":1728895080} \ No newline at end of file +{"sha":"2e649eb","timestamp":1730180242} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index e758599c..c45b9ef7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -211,8 +211,8 @@ const ENV_KEY_MAPPER = { WORKERS_AI_MODEL: "WORKERS_CHAT_MODEL" }; class Environment extends EnvironmentConfig { - BUILD_TIMESTAMP = 1728895080 ; - BUILD_VERSION = "e756436" ; + BUILD_TIMESTAMP = 1730180242 ; + BUILD_VERSION = "2e649eb" ; I18N = loadI18n(); PLUGINS_ENV = {}; USER_CONFIG = createAgentUserConfig(); @@ -1458,12 +1458,13 @@ class Cohere { "Content-Type": "application/json", "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; diff --git a/dist/timestamp b/dist/timestamp index 5087328b..31e68c49 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1728895080 \ No newline at end of file +1730180242 \ No newline at end of file diff --git a/src/agent/cohere.ts b/src/agent/cohere.ts index ae88aa1a..b2bddb1a 100644 --- a/src/agent/cohere.ts +++ b/src/agent/cohere.ts @@ -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;