src/lib/providers.ts holds a per-provider spec (url, headers, body, extractor, default model) and a single callProvider() covering both the action-prompt and custom-prompt families (~250 lines -> one path). getSystemPrompt, fetchWithTimeout, and listModels move along with it; background.ts drops from 553 to 130 lines. Behavior pinned by 20 parity tests written from the old functions (request shapes, headers, defaults, error strings). One deliberate change: max_tokens now scales with input length (1024-8192) instead of a hard-coded 1024, so Expand no longer truncates long selections. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
8.6 KiB
8.6 KiB