Skip to content

refactor(ai): unify reasoning config and modularize client pipeline#393

Merged
wsp1911 merged 3 commits intoGCWing:mainfrom
wsp1911:main
Apr 12, 2026
Merged

refactor(ai): unify reasoning config and modularize client pipeline#393
wsp1911 merged 3 commits intoGCWing:mainfrom
wsp1911:main

Conversation

@wsp1911
Copy link
Copy Markdown
Collaborator

@wsp1911 wsp1911 commented Apr 12, 2026

Summary

This PR refactors the AI request pipeline and unifies reasoning configuration across providers.

It consolidates the recent reasoning-related changes into a consistent config model, removes obsolete preserved-thinking behavior, and restructures the AI client into smaller provider-specific/request-specific modules. It also updates the model configuration UI and related schema/i18n to match the new behavior.

Changes

  • remove preserved thinking trimming and simplify reasoning replay behavior
  • replace legacy thinking flags with a unified reasoning configuration model
  • keep backward-compatible config migration for existing settings
  • normalize reasoning payload generation across OpenAI-compatible, Anthropic, and Gemini providers
  • modularize the AI client into shared transport utilities and provider-specific request/discovery modules
  • add custom_request_body_mode with merge/trim support
  • refresh AI model settings UI with reasoning mode, effort, budget, and request-body controls
  • remove obsolete model penalty fields and related config wiring
  • clean up outdated locale strings and config schema definitions

Why

Previously, reasoning/thinking behavior was split across multiple config shapes and provider-specific paths, which made the request pipeline harder to maintain and the UI harder to understand.

This PR moves the system toward:

  • one consistent reasoning configuration model
  • clearer replay/token-estimation behavior
  • better separation of shared client logic and provider-specific request building
  • a more maintainable settings experience for advanced model options

Impact

Backend

  • updates reasoning config parsing and migration
  • changes request construction for OpenAI-compatible, Anthropic, and Gemini providers
  • simplifies reasoning replay and token estimation behavior
  • improves maintainability by splitting the large AI client into focused modules

Frontend

  • updates AI model configuration UI and schema
  • adds reasoning mode / effort / budget controls
  • adds request body trim/merge mode controls and warnings
  • updates English and Chinese locale strings

wsp1911 added 3 commits April 12, 2026 20:56
…easoning replay

- remove preserved_thinking config and related UI/installer wiring
- stop trimming historical reasoning_content before model requests
- separate request token estimation from send-path replay behavior
- count reasoning tokens only for the latest live turn during local estimation
- document OpenAI chat/completions reasoning replay compatibility behavior
- clean up obsolete preserved thinking locale strings and add coverage tests
- replace legacy thinking flag with reasoning mode and keep backward-compatible config migration
- normalize provider-specific reasoning payloads for OpenAI-compatible, Anthropic, and Gemini models
- expose reasoning mode, effort, and thinking budget controls in model config UI and schema
- split the AI client into shared transport utilities and provider-specific request/discovery modules
- add custom_request_body_mode config flow with merge/trim support across OpenAI, Anthropic, and Gemini
- refresh AI model settings UI with mode toggles, inline warnings, tooltips, and i18n copy updates
- remove unused model penalty fields and keep related config handling aligned
@wsp1911 wsp1911 merged commit 8b23640 into GCWing:main Apr 12, 2026
4 checks passed
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