This commit is contained in:
aaron 2025-05-11 16:29:32 +08:00
parent 1a70447b53
commit eb455551c2
2 changed files with 18 additions and 72 deletions

View File

@ -5,7 +5,7 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
image: tradus-web:1.4 image: tradus-web:1.5
container_name: tradus-web container_name: tradus-web
ports: ports:
- '6000:80' - '6000:80'

View File

@ -1,19 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, nextTick, computed, onMounted, watch } from 'vue' import { ref, nextTick, computed, onMounted, watch } from 'vue'
import { useUserStore } from '../stores/user' import { useUserStore } from '../stores/user'
import { marked } from 'marked'
// marked
marked.setOptions({
async: false,
gfm: true,
breaks: true,
})
// Markdown
const renderMarkdown = (content: string) => {
return `<div class="markdown-body">${marked.parse(content)}</div>`
}
// Agent // Agent
interface Agent { interface Agent {
@ -459,7 +446,7 @@ const getInitial = (nickname: string) => {
isTyping && typingMessageIndex === index && message.role === 'assistant', isTyping && typingMessageIndex === index && message.role === 'assistant',
}" }"
> >
<div v-html="renderMarkdown(message.content)"></div> {{ message.content }}
</div> </div>
</div> </div>
</div> </div>
@ -768,7 +755,8 @@ const getInitial = (nickname: string) => {
white-space: pre-wrap; white-space: pre-wrap;
box-sizing: border-box; box-sizing: border-box;
background-clip: padding-box; background-clip: padding-box;
line-height: 1.4; line-height: 1.6;
letter-spacing: 0.3px;
} }
.message-content.typing :deep(.markdown-body) { .message-content.typing :deep(.markdown-body) {
@ -788,7 +776,8 @@ const getInitial = (nickname: string) => {
/* 确保markdown内容正确显示 */ /* 确保markdown内容正确显示 */
:deep(.markdown-body) { :deep(.markdown-body) {
display: inline; color: inherit;
line-height: inherit;
} }
.user-message .message-content { .user-message .message-content {
@ -816,6 +805,7 @@ const getInitial = (nickname: string) => {
border: 1px solid rgba(var(--color-accent-rgb), 0.15); border: 1px solid rgba(var(--color-accent-rgb), 0.15);
font-size: 0.95rem; font-size: 0.95rem;
max-width: 600px; max-width: 600px;
line-height: 1.5;
} }
/* 调整思考消息的间距 */ /* 调整思考消息的间距 */
@ -935,63 +925,19 @@ const getInitial = (nickname: string) => {
} }
:deep(.markdown-body) { :deep(.markdown-body) {
color: var(--color-text-primary); color: inherit;
line-height: 1.4; line-height: inherit;
} }
:deep(.markdown-body p) { :deep(.markdown-body p) {
margin: 0; margin: 0;
line-height: 1.4; line-height: inherit;
display: inline-block;
}
:deep(.markdown-body p:last-child) {
margin-bottom: 0;
}
:deep(.markdown-body p:first-child) {
margin-top: 0;
}
:deep(.markdown-body h1),
:deep(.markdown-body h2),
:deep(.markdown-body h3),
:deep(.markdown-body h4),
:deep(.markdown-body h5),
:deep(.markdown-body h6) {
margin: 0.4em 0 0.2em 0;
line-height: 1.4;
}
:deep(.markdown-body pre) {
margin: 0.3em 0;
padding: 0.5em;
background-color: var(--color-bg-secondary);
border: 1px solid var(--color-border);
border-radius: var(--border-radius);
}
:deep(.markdown-body blockquote) {
margin: 0.3em 0;
padding: 0.3em 0.8em;
background-color: var(--color-bg-secondary);
border-left: 4px solid var(--color-accent);
}
:deep(.markdown-body ul),
:deep(.markdown-body ol) {
margin: 0.2em 0;
padding-left: 1.2em;
}
:deep(.markdown-body li) {
margin: 0;
line-height: 1.4;
}
:deep(.markdown-body li > p) {
display: inline; display: inline;
margin: 0; }
:deep(.markdown-body p:not(:last-child)) {
display: block;
margin-bottom: 0.75em;
} }
/* 修改 Agent 选择器样式 */ /* 修改 Agent 选择器样式 */
@ -1189,7 +1135,7 @@ const getInitial = (nickname: string) => {
} }
.user-message :deep(.markdown-body) { .user-message :deep(.markdown-body) {
color: white; color: inherit;
} }
.user-message :deep(.markdown-body pre) { .user-message :deep(.markdown-body pre) {
@ -1203,12 +1149,12 @@ const getInitial = (nickname: string) => {
} }
.user-message :deep(.markdown-body a) { .user-message :deep(.markdown-body a) {
color: white; color: inherit;
text-decoration: underline; text-decoration: underline;
} }
.user-message :deep(.markdown-body code) { .user-message :deep(.markdown-body code) {
color: white; color: inherit;
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
} }