From 383e68188c15eaf51cc0c6779bd165c3f711fb6c Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Sun, 26 Apr 2026 01:04:23 +0800 Subject: [PATCH] fix: stabilize show_html rendering and restore conversation mode state --- core/web_terminal.py | 3 + prompts/main_system.txt | 9 ++ prompts/main_system_qwenvl.txt | 9 ++ server/context.py | 2 + server/conversation.py | 3 + server/tasks.py | 4 +- static/src/app/bootstrap.ts | 134 ++++++++++++------ static/src/app/methods/conversation.ts | 42 ++---- static/src/app/methods/ui.ts | 23 ++- static/src/composables/useScrollControl.ts | 9 +- .../styles/components/chat/_chat-area.scss | 2 +- 11 files changed, 163 insertions(+), 77 deletions(-) diff --git a/core/web_terminal.py b/core/web_terminal.py index e20f776..e52bf2b 100644 --- a/core/web_terminal.py +++ b/core/web_terminal.py @@ -229,6 +229,9 @@ class WebTerminal(MainTerminal): "conversation_id": conversation_id, "title": conversation_data.get("title", "未知对话"), "messages_count": len(self.context_manager.conversation_history), + "run_mode": self.run_mode, + "thinking_mode": self.thinking_mode, + "model_key": getattr(self, "model_key", None), "message": f"对话已加载: {conversation_id}" } else: diff --git a/prompts/main_system.txt b/prompts/main_system.txt index a37c342..a06fcc8 100644 --- a/prompts/main_system.txt +++ b/prompts/main_system.txt @@ -53,9 +53,18 @@ 如需在界面直接渲染 HTML 预览,使用 `...`。 - `ratio` 只能从以下五种里选:`1:1`、`16:9`、`9:16`、`4:3`、`3:4` +- 各比例对应的前端基准渲染尺寸(宽 x 高)如下,请按这些尺寸去设计元素大小与间距: + - `1:1` → `620x620` + - `16:9` → `620x349` + - `9:16` → `620x1102` + - `4:3` → `620x465` + - `3:4` → `620x827` + - 说明:以上为基准像素,最终仍会按窗口与容器可用空间自适应裁剪 - **禁止**输出 `width` / `height` 属性,最终像素尺寸由前端根据窗口自适应 +- 实际展示给用户的渲染后内容长宽都很小,可能只有几百 px;需主动使用合适的间距调整、合适的元素大小和距离(如 `padding`/`gap`/`line-height`)保证内容可读、不过度留白 - 标签内容只写 **HTML + CSS**,不要写 JavaScript - 禁止输出 `