Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(llm): improve model name display
Elian Doran12797293f0f2
diff --git a/apps/server/src/routes/api/llm_chat.ts b/apps/server/src/routes/api/llm_chat.tsindex aa5358b95c..2cc59df47c 100644--- a/apps/server/src/routes/api/llm_chat.ts+++ b/apps/server/src/routes/api/llm_chat.ts@@ -52,10 +52,11 @@ async function streamChat(req: Request, res: Response) {const provider = getProviderByType(config.provider || "anthropic");const result = provider.chat(messages, config);- // Get pricing from provider for cost calculation- const model = config.model || "claude-sonnet-4-20250514";- const pricing = provider.getModelPricing(model);- for await (const chunk of streamToChunks(result, { model, pricing })) {+ // Get pricing and display name for the model+ const modelId = config.model || "claude-sonnet-4-6";+ const pricing = provider.getModelPricing(modelId);+ const modelDisplayName = provider.getAvailableModels().find(m => m.id === modelId)?.name || modelId;+ for await (const chunk of streamToChunks(result, { model: modelDisplayName, pricing })) {res.write(`data: ${JSON.stringify(chunk)}\n\n`);// Flush immediately to ensure real-time streamingif (typeof flushableRes.flush === "function") {