refactor: remove Workers AI as any with proper type definitions
- Add WorkersAIModel, WorkersAITextGenerationInput/Output types - Remove `as any` from summary-service.ts (4 instances) - Remove `as any` from bank-sms-parser.ts (3 instances) - Remove `as any` from n8n-service.ts (2 instances) - Add OpenAIResponse interface for API responses Type-safe Workers AI calls with full IntelliSense support. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
28
src/types.ts
28
src/types.ts
@@ -320,3 +320,31 @@ export interface DomainRegisterKeyboardData {
|
||||
}
|
||||
|
||||
export type KeyboardData = DomainRegisterKeyboardData;
|
||||
|
||||
// Workers AI Types (from worker-configuration.d.ts)
|
||||
export type WorkersAIModel =
|
||||
| '@cf/meta/llama-3.1-8b-instruct'
|
||||
| '@cf/meta/llama-3.2-3b-instruct'
|
||||
| '@cf/meta/llama-3-8b-instruct';
|
||||
|
||||
export interface WorkersAIMessage {
|
||||
role: 'system' | 'user' | 'assistant';
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface WorkersAITextGenerationInput {
|
||||
prompt?: string;
|
||||
messages?: WorkersAIMessage[];
|
||||
max_tokens?: number;
|
||||
temperature?: number;
|
||||
stream?: boolean;
|
||||
}
|
||||
|
||||
export interface WorkersAITextGenerationOutput {
|
||||
response?: string;
|
||||
usage?: {
|
||||
prompt_tokens: number;
|
||||
completion_tokens: number;
|
||||
total_tokens: number;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user