feat(ai): implement intelligent auto-tagging system
- 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
This commit is contained in:
25
keep-notes/lib/ai/factory.ts
Normal file
25
keep-notes/lib/ai/factory.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { OpenAIProvider } from './providers/openai';
|
||||
import { OllamaProvider } from './providers/ollama';
|
||||
import { AIProvider } from './types';
|
||||
|
||||
export function getAIProvider(): AIProvider {
|
||||
const providerType = process.env.AI_PROVIDER || 'ollama'; // Default to ollama for local dev
|
||||
|
||||
switch (providerType.toLowerCase()) {
|
||||
case 'ollama':
|
||||
console.log('Using Ollama Provider with model:', process.env.OLLAMA_MODEL || 'granite4:latest');
|
||||
return new OllamaProvider(
|
||||
process.env.OLLAMA_BASE_URL || 'http://localhost:11434/api',
|
||||
process.env.OLLAMA_MODEL || 'granite4:latest'
|
||||
);
|
||||
case 'openai':
|
||||
default:
|
||||
if (!process.env.OPENAI_API_KEY) {
|
||||
console.warn('OPENAI_API_KEY non configurée. Les fonctions IA pourraient échouer.');
|
||||
}
|
||||
return new OpenAIProvider(
|
||||
process.env.OPENAI_API_KEY || '',
|
||||
process.env.OPENAI_MODEL || 'gpt-4o-mini'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user