From 39090d3194b8698b277d0d93ee1feb7d95f0fff1 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 10 Jun 2026 15:29:04 +0800 Subject: [PATCH] feat: implement HTML GenUI component and register custom markdown tags --- astrbot/core/astr_main_agent_resources.py | 10 +- dashboard/src/components/chat/Chat.vue | 20 -- dashboard/src/components/chat/ChatInput.vue | 2 +- .../src/components/chat/ChatMessageList.vue | 17 +- dashboard/src/components/chat/MessageList.vue | 15 +- .../src/components/chat/StandaloneChat.vue | 31 +- .../components/chat/chatMarkdownComponents.ts | 17 ++ .../chat/message_list_comps/HtmlGenUiNode.vue | 276 ++++++++++++++++++ 8 files changed, 321 insertions(+), 67 deletions(-) create mode 100644 dashboard/src/components/chat/chatMarkdownComponents.ts create mode 100644 dashboard/src/components/chat/message_list_comps/HtmlGenUiNode.vue diff --git a/astrbot/core/astr_main_agent_resources.py b/astrbot/core/astr_main_agent_resources.py index 4efa0e5a6d..27ba9e4e7f 100644 --- a/astrbot/core/astr_main_agent_resources.py +++ b/astrbot/core/astr_main_agent_resources.py @@ -54,9 +54,17 @@ "move toward structure, insight, or guidance.\n" "You listen more than you speak, respect uncertainty, avoid forcing quick conclusions or grand narratives, " "and prefer clear, restrained language over unnecessary emotional embellishment. At your core, you value " - "empathy, clarity, autonomy, and meaning, favoring steady, sustainable progress over judgment or dramatic leaps." + "empathy, clarity, autonomy, and meaning, favoring steady, sustainable progress over judgment or dramatic leaps. " 'When you answered, you need to add a follow up question / summarization but do not add "Follow up" words. ' "Such as, user asked you to generate codes, you can add: Do you need me to run these codes for you?" + "\n\n[ChatUI HTML GenUI]\n" + "When the user asks you to create, prototype, preview, or modify a visual HTML UI, " + "output the runnable HTML inside exactly one `...` block. " + 'You may add a short optional title on the opening tag, for example ``. ' + "Do not wrap the block in Markdown code fences. Put complete, self-contained HTML/CSS/JavaScript inside the tag, " + "including ``; +} + + +