Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(chat): the context-overflow sentence names the chat, not the message

purple2f21acbeb67f
diff --git a/src/lib/__tests__/ein-zu-langer-prompt-sagt-das.test.ts b/src/lib/__tests__/ein-zu-langer-prompt-sagt-das.test.ts
index 2612626b..67756883 100644
--- a/src/lib/__tests__/ein-zu-langer-prompt-sagt-das.test.ts
+++ b/src/lib/__tests__/ein-zu-langer-prompt-sagt-das.test.ts
@@ -10,7 +10,7 @@ import { BAD_REQUEST_SENTENCE, CONTEXT_OVERFLOW_REFUSAL_SENTENCE, explainSendRef
const overflow = (msg: string) => Object.assign(new Error(msg), { statusCode: 400 })
describe('a prompt longer than the context window', () => {
- it('says that the message is too long, not "send it again"', () => {
+ it('says that the chat is too long, not "send it again"', () => {
const text = explainSendRefusal(overflow('request (42120 tokens) exceeds the available context size (16384 tokens), try increasing it'))!
expect(text.startsWith(CONTEXT_OVERFLOW_REFUSAL_SENTENCE)).toBe(true)
expect(text).not.toContain(BAD_REQUEST_SENTENCE)
diff --git a/src/lib/template-refusal.ts b/src/lib/template-refusal.ts
index 8a1e843d..34778cd2 100644
--- a/src/lib/template-refusal.ts
+++ b/src/lib/template-refusal.ts
@@ -51,11 +51,13 @@ export const BAD_REQUEST_SENTENCE =
/** A request longer than the window of the model. Sending it again cannot
* help, and a local model charges nothing: the general 400 sentence said
- * both (T1 Nacht-Durchtest 3.0.9, 204K characters into a 16K window). */
+ * both (T1 Nacht-Durchtest 3.0.9, 204K characters into a 16K window). The
+ * sentence names the chat, not the message: in a group the overflow can come
+ * from an earlier speaker's long answer while the user's line is short. */
export const CONTEXT_OVERFLOW_REFUSAL_SENTENCE =
- 'This message is longer than the model can read at once, so nothing was generated. Shorten it, ' +
- 'attach long text with Docs instead of pasting it, or raise the Context window above the message box ' +
- 'if this model offers one.'
+ 'This chat is more than the model can read at once, so nothing was generated. Shorten the last ' +
+ 'message or start a new chat, attach long text with Docs instead of pasting it, or raise the Context ' +
+ 'window above the message box if this model offers one.'
/** A backend that names the temperature in its refusal (A33): one LU Cloud
* model takes 0 to 1 and answered 1.9 with a bare 400. */