@@ -108,9 +108,6 @@
|
||||
<view class="head-btn log-out" @click="logOut">
|
||||
<view class="iconfont icon-tuichu"></view>
|
||||
</view>
|
||||
<view class="head-btn debug-top-btn" @click="toggleDebugPanel">
|
||||
<text class="debug-top-text">{{ showDebugPanel ? '✕' : 'LOG' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -343,62 +340,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- ===== 调试面板:Socket 原始消息 ===== -->
|
||||
<view v-if="showDebugPanel" class="debug-overlay" @click="showDebugPanel = false">
|
||||
<view class="debug-panel" @click.stop>
|
||||
<view class="debug-header">
|
||||
<text class="debug-title">Socket 调试日志</text>
|
||||
<view class="debug-actions">
|
||||
<text class="debug-clear-btn" @click="clearDebugRound">清空</text>
|
||||
<text class="debug-close-btn" @click="showDebugPanel = false">✕</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 当前状态概览 -->
|
||||
<view class="debug-section">
|
||||
<view class="debug-label">当前状态</view>
|
||||
<view class="debug-state-grid">
|
||||
<view class="debug-state-item">
|
||||
<text class="state-key">连接:</text>
|
||||
<text :class="socketStore.isConnected ? 'state-val-ok' : 'state-val-err'">{{ socketStore.connectionStatus }}</text>
|
||||
</view>
|
||||
<view class="debug-state-item">
|
||||
<text class="state-key">AI思考:</text>
|
||||
<text :class="socketStore.isThinking ? 'state-val-warn' : 'state-val-ok'">{{ socketStore.isThinking ? '是' : '否' }}</text>
|
||||
</view>
|
||||
<view class="debug-state-item">
|
||||
<text class="state-key">流式ID:</text>
|
||||
<text class="state-val">{{ streamingMessageId || '-' }}</text>
|
||||
</view>
|
||||
<view class="debug-state-item">
|
||||
<text class="state-key">SessionID:</text>
|
||||
<text class="state-val">{{ (currentSessionId || '').slice(-8) || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 最后一帧原始消息 -->
|
||||
<view class="debug-section">
|
||||
<view class="debug-label">最后一帧接收</view>
|
||||
<scroll-view class="debug-raw-box" scroll-y v-if="socketStore.lastReceiveRaw">
|
||||
<text class="debug-json">{{ formatDebugJson(socketStore.lastReceiveRaw.data) }}</text>
|
||||
</scroll-view>
|
||||
<text v-else class="debug-empty">暂无接收数据</text>
|
||||
</view>
|
||||
|
||||
<!-- 本轮所有消息 -->
|
||||
<view class="debug-section">
|
||||
<view class="debug-label">本轮消息 ({{ socketStore.questionRoundMessages.length }}条)</view>
|
||||
<scroll-view class="debug-raw-box" scroll-y>
|
||||
<view v-for="(msg, i) in socketStore.questionRoundMessages" :key="i" class="debug-round-item">
|
||||
<view class="debug-round-index">#{{ i + 1 }} <text class="debug-round-time">{{ formatDebugTime(msg.time) }}</text></view>
|
||||
<text class="debug-json">{{ formatDebugJson(msg.data) }}</text>
|
||||
</view>
|
||||
<text v-if="!socketStore.questionRoundMessages.length" class="debug-empty">暂无本轮消息</text>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
@@ -1069,9 +1010,6 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.
|
||||
const showMessageModal = ref(false)
|
||||
const detailLinks = ref([])
|
||||
|
||||
// 调试面板
|
||||
const showDebugPanel = ref(false)
|
||||
|
||||
// 点击气泡内容:拦截链接点击,否则 AI 对话弹出详情
|
||||
const handleChatContentClick = (e, message) => {
|
||||
// 在事件路径中向上查找 .chat-inline-link 元素
|
||||
@@ -1415,8 +1353,6 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.
|
||||
// 发送AI消息
|
||||
const sendAIMessage = async () => {
|
||||
try {
|
||||
// 调试:开始新的提问轮次,记录本轮所有 socket 消息
|
||||
socketStore.startNewRound()
|
||||
let messageContent = textMessage.value
|
||||
// 立即添加用户消息到列表(使用完整的 messageContent,包含文件信息)
|
||||
allmessages.value = [...allmessages.value, {
|
||||
@@ -2083,35 +2019,6 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.
|
||||
})
|
||||
|
||||
// 离开 AI 对话页面时断开 socket
|
||||
// ===== 调试面板相关 =====
|
||||
const toggleDebugPanel = () => {
|
||||
showDebugPanel.value = !showDebugPanel.value
|
||||
}
|
||||
|
||||
const clearDebugRound = () => {
|
||||
socketStore.clearRoundMessages()
|
||||
}
|
||||
|
||||
const formatDebugJson = (data) => {
|
||||
try {
|
||||
return JSON.stringify(data, null, 2)
|
||||
} catch {
|
||||
return String(data)
|
||||
}
|
||||
}
|
||||
|
||||
const formatDebugTime = (isoStr) => {
|
||||
try {
|
||||
const t = new Date(isoStr)
|
||||
const h = t.getHours().toString().padStart(2, '0')
|
||||
const m = t.getMinutes().toString().padStart(2, '0')
|
||||
const s = t.getSeconds().toString().padStart(2, '0')
|
||||
return `${h}:${m}:${s}`
|
||||
} catch {
|
||||
return isoStr
|
||||
}
|
||||
}
|
||||
|
||||
onUnload(() => {
|
||||
socketStore.disconnect()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user