From e07cc5ec830bda48cf9a49300805bddf7d299042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82=D0=B0=20=D0=9A?= =?UTF-8?q?=D0=B0=D0=BB=D0=B0=D1=88=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=D0=B0?= <3056129056@qq.com> Date: Fri, 27 Nov 2026 18:09:06 +0800 Subject: [PATCH] =?UTF-8?q?config:=20=E8=A1=A5=E9=BD=90=20completions=20?= =?UTF-8?q?=E7=9A=84=E5=AE=A1=E6=A0=B8=E8=B7=AF=E5=BE=84=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=BE=93=E5=87=BA=E4=BE=A7=E6=BC=8F=E5=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit match.paths 里配了 /v1/completions,但插件默认内容路径是 choices.*.delta.content / message.content,而 legacy completions 的正文在 choices[*].text,不在路径上,导致这类响应不经过审核直接放行。显式配置 content_path_stream / content_path_full 同时覆盖两种格式。 已用 middleware.config.load_settings 校验通过。 --- config.yaml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/config.yaml b/config.yaml index 612a53b..a3f9e63 100644 --- a/config.yaml +++ b/config.yaml @@ -95,11 +95,16 @@ plugins: force_flush_bytes: 4096 # 上限与判定能力对齐:8 段 × judge_chunk_bytes(16KB) = 128KB max_buffer_bytes: 131072 - # 正文之外还要审核工具调用参数时,改成数组即可(默认只审核正文): - # content_path_stream: ["choices.*.delta.content", - # "choices.*.delta.tool_calls.*.function.arguments"] - # content_path_full: ["choices.*.message.content", - # "choices.*.message.tool_calls.*.function.arguments"] + # 必须显式列出两条路径: + # chat 格式正文在 choices[*].delta.content / message.content + # legacy completions(match.paths 里配了 /v1/completions)正文在 choices[*].text + # 只用默认值会漏审 completions 的正文,风险内容直接放行。 + content_path_stream: ["choices.*.delta.content", "choices.*.text"] + content_path_full: ["choices.*.message.content", "choices.*.text"] + # 工具调用参数也要审核时,在上面数组里追加: + # "choices.*.delta.tool_calls.*.function.arguments" + # "choices.*.message.tool_calls.*.function.arguments" + judge_chunk_bytes: 16384 judge_max_tokens: 512 # deepseek 系列默认带思维链,判定用不到;none 可省 ~0.3s 且避免思维链吃光 token。