Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit dc0e00c

Browse files
committed
Update README, add sensitivity threshold management
- Removed the English README file and updated the main README to reflect the latest features and configurations. - Introduced sensitivity threshold management in the backend, allowing users to configure sensitivity levels and thresholds for detection. - Added new API endpoints for managing sensitivity thresholds, including retrieval, updating, and resetting to default values. - Enhanced the database models to support sensitivity-related fields and configurations. - Updated frontend components to include sensitivity threshold management, improving user experience and accessibility of these features. - Incremented version numbers in both backend and frontend to 2.1.0 to reflect the new changes.
1 parent c02dd6e commit dc0e00c

28 files changed

+3036
-1772
lines changed

README.md

Lines changed: 517 additions & 622 deletions
Large diffs are not rendered by default.

README_EN.md

Lines changed: 0 additions & 1055 deletions
This file was deleted.

README_ZH.md

Lines changed: 1268 additions & 0 deletions
Large diffs are not rendered by default.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.0
1+
2.1.0
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- 添加风险类型敏感度阈值字段到 risk_type_config 表
2+
3+
-- 添加 S1-S12 敏感度阈值字段,默认值为 0.90 (中档90%)
4+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s1_confidence_threshold FLOAT DEFAULT 0.90;
5+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s2_confidence_threshold FLOAT DEFAULT 0.90;
6+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s3_confidence_threshold FLOAT DEFAULT 0.90;
7+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s4_confidence_threshold FLOAT DEFAULT 0.90;
8+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s5_confidence_threshold FLOAT DEFAULT 0.90;
9+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s6_confidence_threshold FLOAT DEFAULT 0.90;
10+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s7_confidence_threshold FLOAT DEFAULT 0.90;
11+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s8_confidence_threshold FLOAT DEFAULT 0.90;
12+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s9_confidence_threshold FLOAT DEFAULT 0.90;
13+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s10_confidence_threshold FLOAT DEFAULT 0.90;
14+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s11_confidence_threshold FLOAT DEFAULT 0.90;
15+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS s12_confidence_threshold FLOAT DEFAULT 0.90;
16+
17+
-- 给现有记录设置默认值
18+
UPDATE risk_type_config
19+
SET s1_confidence_threshold = 0.90,
20+
s2_confidence_threshold = 0.90,
21+
s3_confidence_threshold = 0.90,
22+
s4_confidence_threshold = 0.90,
23+
s5_confidence_threshold = 0.90,
24+
s6_confidence_threshold = 0.90,
25+
s7_confidence_threshold = 0.90,
26+
s8_confidence_threshold = 0.90,
27+
s9_confidence_threshold = 0.90,
28+
s10_confidence_threshold = 0.90,
29+
s11_confidence_threshold = 0.90,
30+
s12_confidence_threshold = 0.90
31+
WHERE s1_confidence_threshold IS NULL;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- 添加敏感度相关字段到 detection_results 表
2+
3+
-- 添加敏感度等级字段
4+
ALTER TABLE detection_results ADD COLUMN IF NOT EXISTS confidence_level VARCHAR(10);
5+
6+
-- 添加敏感度分数字段
7+
ALTER TABLE detection_results ADD COLUMN IF NOT EXISTS confidence_score FLOAT;
8+
9+
-- 为现有记录设置默认值(可选,因为字段允许为NULL)
10+
-- UPDATE detection_results SET confidence_level = NULL, confidence_score = NULL WHERE confidence_level IS NULL;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- 添加敏感度触发等级配置字段到 risk_type_config 表
2+
3+
-- 添加敏感度触发等级字段,默认值为 'low' 表示低敏感度就会触发检测命中
4+
ALTER TABLE risk_type_config ADD COLUMN IF NOT EXISTS confidence_trigger_level VARCHAR(10) DEFAULT 'low';
5+
6+
-- 给现有记录设置默认值
7+
UPDATE risk_type_config
8+
SET confidence_trigger_level = 'low'
9+
WHERE confidence_trigger_level IS NULL;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- 为代理模型配置表添加敏感度触发等级字段
2+
-- 用于配置代理模式下各个模型的敏感度阻断阈值
3+
4+
ALTER TABLE proxy_model_configs ADD COLUMN IF NOT EXISTS confidence_trigger_level VARCHAR(10) DEFAULT 'medium';
5+
6+
-- 添加注释
7+
COMMENT ON COLUMN proxy_model_configs.confidence_trigger_level IS '敏感度触发等级:high、medium、low,决定什么敏感度等级会触发安全网关的阻断';
8+
9+
-- 为现有记录设置默认值
10+
UPDATE proxy_model_configs SET confidence_trigger_level = 'medium' WHERE confidence_trigger_level IS NULL;
11+
12+
-- 添加检查约束,确保只能是有效的敏感度等级
13+
ALTER TABLE proxy_model_configs ADD CONSTRAINT check_confidence_trigger_level_values
14+
CHECK (confidence_trigger_level IN ('high', 'medium', 'low'));
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
-- 添加流式检测配置字段
22
-- 为代理模型配置表添加stream_chunk_size字段
33

4-
ALTER TABLE proxy_model_configs ADD COLUMN IF NOT EXISTS stream_chunk_size INTEGER DEFAULT 5;
4+
ALTER TABLE proxy_model_configs ADD COLUMN IF NOT EXISTS stream_chunk_size INTEGER DEFAULT 50;
55

66
-- 添加注释
7-
COMMENT ON COLUMN proxy_model_configs.stream_chunk_size IS '流式检测间隔,每N个chunk检测一次,默认5。不同上游模型可配置不同值。';
7+
COMMENT ON COLUMN proxy_model_configs.stream_chunk_size IS '流式检测间隔,每N个chunk检测一次,默认50。不同上游模型可配置不同值。';
88

99
-- 为现有记录设置合理的默认值
10-
UPDATE proxy_model_configs SET stream_chunk_size = 5 WHERE stream_chunk_size IS NULL;
10+
UPDATE proxy_model_configs SET stream_chunk_size = 50 WHERE stream_chunk_size IS NULL;
1111

12-
-- 设置约束:stream_chunk_size应该在1-50之间
13-
ALTER TABLE proxy_model_configs ADD CONSTRAINT check_stream_chunk_size_range
14-
CHECK (stream_chunk_size >= 1 AND stream_chunk_size <= 50);
12+
-- 设置约束:stream_chunk_size应该在1-500之间
13+
ALTER TABLE proxy_model_configs ADD CONSTRAINT check_stream_chunk_size_range
14+
CHECK (stream_chunk_size >= 1 AND stream_chunk_size <= 500);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- 为代理模型配置表添加stream_chunk_size字段
2+
ALTER TABLE proxy_model_configs
3+
ADD COLUMN stream_chunk_size INTEGER DEFAULT 50;
4+
5+
-- 更新注释
6+
COMMENT ON COLUMN proxy_model_configs.stream_chunk_size IS '流式检测间隔,每N个chunk检测一次,默认50';

0 commit comments

Comments
 (0)