Download apps/api/src/modules/ai/interfaces/ai.interface.ts from qf46578/omnics: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/spaces/qf46578/omnics/resolve/main/apps/api/src/modules/ai/interfaces/ai.interface.ts
- Command line
-
hf download hf://spaces/qf46578/omnics/apps/api/src/modules/ai/interfaces/ai.interface.ts
-
curl -L -o ai.interface.ts https://huggingface.co/spaces/qf46578/omnics/resolve/main/apps/api/src/modules/ai/interfaces/ai.interface.ts
1.43 kB
| /** | |
| * AI模块接口定义 | |
| */ | |
| export interface AIProvider { | |
| name: string; | |
| generate(prompt: string, options?: GenerateOptions): Promise<GenerateResult>; | |
| stream?(prompt: string, options?: GenerateOptions): AsyncIterable<string>; | |
| validateConfig(): boolean; | |
| } | |
| export interface GenerateRequest { | |
| prompt: string; | |
| systemPrompt?: string; | |
| model?: AIModel; | |
| platform?: string; | |
| role?: string; | |
| context?: ChatContext[]; | |
| options?: GenerateOptions; | |
| messageId?: string; | |
| knowledgeResult?: string | null; | |
| } | |
| export interface GenerateOptions { | |
| temperature?: number; | |
| maxTokens?: number; | |
| topP?: number; | |
| stream?: boolean; | |
| timeout?: number; | |
| } | |
| export interface GenerateResult { | |
| content: string; | |
| model: string; | |
| tokensUsed: number; | |
| finishReason?: string; | |
| } | |
| export interface GenerateResponse extends GenerateResult { | |
| requestId: string; | |
| duration: number; | |
| wasRetried?: boolean; | |
| wasFiltered?: boolean; | |
| } | |
| export interface ChatContext { | |
| role: 'user' | 'assistant' | 'system'; | |
| content: string; | |
| } | |
| export interface ModelConfig { | |
| apiKey: string; | |
| baseUrl: string; | |
| model: string; | |
| maxTokens: number; | |
| temperature: number; | |
| } | |
| export interface RetryConfig { | |
| maxRetries: number; | |
| retryDelay: number; | |
| backoffMultiplier: number; | |
| } | |
| export type AIModel = 'doubao' | 'kimi' | 'deepseek' | 'wenxin'; | |
| export interface ProviderStatus { | |
| name: string; | |
| available: boolean; | |
| latency?: number; | |
| } | |