- Added multi-provider AI infrastructure (OpenAI/Ollama) - Implemented real-time tag suggestions with debounced analysis - Created AI diagnostics and database maintenance tools in Settings - Added automated garbage collection for orphan labels - Refined UX with deterministic color hashing and interactive ghost tags
2.1 KiB
2.1 KiB
Story 2.1: Infrastructure IA & Abstraction Provider
Status: done
Story
As an administrator, I want to configure my AI provider (OpenAI or Ollama) centrally, so that the application can use artificial intelligence securely.
Acceptance Criteria
- Given an
AIProviderinterface and theVercel AI SDKinstalled. - When I provide my API key or Ollama instance URL in environment variables.
- Then the system initializes the appropriate driver.
- And no API keys are exposed to the client-side.
Tasks / Subtasks
- Installation du Vercel AI SDK (AC: 1)
npm install ai @ai-sdk/openai ollama-ai-provider
- Création de l'interface d'abstraction
AIProvider(AC: 1, 3)- Définir les méthodes standard (ex:
generateTags(content: string),getEmbeddings(text: string))
- Définir les méthodes standard (ex:
- Implémentation des drivers (AC: 3)
OpenAIProviderutilisant le SDK officielOllamaProviderpour le support local
- Configuration via variables d'environnement (AC: 2, 4)
- Gérer
AI_PROVIDER,OPENAI_API_KEY,OLLAMA_BASE_URLdans.env - Créer une factory pour initialiser le bon provider au démarrage du serveur
- Gérer
- Test de connexion (AC: 3)
- Créer un endpoint de santé/test pour vérifier la communication avec le provider configuré
Senior Developer Review (AI)
- Review Date: 2026-01-08
- Status: Approved with auto-fixes
- Fixes Applied:
- Switched to
generateObjectwith Zod for robust parsing. - Added strict error handling and timeouts.
- Improved prompts and system messages.
- Switched to
Dev Agent Record
Agent Model Used
BMad Master (Gemini 2.0 Flash)
Debug Log References
- Infrastructure created in keep-notes/lib/ai
- Packages: ai, @ai-sdk/openai, ollama-ai-provider
- Test endpoint: /api/ai/test
Completion Notes List
- Abstraction interface defined
- Factory pattern implemented
- OpenAI and Ollama drivers ready
- API test route created
File List
- keep-notes/lib/ai/types.ts
- keep-notes/lib/ai/factory.ts
- keep-notes/lib/ai/providers/openai.ts
- keep-notes/lib/ai/providers/ollama.ts
- keep-notes/app/api/ai/test/route.ts
Status: review