From 53be21e512f3695a462673312bad1fb5dae8c8f8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 Mar 2026 19:32:02 +0000 Subject: [PATCH] fix: increase maxTokens limits to reduce truncation failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default 200→400, invention 300→600, desireGeneration 500→800, backstoryAndDesires 800→1200. Can trim back once we have usage data. Co-Authored-By: Claude Opus 4.6 --- server/src/config/__tests__/llmConfig.test.ts | 2 +- server/src/config/llmConfig.ts | 2 +- server/src/llm/templates.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/config/__tests__/llmConfig.test.ts b/server/src/config/__tests__/llmConfig.test.ts index d1dcf0b..f2b1124 100644 --- a/server/src/config/__tests__/llmConfig.test.ts +++ b/server/src/config/__tests__/llmConfig.test.ts @@ -18,7 +18,7 @@ describe('llmConfig', () => { const config = getLlmConfig(); expect(config.model).toBe(''); expect(config.fallbackModel).toBeNull(); - expect(config.maxTokens).toBe(200); + expect(config.maxTokens).toBe(400); expect(config.temperature).toBe(0.8); expect(config.requestsPerMinute).toBe(20); expect(config.timeoutMs).toBe(15000); diff --git a/server/src/config/llmConfig.ts b/server/src/config/llmConfig.ts index 61e9405..173142f 100644 --- a/server/src/config/llmConfig.ts +++ b/server/src/config/llmConfig.ts @@ -15,7 +15,7 @@ export function getLlmConfig(): LlmConfig { apiKey, model: process.env.LLM_MODEL ?? '', fallbackModel: process.env.LLM_FALLBACK_MODEL ?? null, - maxTokens: 200, + maxTokens: 400, temperature: 0.8, requestsPerMinute: 20, timeoutMs: 15000, diff --git a/server/src/llm/templates.ts b/server/src/llm/templates.ts index 2087fd5..b2a1236 100644 --- a/server/src/llm/templates.ts +++ b/server/src/llm/templates.ts @@ -42,7 +42,7 @@ export const templates: Record = { invention: { name: 'invention', - maxTokens: 300, + maxTokens: 600, jsonResponse: true, systemPrompt: 'Given available materials and a settler\'s stats, consider 3 possible inventions, ' + @@ -69,7 +69,7 @@ export const templates: Record = { backstoryAndDesires: { name: 'backstoryAndDesires', - maxTokens: 800, + maxTokens: 1200, jsonResponse: true, systemPrompt: 'Write a brief backstory (1-2 sentences) and 1-2 initial desires for this settler. ' + @@ -92,7 +92,7 @@ export const templates: Record = { desireGeneration: { name: 'desireGeneration', - maxTokens: 500, + maxTokens: 800, jsonResponse: true, systemPrompt: 'Generate a new personal desire for this settler based on their personality and recent experiences.',