Merge branch 'dev' into hugo

This commit is contained in:
hugo committed 2026-06-10 15:15:13 +08:00
commit 8a541211b7
2 files changed
+205 -22

No files matched your search

+28 -5
View File
@@ -349,7 +349,11 @@ const renderMarkdown = (text: string) => {
const displayText = sanitizeShippingConversationText(stripReasoningPrelude(stripped));
try {
// 把 # 标题、代码块、[链接](url) 等 Markdown 解析成 HTML
return marked.parse(displayText);
const rendered = marked.parse(displayText);
const html = typeof rendered === 'string' ? rendered : displayText;
return html.replace(/<table\b[\s\S]*?<\/table>/gi, (tableHtml: string) => (
`<div class="chat-table-scroll"><div class="chat-table-inner">${tableHtml}</div></div>`
));
} catch (e) {
return displayText;
}
@@ -4914,7 +4918,7 @@ const showChatRating = ref(false);
</div>
<div
v-else
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-table:w-full prose-table:border-collapse prose-th:border prose-th:border-slate-200 prose-th:bg-slate-50 prose-th:px-3 prose-th:py-2 prose-th:text-left prose-td:border prose-td:border-slate-200 prose-td:px-3 prose-td:py-2"
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-th:border prose-th:border-slate-200 prose-th:bg-slate-50 prose-th:px-3 prose-th:py-2 prose-th:text-left prose-td:border prose-td:border-slate-200 prose-td:px-3 prose-td:py-2"
@click="handleChatMarkdownClick"
v-html="renderMarkdown(msg.content)"
></div>
@@ -5658,10 +5662,28 @@ const showChatRating = ref(false);
</template>
<style scoped>
:deep(.chat-markdown table) {
width: 100%;
border-collapse: collapse;
:deep(.chat-markdown) {
max-width: 100%;
}
:deep(.chat-markdown .chat-table-scroll) {
max-width: 100%;
overflow-x: auto;
overflow-y: hidden;
margin: 0.75rem 0;
-webkit-overflow-scrolling: touch;
}
:deep(.chat-markdown .chat-table-inner) {
width: max-content;
min-width: 100%;
}
:deep(.chat-markdown table) {
width: max-content;
min-width: 100%;
border-collapse: collapse;
margin: 0;
font-size: 0.875rem;
}
@@ -5671,6 +5693,7 @@ const showChatRating = ref(false);
padding: 0.5rem 0.75rem;
text-align: left;
vertical-align: top;
white-space: nowrap;
}
:deep(.chat-markdown th) {