feat: 小程序前端显示分类标签
各页面增加垃圾信息分类标签显示: - 检测结果页显示分类标签 - 批量识别页和CSV导出增加分类标签列 - 历史记录页显示分类标签 - 管理后台审核页显示分类标签 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -85,9 +85,10 @@ Page({
|
||||
const items = this.data.items
|
||||
if (!items.length) return ''
|
||||
|
||||
const headers = ['文本', '判定结果', '置信度', '垃圾概率', '正常概率', '风险关键词']
|
||||
const headers = ['文本', '判定结果', '分类标签', '置信度', '垃圾概率', '正常概率', '风险关键词']
|
||||
const rows = items.map((item) => {
|
||||
const prediction = item.prediction === 'spam' ? '垃圾信息' : '正常信息'
|
||||
const categoryLabel = item.category_label || ''
|
||||
const confidence = item.confidence_text || '0%'
|
||||
const spamProb = this.formatPercent(item.spam_probability, 4)
|
||||
const hamProb = this.formatPercent(item.ham_probability, 4)
|
||||
@@ -95,7 +96,7 @@ Page({
|
||||
// CSV 转义:文本中的逗号和换行需要处理
|
||||
const text = (item.text || '').replace(/"/g, '""')
|
||||
const tokensEscaped = tokens.replace(/"/g, '""')
|
||||
return `"${text}","${prediction}","${confidence}","${spamProb}","${hamProb}","${tokensEscaped}"`
|
||||
return `"${text}","${prediction}","${categoryLabel}","${confidence}","${spamProb}","${hamProb}","${tokensEscaped}"`
|
||||
})
|
||||
|
||||
return [headers.join(','), ...rows].join('\n')
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
<text class="label">判定结果</text>
|
||||
<text class="{{item.prediction === 'spam' ? 'status-spam' : 'status-ham'}}">{{item.prediction_text}}</text>
|
||||
</view>
|
||||
<view class="row" wx:if="{{item.category_label}}">
|
||||
<text class="label">分类标签</text>
|
||||
<text class="status-spam">{{item.category_label}}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">置信度</text>
|
||||
<text class="value">{{item.confidence_text}}</text>
|
||||
|
||||
Reference in New Issue
Block a user