picoclaw/pkg/providers
肆月 d2c0b69243
feat(web,api): provider selection and model form foundation (#2831)
* feat: improve model configuration workflows

Add model catalog browsing, provider registry with form validation,
model fetch/test dialogs, and enhanced model management UI.

- Add model catalog API and catalog-dialog component for browsing saved models
- Add provider-registry with auto-populated form fields per provider
- Add provider-combobox, fetch-models-dialog, test-model-dialog components
- Add model-validation for provider-aware model ID validation
- Add command and popover UI components
- Enhance edit-model-sheet with tool schema transform support
- Add anthropic to protocolMetaByName for correct default API base
- Apply NormalizeBaseURL to anthropic provider for consistent URL handling
- Add i18n keys for new model management features (en/zh)

* fix(web): prevent auto-fetch when API key is missing in fetch models dialog

When a provider requires an API key but none is set, the dialog now shows
the warning without triggering a doomed fetch attempt. Fetch is deferred
until the user provides a key.

* fix(web): add credential warning for catalog imports from remote providers

When importing models from a catalog entry whose provider requires an API
key, a yellow warning banner now informs users that credentials will need
to be configured after import.

* feat(web,api): test connection with real connectivity verification and unsaved form values

Add POST /api/models/test-inline endpoint that performs actual network
probes (GET /models) instead of just checking config. Frontend Test
Connection now uses current form values (not saved state) and is
available in both Add and Edit model flows.

* style(web): apply linter formatting across model config components

Normalize quote style, import ordering, and class name ordering as
reported by the project linter.

* fix(web,api): fix edit test connection false negative and gate fetch for unsupported providers

- handleTestInlineModel now accepts optional model_index to fall back to stored credentials when api_key is empty, fixing false negatives when testing edited models
- Add supportsFetch to provider registry and FETCHABLE_PROVIDER_KEYS derived set
- Gate Fetch Models button to only show for OpenAI-compatible and Ollama providers
- Add backend guard in handleFetchModels to reject unsupported providers with clear error

* fix: address review feedback on model config workflow

- Send explicit {} for empty extra_body/custom_headers fields so the
  backend clears stored values instead of preserving them
- Merge backend provider_options with frontend PROVIDERS registry so
  the provider picker reflects backend-supported providers and policy
  fields (create_allowed, default_auth_method, auth_method_locked)
- Render provider combobox popover inside the sheet scroll container
  to fix wheel events scrolling the sheet instead of the provider list

* feat(web,api): add provider selection, model form foundation, and validation

Split from PR #2752 (part 1 of 3).

Backend:
- CRUD model endpoints (list/add/update/delete/set-default)
- Provider metadata with default API bases and model provider options
- Model ID validation and normalization
- Anthropic default API base normalization

Frontend:
- Provider registry with metadata, labels, icons, and aliases
- Provider combobox with backend option merging
- Model field validation with provider-aware checks
- Redesigned add/edit model sheets with provider selection
- Dynamic imports for fetch/catalog/test dialogs (coming in PR2/PR3)
- i18n support for model configuration UI
2026-05-11 16:57:37 +08:00
..
anthropic Deduplicate further functions 2026-04-23 05:50:37 +00:00
anthropic_messages Deduplicate further functions 2026-04-23 05:50:37 +00:00
azure feat: add userAgent config for ModelConfig (#2242) 2026-04-02 11:44:13 +08:00
bedrock test(bedrock): add unit tests for ChatStream/parseStreamResponse 2026-04-29 21:17:16 +02:00
cli Feat(channels): unify animated tool feedback across chat channels and Pico (#2622) 2026-04-23 10:35:50 +08:00
common feat(tool): tool schema semplification 2026-04-27 21:10:30 +02:00
httpapi feat(tool): tool schema semplification 2026-04-27 21:10:30 +02:00
messageutil fix(messageutil): remove dead code 2026-04-24 22:16:18 +08:00
oauth feat(tool): tool schema semplification 2026-04-27 21:10:30 +02:00
openai_compat fix(seahorse): persist reasoning_content in sqlite history (#2707) 2026-04-30 16:07:38 +08:00
openai_responses_common Deduplicate ParseDataAudioURL function 2026-04-23 05:50:37 +00:00
protocoltypes feat(agent): migrate tool prompts to capability slots 2026-04-24 19:36:46 +08:00
cli_facade.go refactor(providers): reorganize provider packages and facades 2026-04-17 12:42:03 +08:00
cli_factory_test.go refactor(providers): reorganize provider packages and facades 2026-04-17 12:42:03 +08:00
cooldown.go style: fix gofmt formatting in cooldown files 2026-02-13 12:26:44 -03:00
cooldown_test.go refactor(modernize): apply safe modernize fixes 2026-02-27 16:35:07 +08:00
error_classifier.go fix(network): classify timeout errors as FailoverTimeout 2026-04-16 22:00:13 +08:00
error_classifier_test.go fix(network): classify timeout errors as FailoverTimeout 2026-04-16 22:00:13 +08:00
facade_compat_test.go fix(providers,tools): address linter issues after reorg 2026-04-17 14:16:18 +08:00
factory.go refactor Config to add Version and migratable 2026-03-12 13:52:55 +08:00
factory_provider.go feat(web,api): provider selection and model form foundation (#2831) 2026-05-11 16:57:37 +08:00
factory_provider_test.go feat(provider,web,asr): enhance model management with explicit provider metadata (#2701) 2026-05-06 16:06:49 +08:00
factory_test.go refactor: seperate security.yml for store keys 2026-03-22 01:55:00 +08:00
fallback.go feat(model): llm rate limiting (#2198) 2026-04-02 19:26:26 +08:00
fallback_multikey_test.go feat(model): llm rate limiting (#2198) 2026-04-02 19:26:26 +08:00
fallback_test.go refactor(tests): extract common logic for fallback error handling into a helper function 2026-04-16 22:45:31 +08:00
httpapi_facade.go refactor(providers): reorganize provider packages and facades 2026-04-17 12:42:03 +08:00
legacy_provider.go refactor Config to add Version and migratable 2026-03-12 13:52:55 +08:00
model_ref.go feat(provider,web,asr): enhance model management with explicit provider metadata (#2701) 2026-05-06 16:06:49 +08:00
model_ref_test.go feat(provider,web,asr): enhance model management with explicit provider metadata (#2701) 2026-05-06 16:06:49 +08:00
oauth_facade.go refactor(providers): reorganize provider packages and facades 2026-04-17 12:42:03 +08:00
provider_catalog.go feat(provider,web,asr): enhance model management with explicit provider metadata (#2701) 2026-05-06 16:06:49 +08:00
ratelimiter.go feat(model): llm rate limiting (#2198) 2026-04-02 19:26:26 +08:00
ratelimiter_test.go feat(model): llm rate limiting (#2198) 2026-04-02 19:26:26 +08:00
tool_schema_transform.go feat(tool): tool schema semplification 2026-04-27 21:10:30 +02:00
tool_schema_transform_test.go fix test 2026-04-27 21:18:19 +02:00
toolcall_utils_test.go Feat(channels): unify animated tool feedback across chat channels and Pico (#2622) 2026-04-23 10:35:50 +08:00
types.go feat(web): download files on frontend (#2563) 2026-04-22 11:28:04 +08:00