feat(logs): 详情彻底不截断(捕获 4MiB / 入库 8MiB)+ 实时页按需取全文

- 请求体捕获上限 128KiB → 4MiB(CALLLOG_BODY_MAX);在途缓存条数 128 → 64 控内存
- 入库上限 256KiB → 8MiB(CALLLOG_CONTENT_MAX)
- 新增 GET /logs/entry/{id}:本人或管理员可取该条完整提示词/回复(实时页展开时调用)
- 实时列表仍给 8KB 预览 + body_len/resp_len,展开替换为全文并显示「完整 N 字」
- 实测 285KiB 提示词完整落库与返回
- 版本 2.9.11 → 2.9.12
This commit is contained in:
jidekin committed 2026-10-23 16:01:24 +08:00
1 parent 5643824422
commit 7aa9032829
6 files changed
+98 -12

No files matched your search

+37 -5
View File
@@ -100,8 +100,20 @@
<span class="tok-item tok-hit" :class="hitCls(row)" :title="t('logs.cacheHint')">{{ t('logs.cacheHit') }} <b>{{ hitRate(row) }}%</b></span>
</div>
</div>
<div class="detail-block"><label>{{ t('logs.request') }}</label><pre>{{ row.body || '—' }}</pre></div>
<div class="detail-block"><label>{{ t('logs.response') }}</label><pre>{{ row.response || '—' }}</pre></div>
<div class="detail-block">
<label>{{ t('logs.request') }}
<span v-if="row.fullLoading" class="sub"> · {{ t('logs.loadingFull') }}</span>
<span v-else-if="row.full && row.bodyLen" class="sub"> · {{ t('logs.fullLen', { n: row.bodyLen }) }}</span>
<span v-else-if="row.fullErr" class="err-text"> · {{ row.fullErr }}</span>
</label>
<pre>{{ row.body || '—' }}</pre>
</div>
<div class="detail-block">
<label>{{ t('logs.response') }}
<span v-if="row.full && row.respLen" class="sub"> · {{ t('logs.fullLen', { n: row.respLen }) }}</span>
</label>
<pre>{{ row.response || '—' }}</pre>
</div>
<div class="detail-block" v-if="row.polls && row.polls.length">
<label>{{ t('logs.polls', { n: row.polls.length }) }}</label>
<el-timeline class="poll-timeline">
@@ -178,9 +190,29 @@ function isOpen(row: any): boolean {
}
function toggle(row: any) {
const k = rowKey(row)
expandedKeys.value = expandedKeys.value.includes(k)
? expandedKeys.value.filter((x) => x !== k)
: [...expandedKeys.value, k]
const opening = !expandedKeys.value.includes(k)
expandedKeys.value = opening
? [...expandedKeys.value, k]
: expandedKeys.value.filter((x) => x !== k)
// 2026-10-23:列表只给前 8KB 预览,展开时按需取全文(详情不截断)
if (opening && row.id && !row.full) loadFull(row)
}
/** 展开时取这条日志的完整提示词与回复(不截断)。 */
async function loadFull(row: any) {
row.fullLoading = true
try {
const d = await api(`/logs/entry/${row.id}`)
row.body = d.prompt || ''
row.response = d.completion || ''
row.bodyLen = d.prompt_len || 0
row.respLen = d.completion_len || 0
row.full = true
} catch (e: any) {
row.fullErr = err(e)
} finally {
row.fullLoading = false
}
}
// 视频快照是否已经有结论(有结论就不再主动追轮询)