只保留不写就会改错的说明(宿主 block 只给固定 403、UTF-8 边界、脱敏长度不变、 messages 需稠密整数表才能编成数组、input_text 绕过等),其余说明性段落删掉。 response_guard 注释 129 → 42 行;config.yaml 注释 51 → 13 行;配置结构未变。
73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
upstream: http://127.0.0.1:8000
|
||
listen_host: 0.0.0.0
|
||
listen_port: 8080
|
||
|
||
limits:
|
||
max_sessions: 4
|
||
# 单次判定 1~5s,最多切 8 段
|
||
hook_timeout_seconds: 45
|
||
upstream_timeout_seconds: 120
|
||
max_attachment_files: 8
|
||
max_attachment_fields: 128
|
||
max_attachment_text_bytes: 1048576
|
||
max_attachment_unpacked_bytes: 33554432
|
||
max_attachment_zip_entries: 2048
|
||
attachment_timeout_seconds: 30
|
||
max_attachment_reads: 64
|
||
|
||
plugins:
|
||
- id: response-guard
|
||
file: plugins/response_guard.lua
|
||
match:
|
||
paths: ["/v1/chat/completions"]
|
||
network:
|
||
allow:
|
||
- domain: ai.leapstella.com
|
||
scheme: https
|
||
ports: [443]
|
||
timeout_seconds: 20
|
||
max_response_bytes: 1048576
|
||
config:
|
||
# 主机、/v1、完整端点三种写法都可以
|
||
base_url: https://ai.leapstella.com/v1
|
||
# 复制本文件为 config.yaml 后填入自己的密钥(config.yaml 已被 .gitignore 忽略)
|
||
api_key: "sk-REPLACE_ME"
|
||
model: deepseek-v4-pro
|
||
block_status: 400
|
||
# buffered 则整条响应只判一次,但客户端看不到增量
|
||
stream_mode: incremental
|
||
flush_chars: 512
|
||
force_flush_bytes: 4096
|
||
# 8 段 × judge_chunk_bytes(16KB)
|
||
max_buffer_bytes: 131072
|
||
judge_chunk_bytes: 16384
|
||
judge_max_tokens: 512
|
||
# 关掉思维链,省时延也避免 content 被思维链挤空
|
||
judge_reasoning_effort: none
|
||
check_input: true
|
||
check_output: true
|
||
# 换 gpt-5 / o 系列时需要,DeepSeek 类服务不用改
|
||
# judge_token_param: max_completion_tokens
|
||
# judge_temperature: false
|
||
# judge_json_mode: false
|
||
# 拦截后替换给上游的占位请求:客户端没给 model 时用它兜底
|
||
# stub_model: deepseek-v4-pro
|
||
# stub_max_tokens: false
|
||
|
||
- id: stream-redact
|
||
enabled: false
|
||
file: plugins/stream_redact.lua
|
||
match:
|
||
paths: ["/v1/chat/completions"]
|
||
config:
|
||
content_path: choices.*.delta.content
|
||
max_buffer_bytes: 262144
|
||
|
||
- id: request-rewrite
|
||
enabled: false
|
||
file: plugins/request_rewrite.lua
|
||
match:
|
||
paths: ["/v1/chat/completions"]
|
||
config:
|
||
prefix: "[checked] "
|