feat(02-01): implement config loader and Gemini API client
- Config loader: fetches/caches public/config.json with GeminiConfig interface - generateText: Gemini REST with 3x exponential backoff retry, returns string|null - generateImage: reference images as base64 inlineData, responseModalities: ["IMAGE"] - Rate limiting: checkRateLimit/incrementApiCall with daily reset in Settings store - Extended Settings type with apiCallsToday and lastApiCallDate fields - 18 tests across config.test.ts and gemini.test.ts, all passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,8 @@ export interface Settings {
|
||||
id: 1; // singleton
|
||||
audioEnabled: boolean;
|
||||
apiKey: string;
|
||||
apiCallsToday: { text: number; image: number };
|
||||
lastApiCallDate: string; // ISO date "YYYY-MM-DD"
|
||||
}
|
||||
|
||||
// Level definition (used in game/levels.ts)
|
||||
|
||||
Reference in New Issue
Block a user