From 980b16109d59e4199251eb2b538c1cbd1ca685a1 Mon Sep 17 00:00:00 2001 From: matevip Date: Sun, 19 Apr 2026 09:06:14 +0800 Subject: [PATCH] feat(ui): plain-text user messages with 8-line auto-collapse Pasted prompts (test cases, structured asks, JSON dumps) currently render through the same markdown pipeline as assistant output, so '#'/'-'/'**' characters are processed and long prompts dominate the scrollback. - New UserMessageContent.vue: plain-text rendering (white-space: pre-wrap preserves user-typed newlines and indentation), with auto-collapse beyond 8 lines and a "Show more (N more lines) / Show less" toggle. Soft mask gradient at the collapse boundary instead of a hard cut. - MessageBubble.vue: route role==='user' messages through the new component; assistant messages keep the existing markdown pipeline unchanged. - Add chat.expandLines / chat.collapse i18n keys (zh + en). Verified end-to-end in browser preview: 15-line content collapses to 8, toggle expands to full 15 with "Show less" label, raw '#' / '**' / '`' chars shown literally with no /

/
  • tags emitted. --- .../src/components/chat/MessageBubble.vue | 13 +- .../components/chat/UserMessageContent.vue | 118 ++++++++++++++++++ mateclaw-ui/src/i18n/locales/en-US.ts | 2 + mateclaw-ui/src/i18n/locales/zh-CN.ts | 2 + 4 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 mateclaw-ui/src/components/chat/UserMessageContent.vue diff --git a/mateclaw-ui/src/components/chat/MessageBubble.vue b/mateclaw-ui/src/components/chat/MessageBubble.vue index ca0bb37a..98ecc323 100644 --- a/mateclaw-ui/src/components/chat/MessageBubble.vue +++ b/mateclaw-ui/src/components/chat/MessageBubble.vue @@ -124,8 +124,16 @@ class="msg-content" :class="{ 'with-cursor': showCursor }" > -
    - + + + @@ -272,6 +280,7 @@ import ToolCallSegment from './ToolCallSegment.vue' import ThinkingSegment from './ThinkingSegment.vue' import ContentSegment from './ContentSegment.vue' import PlanStepsPanel from './PlanStepsPanel.vue' +import UserMessageContent from './UserMessageContent.vue' import type { BrowserAction } from './BrowserTimeline.vue' import type { Message, MessageSegment, ChatAttachment, ToolCallMeta, PlanMeta } from '@/types' import type { ChatErrorInfo } from '@/types/chatError' diff --git a/mateclaw-ui/src/components/chat/UserMessageContent.vue b/mateclaw-ui/src/components/chat/UserMessageContent.vue new file mode 100644 index 00000000..afd802da --- /dev/null +++ b/mateclaw-ui/src/components/chat/UserMessageContent.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index cba50482..e0a5da74 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -53,6 +53,8 @@ export default { thinkingInProgress: 'Thinking...', stopped: 'Generation stopped', interrupted: 'Interrupted', + expandLines: 'Show more ({hidden} more lines)', + collapse: 'Show less', failed: 'Generation failed', compressionSummary: 'Previous conversations summarized', compressionWithCount: '{count} previous messages summarized', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index b553c15a..07f13689 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -53,6 +53,8 @@ export default { thinkingInProgress: '思考中...', stopped: '已停止生成', interrupted: '已中断', + expandLines: '展开(还有 {hidden} 行)', + collapse: '收起', failed: '生成失败', compressionSummary: '之前的对话已整理为摘要', compressionWithCount: '之前的 {count} 条对话已整理为摘要',