feat(prompts): prompt 版本化地基 —— 注册表 + 运行期文件覆盖
把散落各服务的硬编码 system prompt 收口为受管注册表,不重编译即可改/回滚/对比: - shared/prompts:内置默认(随代码) + 运行期覆盖(PROMPTS_FILE) + Get/Keys,并发安全,含单测 - 接入 9 处:mcp-go(graph.extract);dispatcher(eval.quality/eval.refine/guard.jailbreak/ coordinator.lead/memory.extract,按引用登记默认、无文本重复) - main 启动调 LoadFile 加载 PROMPTS_FILE 覆盖 - live A/B:覆盖 graph.extract → 图谱抽取 2 条→0 条、向量仍正常(覆盖生效、管道未坏) - v2(DB 控制面热切换 + 灰度)留后续 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/sundynix/sundynix-dispatcher/internal/llm"
|
||||
"github.com/sundynix/sundynix-shared/contract"
|
||||
"github.com/sundynix/sundynix-shared/otelx"
|
||||
"github.com/sundynix/sundynix-shared/prompts"
|
||||
)
|
||||
|
||||
// TokenSink 是 Token 流回流出口(由 NATS bus 实现)。
|
||||
@@ -393,7 +394,7 @@ func (o *Orchestrator) refine(ctx context.Context, t *contract.Task, input, outp
|
||||
if critique == "" {
|
||||
critique = "整体质量不足(相关性/准确性/完整性欠佳)"
|
||||
}
|
||||
sys := "你是严谨的回答修订专家。下面给你一个用户问题、一份质量不足的初版回答、以及评审指出的问题。请针对这些问题重写一份更准确、相关、完整的回答。"
|
||||
sys := prompts.Get(prompts.EvalRefine)
|
||||
srcBlock := ""
|
||||
if len(sources) > 0 {
|
||||
srcBlock = "\n\n【可参考的检索资料(严格基于它作答,不要编造资料外的内容)】\n" +
|
||||
|
||||
Reference in New Issue
Block a user