[PR #203] [MERGED] Allow setting max_tokens per Connection. #4502

Closed
opened 2026-10-22 04:08:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/203
Author: @pwildani
Created: 4/23/2026
Status: ✅ Merged
Merged: 4/23/2026
Merged by: @SpicyMarinara

Base: main ← Head: pwildani-max-tokens


📝 Commits (2)

  • ca96ca2 Allow setting max_tokens per Connection.
  • c7e706e Merge branch 'main' into pwildani-max-tokens

📊 Changes

24 files changed (+114 additions, -31 deletions)

View changed files

📝 packages/client/src/components/connections/ConnectionEditor.tsx (+33 -0)
📝 packages/server/src/db/migrate.ts (+5 -0)
📝 packages/server/src/db/schema/connections.ts (+2 -0)
📝 packages/server/src/routes/character-maker.routes.ts (+1 -1)
📝 packages/server/src/routes/chats.routes.ts (+1 -1)
📝 packages/server/src/routes/connections.routes.ts (+1 -1)
📝 packages/server/src/routes/conversation.routes.ts (+1 -1)
📝 packages/server/src/routes/encounter.routes.ts (+3 -3)
📝 packages/server/src/routes/game.routes.ts (+6 -5)
📝 packages/server/src/routes/generate.routes.ts (+7 -1)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+2 -1)
📝 packages/server/src/routes/lorebook-maker.routes.ts (+1 -1)
📝 packages/server/src/routes/lorebooks.routes.ts (+1 -0)
📝 packages/server/src/routes/persona-maker.routes.ts (+1 -1)
📝 packages/server/src/routes/prompt-reviewer.routes.ts (+1 -1)
📝 packages/server/src/routes/scene.routes.ts (+2 -2)
📝 packages/server/src/routes/translate.routes.ts (+1 -1)
📝 packages/server/src/services/agents/agent-executor.ts (+12 -3)
📝 packages/server/src/services/llm/base-provider.ts (+12 -0)
📝 packages/server/src/services/llm/provider-registry.ts (+9 -4)

...and 4 more files

📄 Description

Why this change

This lets providers that restrict output tokens to a small limit still work with coalescing agent calls into batches.

What changed

  • Store a max_tokens_override which limits any upstream max_tokens for this connection to the specified value, when it is set.
  • Add a field to the ConnectionEditor ui to let the user manage the setting.

Validation

  • pnpm check
  • Manual verification completed (describe below)

Manual verification notes

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Summary by CodeRabbit

  • New Features
    • Added per-connection token limit override configuration in the connection editor. Users can now set a maximum token cap for API responses on a per-connection basis, which is applied consistently across all language model operations and requests.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/203 **Author:** [@pwildani](https://github.com/pwildani) **Created:** 4/23/2026 **Status:** ✅ Merged **Merged:** 4/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `pwildani-max-tokens` --- ### 📝 Commits (2) - [`ca96ca2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ca96ca24e81a6d4be5bb6b571f0a6c045286dfff) Allow setting max_tokens per Connection. - [`c7e706e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c7e706e5d2127f4ff738968d3f424c2e6c36aa00) Merge branch 'main' into pwildani-max-tokens ### 📊 Changes **24 files changed** (+114 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/connections/ConnectionEditor.tsx` (+33 -0) 📝 `packages/server/src/db/migrate.ts` (+5 -0) 📝 `packages/server/src/db/schema/connections.ts` (+2 -0) 📝 `packages/server/src/routes/character-maker.routes.ts` (+1 -1) 📝 `packages/server/src/routes/chats.routes.ts` (+1 -1) 📝 `packages/server/src/routes/connections.routes.ts` (+1 -1) 📝 `packages/server/src/routes/conversation.routes.ts` (+1 -1) 📝 `packages/server/src/routes/encounter.routes.ts` (+3 -3) 📝 `packages/server/src/routes/game.routes.ts` (+6 -5) 📝 `packages/server/src/routes/generate.routes.ts` (+7 -1) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+2 -1) 📝 `packages/server/src/routes/lorebook-maker.routes.ts` (+1 -1) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+1 -0) 📝 `packages/server/src/routes/persona-maker.routes.ts` (+1 -1) 📝 `packages/server/src/routes/prompt-reviewer.routes.ts` (+1 -1) 📝 `packages/server/src/routes/scene.routes.ts` (+2 -2) 📝 `packages/server/src/routes/translate.routes.ts` (+1 -1) 📝 `packages/server/src/services/agents/agent-executor.ts` (+12 -3) 📝 `packages/server/src/services/llm/base-provider.ts` (+12 -0) 📝 `packages/server/src/services/llm/provider-registry.ts` (+9 -4) _...and 4 more files_ </details> ### 📄 Description ## Why this change This lets providers that restrict output tokens to a small limit still work with coalescing agent calls into batches. ## What changed - Store a max_tokens_override which limits any upstream max_tokens for this connection to the specified value, when it is set. - Add a field to the ConnectionEditor ui to let the user manage the setting. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [X] `pnpm check` - [ ] Manual verification completed (describe below) ### Manual verification notes <!-- Describe what you manually verified --> - ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <!-- Add screenshots or recordings for UI changes --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added per-connection token limit override configuration in the connection editor. Users can now set a maximum token cap for API responses on a per-connection basis, which is applied consistently across all language model operations and requests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4502
No description provided.