fix: AI客服+合同审查回复格式化;review.js修复;积分充值流程完善
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
</view>
|
||||
<!-- 对话消息 -->
|
||||
<view v-for="(msg, i) in messages" :key="i" :id="'msg' + i" :class="['msg-item', msg.role]">
|
||||
<view class="bubble" v-html="msg.content"></view>
|
||||
<view class="bubble" v-html="formatContent(msg.content)"></view>
|
||||
</view>
|
||||
<view v-if="loading" class="msg-item assistant" id="msg-loading">
|
||||
<view class="bubble typing">思考中...</view>
|
||||
@@ -50,6 +50,18 @@
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
formatContent(text) {
|
||||
if (!text) return '';
|
||||
// 处理 markdown 加粗 **text**
|
||||
let html = text.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
|
||||
// 处理列表项 - xxx 或 • xxx
|
||||
html = html.replace(/^[\-\•]\s+(.+)$/gm, '<div style="padding-left:12px;">• $1</div>');
|
||||
// 处理数字列表 1. xxx
|
||||
html = html.replace(/^(\d+)\.\s+(.+)$/gm, '<div style="padding-left:12px;">$1. $2</div>');
|
||||
// 换行转 <br>
|
||||
html = html.replace(/\n/g, '<br>');
|
||||
return html;
|
||||
},
|
||||
toggle() {
|
||||
this.visible = !this.visible;
|
||||
if (this.visible) {
|
||||
|
||||
Reference in New Issue
Block a user