fix: auto-tagging provider resolution, email test flow, language detection
Auto-tagging: - CRITICAL FIX: contextual-auto-tag.service.ts was calling getAIProvider() (alias for getEmbeddingsProvider) instead of getTagsProvider(). This meant auto-tagging used the embeddings provider/model instead of the tags one. Now correctly uses getTagsProvider() in both suggestFromExistingLabels and suggestNewLabels methods. - Pass user's detected language to suggestLabels() for localized prompts (was hardcoded to 'en') Email: - Fix Resend "from" field: pass DB config to sendViaResend() instead of re-fetching from DB. Uses SMTP_FROM from config, with localhost-aware fallback. - Add "Sender email" field in admin Resend section so users can set SMTP_FROM - Save SMTP_FROM when Resend is selected (was only saved for SMTP mode) - Test email button now saves config to DB BEFORE testing, so unsaved form values are used (was reading stale DB values) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -509,10 +509,26 @@ export async function createNote(data: {
|
||||
console.log('[BG] Auto-labeling check: enabled=', autoLabelingEnabled, 'confidence=', autoLabelingConfidence, 'notebookId=', notebookId)
|
||||
|
||||
if (autoLabelingEnabled) {
|
||||
// Detect user's language from their existing notes for localized prompts
|
||||
let userLang = 'en'
|
||||
try {
|
||||
const langResult = await prisma.note.groupBy({
|
||||
by: ['language'],
|
||||
where: { userId, language: { not: null } },
|
||||
_count: true,
|
||||
orderBy: { _count: { language: 'desc' } },
|
||||
take: 1,
|
||||
})
|
||||
if (langResult.length > 0 && langResult[0].language) {
|
||||
userLang = langResult[0].language
|
||||
}
|
||||
} catch {}
|
||||
|
||||
const suggestions = await contextualAutoTagService.suggestLabels(
|
||||
content,
|
||||
notebookId,
|
||||
userId
|
||||
userId,
|
||||
userLang
|
||||
)
|
||||
|
||||
console.log('[BG] Auto-labeling suggestions:', suggestions.length, suggestions.map(s => s.label))
|
||||
|
||||
Reference in New Issue
Block a user