fix: 安全回复、群聊误插话与人设保护及 WebUI 配置下拉#63
Conversation
注入回复生成失败时不再发送默认「有病?」,改为记录日志并保持静默。 Co-authored-by: Cursor <cursoragent@cursor.com>
重写注入回复提示词,允许更自然的阴阳接话;temperature 提至 1.1,空回复不再兜底「无聊。」。 Co-authored-by: Cursor <cursoragent@cursor.com>
默认假设非定向消息不在叫你,收紧人称判定;新增 persona_self_ownership,要求认可并接受自身设定。 Co-authored-by: Cursor <cursoragent@cursor.com>
为访问控制、彩蛋、模型池策略、生图等枚举配置提供下拉;reasoning_effort 保持文本输入。 Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR hardens the injection-response boundary behavior across prompts and services while independently refactoring config-form select-field option handling. Dialogue attribution rules are tightened to prevent pronoun misinterpretation. The injection-response service generates natural defensive replies at higher temperature and empty responses skip message sending. Config form now supports rule-based select options with dynamic type detection. ChangesInjection Response Boundary Hardening
Config Form UI Enhancement
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/Undefined/webui/static/js/config-form.js (1)
399-401: 💤 Low valueConsider the implications of runtime type inference for select fields.
Setting
valueTypebased on the current value's runtime type (line 400:typeof val === "number") may cause type confusion if the current value's type doesn't match the field's schema. For example:
- If the field schema expects a string enum like
["default", "round_robin"]but the current value is a number (due to a config error or migration),valueTypewill be set to"number".- When the user selects a string option like
"default",parseInputValue(line 1096) will attempt to parse it as a number, fail, and fall back to returning the raw string.- While the backend validation (
Config.load(strict=True)) will catch type mismatches, this approach may create unexpected UX issues where a user selects a valid option but receives a validation error.In practice, this is mitigated by the fact that most entries in
FIELD_SELECT_OPTIONSare string enums, andparseInputValuehas fallback logic. However, thevalueTypeattribute may not accurately represent the field's schema, which could be misleading.If the field schema were accessible in the frontend, it would be more robust to determine
valueTypefrom the schema rather than the current value's runtime type. For now, this tradeoff seems acceptable given backend validation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Undefined/webui/static/js/config-form.js` around lines 399 - 401, The code sets input.dataset.valueType based on the runtime type of val which can be misleading for select fields; change the logic in the populateSelectInput call site so valueType is derived from the known select options or schema rather than typeof val — e.g., check FIELD_SELECT_OPTIONS for this field key and set input.dataset.valueType = "number" only if the option list clearly contains numeric values, otherwise default to "string"; ensure this ties into parseInputValue so selected string options aren't mis-parsed and keep backend validation (Config.load(strict=True)) as the final guard.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/Undefined/webui/static/js/config-form.js`:
- Around line 399-401: The code sets input.dataset.valueType based on the
runtime type of val which can be misleading for select fields; change the logic
in the populateSelectInput call site so valueType is derived from the known
select options or schema rather than typeof val — e.g., check
FIELD_SELECT_OPTIONS for this field key and set input.dataset.valueType =
"number" only if the option list clearly contains numeric values, otherwise
default to "string"; ensure this ties into parseInputValue so selected string
options aren't mis-parsed and keep backend validation (Config.load(strict=True))
as the final guard.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1408e7d4-e069-488f-b69b-c7215e3d1dcf
📒 Files selected for processing (7)
res/prompts/injection_response_agent.txtres/prompts/undefined.xmlres/prompts/undefined_nagaagent.xmlsrc/Undefined/injection_response_agent.pysrc/Undefined/services/ai_coordinator.pysrc/Undefined/services/coordinator/group.pysrc/Undefined/webui/static/js/config-form.js
下拉字段不再依赖运行时 typeof,避免 prefer_quality 等数值选项被误存为字符串。 Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
temperature提至 1.1reasoning_effort保持文本输入)Test plan
access.mode、easter_egg.agent_call_message_enabled、image_gen.xingzhige_size)uv run pytest tests/(本次改动以提示词与 WebUI 为主,可按需抽检)Made with Cursor
Summary by CodeRabbit
Bug Fixes
UI Improvements