构建系统提示词分段列表。源码: prompt.rs:134-156 结构: [0-4] 静态部分 (可缓存) [---] DYNAMIC_BOUNDARY [5+] 动态部分 (每次可能变)
(self)
| 261 | return self |
| 262 | |
| 263 | def build(self) -> list[str]: |
| 264 | """构建系统提示词分段列表。源码: prompt.rs:134-156 |
| 265 | |
| 266 | 结构: |
| 267 | [0-4] 静态部分 (可缓存) |
| 268 | [---] DYNAMIC_BOUNDARY |
| 269 | [5+] 动态部分 (每次可能变) |
| 270 | """ |
| 271 | sections: list[str] = [] |
| 272 | |
| 273 | # --- 静态部分 (边界以上,可缓存) --- |
| 274 | sections.append(self._intro_section()) |
| 275 | sections.append(self._system_section()) |
| 276 | sections.append(self._doing_tasks_section()) |
| 277 | sections.append(self._actions_section()) |
| 278 | |
| 279 | # --- 动态边界 --- |
| 280 | sections.append(SYSTEM_PROMPT_DYNAMIC_BOUNDARY) |
| 281 | |
| 282 | # --- 动态部分 (边界以下) --- |
| 283 | sections.append(self._environment_section()) |
| 284 | |
| 285 | if self._project_context is not None: |
| 286 | sections.append(self._render_project_context()) |
| 287 | if self._project_context.instruction_files: |
| 288 | sections.append(self._render_instruction_files()) |
| 289 | |
| 290 | if self._config is not None: |
| 291 | sections.append(self._render_config_section()) |
| 292 | |
| 293 | sections.extend(self._append_sections) |
| 294 | |
| 295 | return sections |
| 296 | |
| 297 | def render(self) -> str: |
| 298 | """拼成单个字符串。源码: prompt.rs:159-161""" |
no test coverage detected