Skip to content

feat(prompt) support configurable prompt template directories#1096

Open
zhoujh01 wants to merge 1 commit intomainfrom
config_prompt
Open

feat(prompt) support configurable prompt template directories#1096
zhoujh01 wants to merge 1 commit intomainfrom
config_prompt

Conversation

@zhoujh01
Copy link
Copy Markdown
Collaborator

@zhoujh01 zhoujh01 commented Mar 30, 2026

Description

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

第一,给 prompt 模板目录加了可配置能力。PromptManager 现在会按这个优先级选目录:显式传入参数、环境变量
OPENVIKING_PROMPT_TEMPLATES_DIR、ov.conf 里的 prompts.templates_dir、最后才是内置目录。实现入口在 openviking/prompts/
manager.py:63,配置模型加在 openviking_cli/utils/config/open_viking_config.py:154 和 openviking_cli/utils/config/
prompts_config.py:8。

第二,把自定义模板目录做成了“局部覆盖”而不是“整套替换”。也就是用户只放改过的 prompt 文件就行,某个 prompt 在自定义目录里
找不到时,会自动回退到内置 openviking/prompts/templates。这个 fallback 逻辑在openviking/prompts/manager.py:141。

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant