Skip to content

fix: preserve top-level baseUrl when service entry has no explicit baseUrl#250

Open
ycls2002 wants to merge 2 commits into
Narcooo:masterfrom
ycls2002:fix/service-entry-baseurl-override
Open

fix: preserve top-level baseUrl when service entry has no explicit baseUrl#250
ycls2002 wants to merge 2 commits into
Narcooo:masterfrom
ycls2002:fix/service-entry-baseurl-override

Conversation

@ycls2002

@ycls2002 ycls2002 commented May 8, 2026

Copy link
Copy Markdown

Problem

applyServiceEntry() in effective-llm-config.ts overwrites the top-level llm.baseUrl with the endpoint default when the service entry doesn't have an explicit baseUrl. This causes users who configure a custom baseUrl at the top level to have it silently replaced.

Example: user configures baseUrl: https://token-plan-cn.xiaomimimo.com/v1 but the service entry for xiaomi has a default baseUrl of https://api-ai.xiaomi.com/v1. The service entry's default wins, breaking the user's config.

Fix

Add llm.baseUrl as a fallback in the ?? chain:

- llm.baseUrl = entry.baseUrl ?? resolveServicePreset(entry.service)?.baseUrl ?? "";
+ llm.baseUrl = entry.baseUrl ?? llm.baseUrl ?? resolveServicePreset(entry.service)?.baseUrl ?? "";

This ensures the priority is: entry.baseUrl > existing llm.baseUrl > endpoint default.

🤖 Generated with Claude Code

…seUrl

When a service entry in inkos.json does not specify its own `baseUrl`,
`applyServiceEntry()` was unconditionally overwriting `llm.baseUrl` with
the endpoint's default URL (e.g. `https://api-ai.xiaomi.com/v1` for the
xiaomimimo service). This discarded the user's top-level `llm.baseUrl`
configuration, causing connection failures when using a third-party
proxy URL (e.g. `https://token-plan-cn.xiaomimimo.com/v1`).

The fix adds `llm.baseUrl` as a fallback in the resolution chain:
  entry.baseUrl ?? llm.baseUrl ?? resolveServicePreset(...)?.baseUrl ?? ""

This ensures the priority order is:
1. Service entry's explicit baseUrl (highest priority)
2. Top-level llm.baseUrl from user config
3. Endpoint's default baseUrl
4. Empty string fallback

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ycls2002

ycls2002 commented May 8, 2026

Copy link
Copy Markdown
Author

根本原因是小米大模型的token plan和按量计费的api baseurl不一致导致

Two new features for InkOS Studio:

1. Outline upload (BookCreate): file upload button for .txt/.md outline
   files that populates the brief textarea, with file name badge and
   clear button.

2. Pre-chapter direction selection: "Plan directions" quick action that
   generates 3 story direction cards (A/B/C) before writing a chapter.
   User selects a direction, which is passed as context guidance to the
   chapter writing pipeline.

Changes are purely additive — no existing functionality is modified.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ycls2002 ycls2002 changed the title fix: preserve top-level baseUrl when service entry has no explicit baseUrl fix: baseUrl override bug + feat: outline upload & pre-chapter direction selection May 9, 2026
@ycls2002 ycls2002 changed the title fix: baseUrl override bug + feat: outline upload & pre-chapter direction selection fix: preserve top-level baseUrl when service entry has no explicit baseUrl May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant