Skip to content

feat(tui): support configurable DeepSeek base URL in /config#1967

Open
cyq1017 wants to merge 4 commits into
Hmbown:mainfrom
cyq1017:codex/fix-1919-customization
Open

feat(tui): support configurable DeepSeek base URL in /config#1967
cyq1017 wants to merge 4 commits into
Hmbown:mainfrom
cyq1017:codex/fix-1919-customization

Conversation

@cyq1017
Copy link
Copy Markdown
Contributor

@cyq1017 cyq1017 commented May 24, 2026

Summary

  • Treat /config base_url as a persisted-only setting: setting it without --save now returns an error.
  • New behavior message explains that DeepSeek base URL is loaded from config on startup and requires restart/re-open session after saving.
  • Keep no runtime/session client hot-reload path; behavior stays minimal and aligned with existing model/client initialization model.
  • Keep /config base_url read path unchanged: /config base_url returns current value from config.

Testing

  • cargo fmt --all -- --check
  • git diff --check
  • cargo test -p deepseek-tui config_command_base_url -- --nocapture
  • cargo test -p deepseek-tui config_command_cost_currency_save_persists_value -- --nocapture
  • cargo test -p deepseek-tui test_set_default_mode_normal_save_reports_normalized_value -- --nocapture
  • cargo test -p deepseek-tui default_settings_disable_auto_compact_to_protect_v4_prefix_cache -- --nocapture

Closes #1919

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for viewing and configuring a base_url for DeepSeek-compatible endpoints, including persistence logic and unit tests. However, the reviewer noted that session-only overrides are currently non-functional because they do not update the application state. Additionally, the implementation for retrieving the setting relies on reloading the configuration from disk, which is inefficient and may ignore CLI-specified paths. Finally, the new setting needs to be added to the /settings display output for visibility.

Comment thread crates/tui/src/commands/config.rs Outdated
Comment on lines +463 to +465
return CommandResult::message(format!(
"base_url = {value} (session only; use --save to persist)"
));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The session-only override for base_url is currently a no-op. While the command returns a success message, it does not update the app state or the active DeepSeekClient. Consequently, the application will continue to use the previously configured base URL for the remainder of the session. To fix this, the base_url should be stored in the App struct and respected when creating or using the LLM client.

Comment thread crates/tui/src/commands/config.rs Outdated
Comment on lines +128 to +134
let config = match Config::load(None, None) {
Ok(config) => config,
Err(err) => {
return CommandResult::error(format!("Failed to load config: {err}"));
}
};
Some(config.deepseek_base_url())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Retrieving the base_url by reloading the configuration from disk is inconsistent with other settings in this function, which typically use the runtime state from the app instance. This approach ignores any session-only overrides and performs unnecessary file I/O. Furthermore, Config::load(None, None) might load the wrong file if the application was started with a custom configuration path via CLI arguments.

Comment on lines +761 to +763
"base_url",
"HTTP base URL for DeepSeek-compatible endpoints.",
),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While base_url has been added to available_settings (enabling it in /help config and /set usage), it is missing from the Settings::display method. This means it won't be visible when a user runs the /settings command. For consistency, it should be included in the display output, even if it is stored in config.toml rather than settings.toml.

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 24, 2026

Stewardship note: #1919 is now milestoned to v0.8.46 and this PR is the narrow candidate for persisted DeepSeek base_url config. I left the broader OpenAI-compatible path/provider parser questions in #1874 and #1978 so this PR can stay small.

Review focus: persisted config semantics, restart/session messaging, and not accidentally promising hot reload.

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.

Create a function to custom API Endpoint by users

2 participants