feat: 目录层级变更
This commit is contained in:
@@ -97,10 +97,9 @@
|
||||
<el-table-column label="色情检测" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.nsfwScore > 0">
|
||||
<el-tag :type="scope.row.nsfwScore >= scope.row.nsfwThreshold ? 'danger' : 'warning'" size="small">
|
||||
{{ (scope.row.nsfwScore * 100).toFixed(1) }}%
|
||||
<el-tag :type="getNsfwLevelType(scope.row.nsfwScore)" size="small">
|
||||
{{ getNsfwLevelName(scope.row.nsfwScore) }} {{ (scope.row.nsfwScore * 100).toFixed(1) }}%
|
||||
</el-tag>
|
||||
<div class="nsfw-threshold">阈值: {{ (scope.row.nsfwThreshold * 100).toFixed(0) }}%</div>
|
||||
<div v-if="scope.row.nsfwDetections" class="nsfw-threshold">{{ formatNsfwDetections(scope.row.nsfwDetections) }}</div>
|
||||
</div>
|
||||
<span v-else class="muted">-</span>
|
||||
@@ -109,18 +108,14 @@
|
||||
<el-table-column label="动漫色情检测" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.animeNsfwScore > 0">
|
||||
<el-tag :type="scope.row.animeNsfwScore >= scope.row.animeNsfwThreshold ? 'danger' : 'warning'" size="small">
|
||||
{{ (scope.row.animeNsfwScore * 100).toFixed(1) }}%
|
||||
<el-tag :type="getNsfwLevelType(scope.row.animeNsfwScore)" size="small">
|
||||
{{ getNsfwLevelName(scope.row.animeNsfwScore) }} {{ (scope.row.animeNsfwScore * 100).toFixed(1) }}%
|
||||
</el-tag>
|
||||
<div class="nsfw-threshold">阈值: {{ (scope.row.animeNsfwThreshold * 100).toFixed(0) }}%</div>
|
||||
</div>
|
||||
<div v-else-if="scope.row.animeNsfwRatings">
|
||||
<el-tag type="info" size="small">安全</el-tag>
|
||||
<div class="nsfw-threshold">{{ formatAnimeRatings(scope.row.animeNsfwRatings) }}</div>
|
||||
</div>
|
||||
<div v-else-if="scope.row.animeNsfwThreshold > 0">
|
||||
<el-tag type="info" size="small">安全</el-tag>
|
||||
</div>
|
||||
<span v-else class="muted">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -312,6 +307,18 @@ export default {
|
||||
this.$message.error('复制失败')
|
||||
})
|
||||
},
|
||||
getNsfwLevelName(score) {
|
||||
if (score < 0.25) return '安全'
|
||||
if (score < 0.5) return '低俗'
|
||||
if (score < 0.75) return '擦边'
|
||||
return '色情'
|
||||
},
|
||||
getNsfwLevelType(score) {
|
||||
if (score < 0.25) return 'success'
|
||||
if (score < 0.5) return 'warning'
|
||||
if (score < 0.75) return ''
|
||||
return 'danger'
|
||||
},
|
||||
formatAnimeRatings(ratingsJson) {
|
||||
if (!ratingsJson) return ''
|
||||
try {
|
||||
|
||||
@@ -53,21 +53,11 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.type === 'human'" label="检测阈值">
|
||||
<el-slider v-model="form.humanThreshold" :min="0.1" :max="0.9" :step="0.05" show-input></el-slider>
|
||||
<div class="form-tip">分数高于此值判定为色情(推荐 0.2-0.4)</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.type === 'human'" label="推理 Worker 数">
|
||||
<el-input-number v-model="form.humanWorkers" :min="1" :max="32"></el-input-number>
|
||||
<div class="form-tip">并行推理的 worker 数量,越大越快但占用更多内存(每个 worker 约 300MB)</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.type === 'anime'" label="检测阈值">
|
||||
<el-slider v-model="form.animeThreshold" :min="0.1" :max="0.9" :step="0.05" show-input></el-slider>
|
||||
<div class="form-tip">explicit/questionable 分数高于此值判定为色情(推荐 0.5-0.7)</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="form.type === 'anime'" label="推理 Worker 数">
|
||||
<el-input-number v-model="form.animeWorkers" :min="1" :max="32"></el-input-number>
|
||||
<div class="form-tip">并行推理的 worker 数量,越大越快但占用更多内存(每个 worker 约 1.5GB)</div>
|
||||
@@ -90,8 +80,6 @@ export default {
|
||||
return {
|
||||
form: {
|
||||
type: '',
|
||||
humanThreshold: 0.5,
|
||||
animeThreshold: 0.5,
|
||||
humanWorkers: 4,
|
||||
animeWorkers: 2,
|
||||
goWorkers: 0
|
||||
@@ -116,8 +104,6 @@ export default {
|
||||
const res = await request.get('/api/config/nsfw')
|
||||
if (res.data) {
|
||||
this.form.type = res.data.type || ''
|
||||
this.form.humanThreshold = res.data.humanThreshold || 0.5
|
||||
this.form.animeThreshold = res.data.animeThreshold || 0.5
|
||||
this.form.humanWorkers = res.data.humanWorkers || 4
|
||||
this.form.animeWorkers = res.data.animeWorkers || 2
|
||||
this.form.goWorkers = res.data.goWorkers || 0
|
||||
@@ -147,8 +133,6 @@ export default {
|
||||
try {
|
||||
await request.put('/api/config/nsfw', {
|
||||
type: this.form.type,
|
||||
humanThreshold: this.form.humanThreshold,
|
||||
animeThreshold: this.form.animeThreshold,
|
||||
humanWorkers: this.form.humanWorkers,
|
||||
animeWorkers: this.form.animeWorkers,
|
||||
goWorkers: this.form.goWorkers
|
||||
|
||||
Reference in New Issue
Block a user