feat: 8 AI providers, rich text editor, agent notifications, UI contrast & font settings
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m25s

- Add DeepSeek, OpenRouter, Mistral, Z.AI, LM Studio as AI providers
  with editable model names via Combobox in admin settings
- Fix OpenRouter broken by normalizeProvider bug in config.ts
- Convert agent-created notes from Markdown to HTML (TipTap rich text)
- Add Notification model + in-app notifications for agent results
- Agent notification click opens the created note directly
- Add note count display on notebook and inbox headers
- Fix checklist toggle in card view (persist state via localCheckItems)
- Add checklist creation option in tabs/list view (dropdown on + button)
- Fix image description ENOENT error with HTTP fallback
- Improve UI contrast across all themes (input, border, checkbox visibility)
- Add font family setting (Inter vs System Default) in Appearance settings
- Fix CSS font-sans variable conflict (removed dead Geist references)
- Update README with new features and 8 providers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sepehr Ramezani
2026-05-01 16:14:07 +02:00
parent 1345403a31
commit dbd49d6fcb
64 changed files with 4124 additions and 1392 deletions

View File

@@ -15,6 +15,8 @@ import { sendEmail } from '@/lib/mail'
import { getAgentEmailTemplate } from '@/lib/agent-email-template'
import { extractAndDownloadImages, extractImageUrlsFromHtml, downloadImage } from '../tools/extract-images'
import { calculateNextRun } from '@/lib/agents/schedule'
import { markdownToHtml } from '@/lib/markdown-to-html'
import { createNotification } from '@/app/actions/notifications'
// Import tools for side-effect registration
import '../tools'
@@ -30,6 +32,32 @@ export interface AgentExecutionResult {
error?: string
}
// --- Note creation helper ---
/** Create an agent note as rich text (TipTap-compatible HTML).
* Converts the markdown content to HTML and sets type='richtext'. */
async function createAgentNote(data: {
title: string
content: string
userId: string
notebookId: string | null
autoGenerated?: boolean
}) {
const htmlContent = markdownToHtml(data.content)
return prisma.note.create({
data: {
title: data.title,
content: htmlContent,
type: 'richtext',
isMarkdown: false,
autoGenerated: data.autoGenerated ?? true,
userId: data.userId,
notebookId: data.notebookId,
},
select: { id: true },
})
}
// --- Language Helper ---
type Lang = 'fr' | 'en'
@@ -324,15 +352,11 @@ async function executeScraperAgent(
const title = await generateTitle(fullContent, agent.name, lang)
const note = await prisma.note.create({
data: {
title,
content: fullContent,
isMarkdown: true,
autoGenerated: true,
userId: agent.userId,
notebookId: agent.targetNotebookId,
}
const note = await createAgentNote({
title,
content: fullContent,
userId: agent.userId,
notebookId: agent.targetNotebookId,
})
const logMsg = lang === 'fr'
@@ -424,15 +448,11 @@ async function executeResearcherAgent(
const title = await generateTitle(fullContent, agent.name, lang)
const note = await prisma.note.create({
data: {
title,
content: fullContent,
isMarkdown: true,
autoGenerated: true,
userId: agent.userId,
notebookId: agent.targetNotebookId,
}
const note = await createAgentNote({
title,
content: fullContent,
userId: agent.userId,
notebookId: agent.targetNotebookId,
})
const logMsg = lang === 'fr'
@@ -526,15 +546,11 @@ async function executeMonitorAgent(
const title = await generateTitle(fullContent, agent.name, lang)
const note = await prisma.note.create({
data: {
title,
content: fullContent,
isMarkdown: true,
autoGenerated: true,
userId: agent.userId,
notebookId: agent.targetNotebookId,
}
const note = await createAgentNote({
title,
content: fullContent,
userId: agent.userId,
notebookId: agent.targetNotebookId,
})
const logMsg = lang === 'fr' ? `Analyse de ${notes.length} notes. Note créée: ${note.id}` : `Analyzed ${notes.length} notes. Note created: ${note.id}`
@@ -597,15 +613,11 @@ async function executeCustomAgent(
const title = await generateTitle(fullContent, agent.name, lang)
const note = await prisma.note.create({
data: {
title,
content: fullContent,
isMarkdown: true,
autoGenerated: true,
userId: agent.userId,
notebookId: agent.targetNotebookId,
}
const note = await createAgentNote({
title,
content: fullContent,
userId: agent.userId,
notebookId: agent.targetNotebookId,
})
const toolLogData = JSON.stringify([{
@@ -966,15 +978,11 @@ async function executeToolUseAgent(
const fullContent = `# ${agent.name}\n\n${text}\n\n---\n\n_Agent execution: ${totalToolCalls} tool calls in ${Math.round(duration / 1000)}s_`
const title = await generateTitle(fullContent, agent.name, lang)
const note = await prisma.note.create({
data: {
title,
content: fullContent,
isMarkdown: true,
autoGenerated: true,
userId: agent.userId,
notebookId: agent.targetNotebookId || null,
}
const note = await createAgentNote({
title,
content: fullContent,
userId: agent.userId,
notebookId: agent.targetNotebookId || null,
})
noteId = note.id
}
@@ -1119,6 +1127,20 @@ export async function executeAgent(agentId: string, userId: string, promptOverri
}
}
// Create in-app notification for agent result
if (result.success) {
await createNotification({
userId,
type: 'agent_success',
title: agent.name,
message: result.noteId
? (lang === 'fr' ? `L'agent a terminé avec succès — note créée.` : `Agent completed successfully — note created.`)
: (lang === 'fr' ? `L'agent a terminé avec succès.` : `Agent completed successfully.`),
actionUrl: result.noteId ? `/?openNote=${result.noteId}` : '/agents',
relatedId: result.noteId || agentId,
})
}
return result
} catch (error) {
const message = error instanceof Error ? error.message : 'Unknown error'
@@ -1129,6 +1151,16 @@ export async function executeAgent(agentId: string, userId: string, promptOverri
data: { status: 'failure', log: message }
})
// Notify user of agent failure
await createNotification({
userId,
type: 'agent_failure',
title: agent?.name || 'Agent',
message: message.length > 200 ? message.substring(0, 200) + '...' : message,
actionUrl: '/agents',
relatedId: agentId,
})
return { success: false, actionId: action.id, error: message }
}
}