fix: config.yaml模型路径/加载模式待修改,提交了plugins目录的lua插件,以及config.yaml中的配置

This commit is contained in:
Автомата Калашникова committed 2026-10-13 13:51:12 +08:00
1 parent 45e45948bd
commit d93cf2d5e5
6 files changed
+1917 -114

No files matched your search

+48 -29
View File
@@ -1,40 +1,59 @@
# Relative plugin paths resolve against this configuration file.
upstream: http://127.0.0.1:8000
listen_host: 0.0.0.0
listen_port: 8080
limits:
max_sessions: 4
hook_timeout_seconds: 5
lua_memory_bytes: 33554432
max_request_bytes: 2097152
max_response_bytes: 2097152
max_sse_frame_bytes: 262144
max_plugin_buffer_bytes: 1048576
max_host_calls_per_hook: 64
hook_timeout_seconds: 60 # guard 模型 CPU 推理慢,默认 5s 不够
upstream_timeout_seconds: 120
llm: []
llm:
- id: guard_model
type: guard
file: models/ # 待修改
load: {device: cpu} #待修改 (cude / cpu)
limits:
max_input_tokens: 4096
max_new_tokens: 32
timeout_seconds: 30
queue_size: 8
plugins:
- id: request-rewrite
file: plugins/request_rewrite.lua
enabled: false
config:
prefix: ""
- id: stream-redact
file: plugins/stream_redact.lua
enabled: false
- id: network-review
file: plugins/network_review.lua
enabled: false
config:
url: https://review.example.com/check
network:
timeout_seconds: 3
max_response_bytes: 1048576
allow:
- domain: review.example.com
- domain: '*.review.example.com'
# Explicit intranet example: enable only after replacing with actual deployment values.
# - domain: review.internal.example.com
# scheme: http
# ports: [8080]
# cidrs: [10.20.0.0/16]
- 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"}
paths: [/chat/stream]
- id: response-guard
file: plugins/response_guard.lua
llm: {allow: [guard_model]}
config:
model: guard_model # 必须与 llm 注册的 id 一致
content_path: content
paths: [/chat/stream]
- id: request-rewrite
file: plugins/request_rewrite.lua
config:
prefix: "[checked] "
paths: [/chat/stream]
- id: stream-redact
file: plugins/stream_redact.lua
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
paths: [/chat/stream]