[Fix] avoid chat prompt injection warning#880
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (27)
📒 Files selected for processing (1)
高级概览在 ChatLunaService 中,默认聊天提示的构建实现从函数调用改为类实例化,通过注入模型令牌处理方法、上下文管理器和渲染服务来增强提示配置。 变更说明提示构建实现迁移
评估代码审查工作量🎯 3 (中等) | ⏱️ ~20 分钟 庆祝诗
🚥 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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request bumps the peer dependency of koishi-plugin-chatluna to ^1.4.0-alpha.19 across multiple packages and refactors the prompt creation in chat.ts to instantiate ChatLunaChatPrompt directly. The review feedback highlights a critical issue where evaluating llm.value immediately at agent creation can cause crashes if the model is not yet loaded, or lead to stale closures when the model updates. It is recommended to make the token counter and limit dynamic by subclassing ChatLunaChatPrompt inline.
This pr fixes a ChatLuna prompt construction warning by avoiding the helper path that injects prompt dependencies through context.
New Features
None
Bug fixes
ChatLunaChatPromptdirectly when creating an agent prompt.Other Changes
yarn lint-fixcompleted with no errors. Existing max-len warnings remain inread_chat_message.ts.