mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 11:53:10 +08:00
dda92e6deb
Two additions to the provider settings page, both modelled on cc-switch. One-click import from cc-switch: - Reads the local cc-switch installation and offers its Claude Code providers for bulk import. SQLite (cc-switch v3.8.0+) is the primary store, with the legacy v2 config.json as a fallback used only when no database exists — once cc-switch migrates it archives that file, so reading it alongside a database would surface pre-migration data. - Supports cc-switch v3.1.0 and newer. Older installs wrote a config format cc-switch itself dropped in v3.6.0; those are refused explicitly rather than reported as an empty scan. - Degrades honestly when cc-switch's storage moves: a structure we cannot read reports why, distinguishing "cc-switch too old" from "cc-haha does not recognise this layout" from "the file could not be read at all". Only id/app_type/settings_config are required; other columns are optional and unknown ones are ignored. - Full credentials are resolved server-side during import and never appear in the scan payload. Fetch model lists: - Probes the provider's Base URL for an OpenAI-compatible /models endpoint, walking cc-switch's candidate ladder (version segments and nine vendor compat suffixes) and falling through on 404/405. - Only http(s) endpoints are fetched; a 2xx that carries no model list is reported as a failure with the upstream's own message rather than as an empty catalog, so a key rejected behind a 200 is not read as "this provider has no models".