Improve AI service to better estimate token completion for responses

Update `server/aiService.ts` to use `max_completion_tokens` instead of `max_tokens` for more accurate AI response length estimation.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 170e18f0-0f13-4eca-8643-546bba1dd8cc
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/170e18f0-0f13-4eca-8643-546bba1dd8cc/td5Y4HG
This commit is contained in:
sebastjanartic 2025-09-02 13:00:29 +00:00
parent 475534134c
commit 9202e323bc
2 changed files with 1 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -56,7 +56,7 @@ Odgovori samo z opisom, brez dodatnih pojasnil.`;
content: prompt
}
],
max_tokens: Math.ceil(maxCharacters / 2), // Rough estimate: 2 characters per token
max_completion_tokens: Math.ceil(maxCharacters / 2), // Rough estimate: 2 characters per token
temperature: 0.7,
});