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:
2026-03-29 11:56:21 +02:00
co-authored by Claude Opus 4.6
parent 197ec24aa2
commit 2bea324962
5 changed files with 220 additions and 3 deletions
+2
View File
@@ -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)