/** * Discovery Service Types * * 可扩展的发现服务体系,用于提供: * - Providers (AI 供应商) * - Models (模型列表) * - Tools (工具/插件) * - Agents (预设 Agent 模板) * - Prompts (提示词模板) * - 未来更多... */ export interface ProviderMetadata { slug: string; displayName: string; baseUrl: string; homepage: string; logoUrl?: string; description?: string; supportedFeatures?: ProviderFeature[]; authType?: 'bearer' | 'x-api-key' | 'query-param' | 'none'; } export type ProviderFeature = 'chat' | 'embedding' | 'image' | 'audio' | 'vision' | 'function-calling'; export interface ModelMetadata { id: string; provider: string; displayName: string; description?: string; contextLength?: number; maxOutputTokens?: number; pricing?: ModelPricing; capabilities?: ModelCapability[]; isDefault?: boolean; } export interface ModelPricing { input: number; output: number; currency?: string; } export type ModelCapability = 'chat' | 'vision' | 'function-calling' | 'streaming' | 'json-mode'; export interface ToolMetadata { id: string; name: string; displayName: string; description: string; category?: string; schema: ToolSchema; enabled?: boolean; } export interface ToolSchema { type: 'function'; function: { name: string; description: string; parameters: Record; }; } export interface AgentTemplate { id: string; name: string; displayName: string; description: string; icon?: string; provider: string; model: string; systemPrompt: string; tools?: string[]; tags?: string[]; } export interface PromptTemplate { id: string; name: string; displayName: string; description: string; category?: string; content: string; variables?: PromptVariable[]; tags?: string[]; } export interface PromptVariable { name: string; description?: string; defaultValue?: string; required?: boolean; } export interface DiscoveryRegistry { version: string; updatedAt: string; providers: ProviderMetadata[]; models: ModelMetadata[]; tools?: ToolMetadata[]; agents?: AgentTemplate[]; prompts?: PromptTemplate[]; } export interface DiscoveryService { getProviders(): Promise; getProvider(slug: string): Promise; getModels(provider?: string): Promise; getModel(provider: string, modelId: string): Promise; getDefaultModel(provider: string): Promise; getTools?(): Promise; getAgentTemplates?(): Promise; getPromptTemplates?(): Promise; }