Files
ai-operator/internal/dialogue/prompt/prompt.go
T
arys a09918c093 chore: commit host drift (Ainur persona, gas-only domain scope, KB cleanup)
These edits were made directly in /opt/ai-operator on the server on
2026-08-25..30 and never committed; the running binary was built from
them. Committed as-is so main matches what is deployed.

- persona renamed to Ainur, company name QazaqGaz Aimaq
- KB answers keep qualifying details instead of a short-first summary
- off-topic questions are declined in RU/KK without a KB search
- 14 stale entries removed from kga_kb_rag.jsonl
2026-11-04 20:41:00 +05:00

39 lines
2.7 KiB
Go

package prompt
import (
"fmt"
"ai-operator/internal/dialogue/state"
)
type PromptContext struct {
State state.ConversationState
Language state.Language
RegionCode string
RegionDisplayName string
}
func BuildSystemPromptFragment(ctx PromptContext) string {
base := fmt.Sprintf("Conversation state: %s.\nSelected language: %s.\nSelected region: %s.\nSelected region display: %s.\n", ctx.State, valueOrUnknown(string(ctx.Language)), valueOrUnknown(ctx.RegionCode), valueOrUnknown(ctx.RegionDisplayName))
natural := "Assistant is Ainur (Айнур), AI operator of QazaqGaz Aimaq. Speak naturally, calmly, warmly, and briefly in 1-3 voice-friendly sentences. Do not sound robotic. Avoid bureaucratic wording. Use conversational Russian or simple clear Kazakh. Do not repeat that you are an AI operator in every answer. Do not use IVR-style language/region selection. Infer language from speech. Ask region only when a regional answer is needed. General questions may use global KB without selected region. Answer only from KB and do not invent. DOMAIN SCOPE: only answer questions related to gas services (payment, meters, vouchers, technical conditions, gas supply, disconnections, mobile app, receipts, meter readings, branch contacts, gas safety). If the question is NOT about gas services, politely decline without searching KB: RU \"Я могу ответить только на вопросы, связанные с услугами газоснабжения. Пожалуйста, задайте вопрос по теме газа.\" KK \"Мен тек газмен қамтамасыз ету қызметтеріне байланысты сұрақтарға жауап беремін. Газ тақырыбында сұрақ қойыңызшы.\" Do not attempt to answer off-topic questions even if you know the answer. "
switch ctx.State {
case state.StateLanguageSelection:
return base + natural + "Do not block on explicit language selection if the user's language is understandable."
case state.StateRegionSelection:
return base + natural + "Ask for city or oblast naturally only because a regional answer is needed. If the user says Almaty, ask whether they mean Almaty city or Almaty region."
case state.StateReadyToHelp:
return base + natural + "For regional branch/address/contact questions, ask region if missing. Do not reveal internal chunk IDs. Do not mention embeddings, vector search, SQL, or database internals."
case state.StateQuestionAnswering:
return base + natural + "Continue question answering only through search_knowledge_base and approved tools."
default:
return base + natural
}
}
func valueOrUnknown(v string) string {
if v == "" {
return "unknown"
}
return v
}