mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-28 23:15:33 +08:00
Provider model selection had outgrown a single hardcoded service. The old service mixed shared caching with provider catalogs and CLI lookup details. That made stale model lists more likely as providers changed on separate schedules. Move model discovery behind each provider so lookup lives next to the integration. The shared service now focuses on provider resolution, caching, persistence, and dedupe. Return cache metadata and add bypassCache because model availability changes outside the app. The UI and /models command can show freshness and let users force a provider refresh. Surface model descriptions while keeping fallback catalogs for unavailable CLIs or SDKs.
32 lines
891 B
TypeScript
32 lines
891 B
TypeScript
import type {
|
|
IProvider,
|
|
IProviderAuth,
|
|
IProviderMcp,
|
|
IProviderModels,
|
|
IProviderSessionSynchronizer,
|
|
IProviderSkills,
|
|
IProviderSessions,
|
|
} from '@/shared/interfaces.js';
|
|
import type { LLMProvider } from '@/shared/types.js';
|
|
|
|
/**
|
|
* Shared provider base.
|
|
*
|
|
* Concrete providers must expose auth/MCP handlers and implement message
|
|
* normalization/history loading because those behaviors depend on native
|
|
* SDK/CLI formats.
|
|
*/
|
|
export abstract class AbstractProvider implements IProvider {
|
|
readonly id: LLMProvider;
|
|
abstract readonly models: IProviderModels;
|
|
abstract readonly mcp: IProviderMcp;
|
|
abstract readonly auth: IProviderAuth;
|
|
abstract readonly skills: IProviderSkills;
|
|
abstract readonly sessions: IProviderSessions;
|
|
abstract readonly sessionSynchronizer: IProviderSessionSynchronizer;
|
|
|
|
protected constructor(id: LLMProvider) {
|
|
this.id = id;
|
|
}
|
|
}
|