From 4e3e6031d4b60e8eb97723befbf6c6e84472bca6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 7 May 2026 23:06:13 +0200 Subject: [PATCH] fix assistant image follow-up routing --- public/js/clinicalAssistant.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/js/clinicalAssistant.js b/public/js/clinicalAssistant.js index 74aee4e..2df0468 100644 --- a/public/js/clinicalAssistant.js +++ b/public/js/clinicalAssistant.js @@ -915,7 +915,10 @@ import { escapeAttr, escapeHtml, renderAssistantMarkdown, stripSourcesSection } } function isImageRequest(text) { - return /\b(generate|create|draw|make|render)\b[\s\S]{0,80}\b(image|picture|illustration|visual|infographic|diagram|flowchart)\b/i.test(text) || + text = String(text || '').trim(); + return /^(image|photo|picture|visual|illustration|diagram|figure|flowchart|infographic)$/i.test(text) || + /\b(show|see|display|view|image|photo|picture|visual|illustration|diagram|figure)\b/i.test(text) && text.split(/\s+/).length <= 6 || + /\b(generate|create|draw|make|render)\b[\s\S]{0,80}\b(image|picture|illustration|visual|infographic|diagram|flowchart)\b/i.test(text) || /\b(generate|create|draw|make|render)\b[\s\S]{0,80}\b(an?|the)?\s*(algorithm|pathway|poster|teaching visual)\b/i.test(text); }