diff --git a/src/components/AiChat.vue b/src/components/AiChat.vue index 1fd20e8..1bce7f2 100644 --- a/src/components/AiChat.vue +++ b/src/components/AiChat.vue @@ -44,7 +44,7 @@ class="ai-chat__msg" :class="msg.role === 'assistant' ? 'ai-chat__msg--ai' : 'ai-chat__msg--user'" > -
+
@@ -178,6 +178,13 @@ const quickQuestions = computed(() => { /** 用户提问列表(等同于 quickQuestions) */ const userQuestions = computed(() => quickQuestions.value) +// ==================== 内容格式化 ==================== + +/** 将消息中的换行符转为 HTML 换行标签 */ +function formatContent(content: string): string { + return content.replace(/\n/g, '
') +} + // ==================== 滚动控制 ==================== /** 滚动到聊天区域底部 */