feat: 统一聊天 Markdown 渲染

- 新增 ChatTimeMarkdown 并在管理端、用户端聊天入口复用

- 收敛聊天页面重复 Markdown 样式,保留工具和思考块独立渲染
This commit is contained in:
2026-05-18 09:59:59 +08:00
parent a186066641
commit 0947009ee6
15 changed files with 638 additions and 107 deletions

View File

@@ -12,10 +12,9 @@ import {
ref,
watch,
} from 'vue';
import ElXMarkdown from 'vue-element-plus-x/es/XMarkdown/index.js';
import { useRoute, useRouter } from 'vue-router';
import { ChatThinkingBlock } from '@easyflow/common-ui';
import { ChatThinkingBlock, ChatTimeMarkdown } from '@easyflow/common-ui';
import { LOGIN_PATH } from '@easyflow/constants';
import { IconifyIcon } from '@easyflow/icons';
import { $t } from '@easyflow/locales';
@@ -1854,9 +1853,9 @@ function prefetchVisibleVariants() {
]"
>
<template v-if="segment.type === 'text'">
<ElXMarkdown
<ChatTimeMarkdown
class="public-chat-markdown"
:markdown="segment.content"
:content="segment.content"
/>
</template>
<template v-else-if="segment.type === 'thinking'">
@@ -2342,50 +2341,10 @@ function prefetchVisibleVariants() {
box-shadow: 0 2px 6px rgb(15 23 42 / 5%);
}
.public-chat-markdown {
color: var(--pc-ink);
}
.public-chat-thinking-block {
margin-bottom: 8px;
}
.public-chat-markdown :deep(*) {
overflow-wrap: anywhere;
}
.public-chat-markdown :deep(p) {
margin: 0 0 10px;
}
.public-chat-markdown :deep(p:last-child) {
margin-bottom: 0;
}
.public-chat-markdown :deep(a) {
color: var(--pc-primary);
word-break: break-all;
text-decoration: underline;
}
.public-chat-markdown :deep(img) {
display: block;
max-width: min(100%, 420px);
height: auto;
margin: 10px 0;
border: 1px solid #dbe5f1;
border-radius: 10px;
box-shadow: 0 6px 18px rgb(15 23 42 / 8%);
}
.public-chat-markdown :deep(pre) {
padding: 10px 12px;
overflow: auto;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
}
.public-chat-tool-header {
display: flex;
gap: 8px;