Files
agent-safe-middleware/config.yaml
T
starrrLight 7f0ae69252 chore(模型): 迁移 guard 模型目录
将 guard 模型从 model 目录迁移到 models/guard_model。\n同步配置和 Git LFS 属性路径,取消 models 目录的忽略规则。
2026-10-15 16:09:52 +08:00

64 lines
1.6 KiB
YAML

upstream: http://127.0.0.1:8000
listen_host: 0.0.0.0
listen_port: 8080
limits:
max_sessions: 4
hook_timeout_seconds: 5
upstream_timeout_seconds: 120
llm:
- id: guard_model
type: guard
file: models/guard_model
load: {device: cuda}
limits:
max_input_tokens: 4096
max_new_tokens: 32
timeout_seconds: 30
queue_size: 8
plugins:
- id: network-review
file: plugins/network_review.lua
match:
paths: [/chat/stream]
network:
allow:
- domain: review.example.com # 本地联调改 mock-review.local
scheme: https
ports: [443]
timeout_seconds: 5
max_response_bytes: 1048576
config:
url: https://review.example.com/check # 本地联调改 http://mock-review.local:8001/check
fields: [messages]
headers: {x-api-key: "injected-by-admin"}
- id: response-guard
file: plugins/response_guard.lua
match:
paths: [/chat/stream]
llm: {allow: [guard_model]}
config:
model: guard_model # 必须与 llm 注册的 id 一致
content_path: content
- id: request-rewrite
file: plugins/request_rewrite.lua
match:
paths: [/chat/stream]
config:
prefix: "[checked] "
- id: stream-redact
file: plugins/stream_redact.lua
match:
paths: [/chat/stream]
config:
text_event: text_delta
content_path: content
terminal_error_events: [run_error]
control_event_names: [heartbeat, run_started, run_finished, run_error, run_completed]
max_buffer_bytes: 262144