This commit is contained in:
2025-09-01 21:11:28 +08:00
parent 79156aa8ae
commit 05bf1b5662
6 changed files with 253 additions and 8 deletions
+4
View File
@@ -24,6 +24,10 @@
<i class="el-icon-data-line"></i>
<span slot="title">统计看板</span>
</el-menu-item>
<el-menu-item index="/settings">
<i class="el-icon-setting"></i>
<span slot="title">系统配置</span>
</el-menu-item>
</el-menu>
<div class="aside-footer">kenaito-media-picker</div>
</el-aside>
+3 -1
View File
@@ -3,6 +3,7 @@ import Router from 'vue-router'
import Dashboard from '../views/Dashboard.vue'
import MediaList from '../views/MediaList.vue'
import Scan from '../views/Scan.vue'
import Settings from '../views/Settings.vue'
Vue.use(Router)
@@ -11,6 +12,7 @@ export default new Router({
{path: '/', redirect: '/scan'},
{path: '/dashboard', component: Dashboard},
{path: '/media', component: MediaList},
{path: '/scan', component: Scan}
{path: '/scan', component: Scan},
{path: '/settings', component: Settings}
]
})
+114
View File
@@ -0,0 +1,114 @@
<template>
<div class="settings-page">
<el-card class="box-card">
<div slot="header" class="card-header">
<span>色情检测配置</span>
</div>
<el-form :model="form" label-width="120px" class="settings-form">
<el-form-item label="检测类型">
<el-radio-group v-model="form.type" @change="handleTypeChange">
<el-radio label="">关闭</el-radio>
<el-radio label="human">人类 (NudeNet)</el-radio>
<el-radio label="anime">二次元 (WD Tagger)</el-radio>
</el-radio-group>
<div class="form-tip">
<span v-if="form.type === ''">不启用色情检测</span>
<span v-else-if="form.type === 'human'">使用 NudeNet 检测真人色情内容</span>
<span v-else-if="form.type === 'anime'">使用 WD Tagger v3 检测二次元色情内容</span>
</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 === '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>
<el-button type="primary" @click="saveConfig" :loading="saving">保存配置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import request from '@/utils/request'
export default {
name: 'Settings',
data() {
return {
form: {
type: '',
humanThreshold: 0.5,
animeThreshold: 0.5
},
saving: false
}
},
created() {
this.loadConfig()
},
methods: {
async loadConfig() {
try {
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
}
} catch (error) {
this.$message.error('加载配置失败')
}
},
handleTypeChange() {
// 切换类型时不需要特殊处理
},
async saveConfig() {
this.saving = true
try {
await request.put('/api/config/nsfw', {
type: this.form.type,
humanThreshold: this.form.humanThreshold,
animeThreshold: this.form.animeThreshold
})
this.$message.success('配置已保存,下次扫描生效')
} catch (error) {
this.$message.error('保存失败')
} finally {
this.saving = false
}
}
}
}
</script>
<style scoped>
.settings-page {
padding: 20px;
max-width: 800px;
margin: 0 auto;
}
.card-header {
font-size: 16px;
font-weight: 600;
}
.settings-form {
margin-top: 20px;
}
.form-tip {
font-size: 12px;
color: #909399;
margin-top: 5px;
}
</style>