maven: dedupe knowledge prompt to router.KnowledgePrompt (task 4 follow-up)
Task 4 created and tested router.KnowledgePrompt() but the live path in LLMPhraser.PhraseQuery used a separate hardcoded copy of the same RU anti-hallucination prompt, leaving KnowledgePrompt() as dead code and two strings that could drift. Point the phraser at the tested helper so there is a single source of truth. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
|
||||
"github.com/kami/maven/internal/delivery"
|
||||
"github.com/kami/maven/internal/loop"
|
||||
"github.com/kami/maven/internal/router"
|
||||
)
|
||||
|
||||
var listenRE = regexp.MustCompile(`listening on (https?://\S+)`)
|
||||
@@ -171,8 +172,9 @@ func (p *LLMPhraser) PhraseNudge(ctx context.Context, c loop.Candidate) (deliver
|
||||
// LLM error — better to give the raw data than silence.
|
||||
func (p *LLMPhraser) PhraseQuery(ctx context.Context, utterance string, notes []string) (string, error) {
|
||||
if len(notes) == 0 {
|
||||
// General knowledge — no notes to ground the answer
|
||||
sys := "Ты — Мавена, персональный ассистент. Ответь кратко из своих знаний. Если не знаешь — скажи \"не знаю\". Не выдумывай."
|
||||
// General knowledge — no notes to ground the answer. The system
|
||||
// prompt is the single tested source in router.KnowledgePrompt.
|
||||
sys := router.KnowledgePrompt()
|
||||
prompt := fmt.Sprintf("Пользователь спрашивает: \"%s\".", utterance)
|
||||
resp, err := p.chatWithSystem(ctx, sys, prompt, 256)
|
||||
if err != nil || resp == "" {
|
||||
|
||||
Reference in New Issue
Block a user