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>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { getAIProvider } from '@/lib/ai/factory'
|
||||
import { getSystemConfig } from '@/lib/config'
|
||||
|
||||
export interface NoteForOrganization {
|
||||
id: string
|
||||
@@ -100,7 +101,8 @@ export class BatchOrganizationService {
|
||||
const prompt = this.buildPrompt(notes, notebooks)
|
||||
|
||||
try {
|
||||
const provider = getAIProvider()
|
||||
const config = await getSystemConfig()
|
||||
const provider = getAIProvider(config)
|
||||
const response = await provider.generateText(prompt)
|
||||
|
||||
// Parse AI response
|
||||
|
||||
Reference in New Issue
Block a user