Keep/URGENT-FIX.md
sepehr 3dd48e248c fix: 8 AI services were not using configured provider
CRITICAL FIX: Auto-labels, notebook summaries, and other AI features
were not working because 8 services were calling getAIProvider() WITHOUT
passing the config parameter.

This caused them to use the default 'ollama' provider instead of
the configured OpenAI provider from the database.

ROOT CAUSE ANALYSIS:
Working features (titles):
- title-suggestions/route.ts: getAIProvider(config) ✓

Broken features (auto-labels, summaries):
- contextual-auto-tag.service.ts: getAIProvider() ✗ (2x)
- notebook-summary.service.ts: getAIProvider() ✗
- auto-label-creation.service.ts: getAIProvider() ✗
- notebook-suggestion.service.ts: getAIProvider() ✗
- batch-organization.service.ts: getAIProvider() ✗
- embedding.service.ts: getAIProvider() ✗ (2x)

FIXED: All 8 services now properly call:
  const config = await getSystemConfig()
  const provider = getAIProvider(config)

This ensures ALL AI features use the provider configured in the admin
interface (OpenAI) instead of defaulting to Ollama.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 23:34:16 +01:00

1.5 KiB

🚨 CORRECTION URGENTE - DÉPLOIEMENT IMMÉDIAT

Le problème qui a été corrigé

Le formulaire admin ne sauvegardait PAS correctement la configuration AI dans la base de données !

CORRECTIONS EFFECTUÉES

  1. Formulaire admin avec validation et logs
  2. Sauvegarde filtre les valeurs vides
  3. Script d'initialisation OpenAI créé

🚀 DÉPLOIEMENT MAINTENANT (5 min)

# Sur votre serveur Proxmox
cd /path/to/Keep
git pull

# OPTION 1: Initialiser OpenAI dans la DB (RECOMMANDÉ)
cd keep-notes
npx tsx scripts/setup-openai.ts

# OU OPTION 2: Configurer via l'interface
# Ouvrez http://192.168.1.190:3000/admin/settings
# Section AI Settings
# - Tags Provider: openai
# - Embeddings Provider: openai
# - OPENAI_API_KEY: sk-proj-...
# Cliquez "Save AI Settings"

# Redémarrer l'application
cd ..
docker compose down
docker compose up -d

# Vérifier que ça marche
curl http://192.168.1.190:3000/api/debug/config

RÉSULTAT ATTENDU

{
  "AI_PROVIDER_TAGS": "openai",
  "AI_PROVIDER_EMBEDDING": "openai",
  "AI_MODEL_TAGS": "gpt-4o-mini",
  "AI_MODEL_EMBEDDING": "text-embedding-3-small",
  "OPENAI_API_KEY": "set (hidden)"
}

🧪 TESTS

Ouvrez http://192.168.1.190:3000 et:

  1. Créez une note
  2. Testez: Ctrl+M (génération titres)
  3. Testez: Auto-labels
  4. Testez: Clarify/Shorten/Improve Style

PLUS d'erreurs "AI_PROVIDER_TAGS is not configured" ! 🎉

💤 BONNE NUIT !

Une fois le déploiement fait, tout devrait marcher. Dormez tranquille ! 😴