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:
kappa
2026-01-19 23:42:17 +09:00
parent 61e5185916
commit a2cb4ce686
4 changed files with 64 additions and 13 deletions

View File

@@ -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;
};
}