feat: publication IA (magazine/brief/essay) + fixes critique
Publication IA: - 4 templates (magazine, brief, essay, simple) avec CSS riche - Rewrite IA (article/exercises/tutorial/reference/mixed) - Modération avec timeout 12s + fallback safe - Quotas publish_enhance par tier (basic=2, pro=15, business=100) - Détection contenu stale (hash) - Migration DB publishedContent/publishedTemplate/publishedSourceHash Fixes: - cheerio v1.2: Element -> AnyNode (domhandler), decodeEntities cast - _isShared ajouté au type Note (champ virtuel serveur) - callout colors PDF export: extraction fonction pure testable - admin/published: guard note.userId null - Cmd+S fonctionne en mode dialog (pas seulement fullPage) i18n: - 23 clés publish* traduites dans les 15 locales - Extension Web Clipper: 13 locales mise à jour Tests: - callout-colors.test.ts (6 tests) - note-visible-in-view.test.ts (5 tests) - entitlements.test.ts + byok-entitlements.test.ts: mock usageLog + unstubAllEnvs - 199/199 tests passent Tracker: user-stories.md sync avec sprint-status.yaml
This commit is contained in:
@@ -39,7 +39,7 @@ export interface ExecuteResult {
|
||||
/**
|
||||
* Analyze a notebook's notes with AI and suggest a sub-notebook organization plan.
|
||||
*/
|
||||
export async function analyzeNotebookForOrganization(notebookId: string): Promise<AnalyzeResult> {
|
||||
export async function analyzeNotebookForOrganization(notebookId: string, language?: string): Promise<AnalyzeResult> {
|
||||
const session = await auth()
|
||||
if (!session?.user?.id) return { success: false, error: 'Non autorisé' }
|
||||
|
||||
@@ -94,6 +94,9 @@ export async function analyzeNotebookForOrganization(notebookId: string): Promis
|
||||
? `\nSous-carnets existants:\n${existingSubs.map(s => `- "${s.name}" (id: ${s.id})`).join('\n')}`
|
||||
: '\nIl n\'y a pas encore de sous-carnets.'
|
||||
|
||||
const lang = language || 'fr'
|
||||
const langName = lang === 'fr' ? 'français' : lang === 'en' ? 'English' : lang === 'fa' ? 'فارسی' : lang === 'ar' ? 'العربية' : lang === 'de' ? 'Deutsch' : lang === 'es' ? 'Español' : lang === 'it' ? 'Italiano' : lang === 'pt' ? 'Português' : lang === 'ru' ? 'Русский' : lang === 'zh' ? '中文' : lang === 'ja' ? '日本語' : lang === 'ko' ? '한국어' : lang === 'nl' ? 'Nederlands' : lang === 'pl' ? 'Polski' : lang === 'hi' ? 'हिन्दी' : lang
|
||||
|
||||
const prompt = `Tu es un assistant d'organisation de notes. Analyse les notes suivantes du carnet "${notebook.name}" et regroupe-les par thème en proposant des sous-carnets.
|
||||
${existingSubsContext}
|
||||
|
||||
@@ -104,7 +107,7 @@ RÈGLES IMPORTANTES:
|
||||
- Regroupe les notes par thème ou sujet similaire.
|
||||
- Propose entre 2 et 6 groupes maximum.
|
||||
- Si un sous-carnet existant correspond déjà à un thème, utilise-le (indique son id).
|
||||
- Les noms de groupe doivent être courts (2-4 mots), clairs et en français.
|
||||
- Les noms de groupe doivent être courts (2-4 mots), clairs et EN ${langName.toUpperCase()}.
|
||||
- N'inclus PAS toutes les notes si certaines sont trop générales ou ne correspondent à aucun groupe clair — laisse-les de côté.
|
||||
- Réponds UNIQUEMENT avec du JSON valide, sans markdown, sans explication.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user