Files
Mofox-Core/plugins/hello_world_plugin
minecraft1024a 69f132a12e feat(prompt): 为提示词组件提供注入目标上下文
为了让单个提示词组件在注入到不同目标时能够有不同的行为,现在向组件的执行上下文中传递当前注入的目标提示词名称 (`target_prompt_name`)。

这使得组件可以根据注入点动态调整其生成的内容。例如,一个工具列表组件在注入到 planner prompt 和 reflection prompt 时可以提供不同详尽程度的列表。

主要变更:
- `BasePrompt` 初始化时接收 `target_prompt_name`。
- `PromptComponentManager` 在应用注入规则时会传递此参数。
- `add_injection_rule` 方法现在支持批量添加规则,以简化注册流程。

BREAKING CHANGE: `PromptComponentManager.add_injection_rule` 中 `content_provider` 的函数签名已更改,现在需要接受第二个参数 `target_prompt_name: str`。

旧签名: `async def provider(params: PromptParameters) -> str`
新签名: `async def provider(params: PromptParameters, target_prompt_name: str) -> str
2025-11-13 18:18:15 +08:00
..
2025-08-29 16:23:08 +08:00