Remember assistant name preferences in chat
CI / test (push) Successful in 1m4s
CI / test (pull_request) Successful in 59s

This commit is contained in:
m
2026-08-25 02:16:15 +03:00
parent ce07163541
commit eefd54137c
5 changed files with 114 additions and 5 deletions
+24 -5
View File
@@ -510,13 +510,17 @@ func main() {
}
var effectiveTaskMessage = utterance.Content
var previousTask *interaction.HumanUtterance
var conversationHistory []interaction.HumanUtterance
if request.ConversationID != "" {
conversationHistory, _ = interactionRepository.Utterances(r.Context(), conversation.ID)
}
if request.ConversationID != "" && interactiondomain.IsRetryRequest(utterance.Content) {
if history, historyErr := interactionRepository.Utterances(r.Context(), conversation.ID); historyErr == nil && len(history) > 0 {
for index := len(history) - 1; index >= 0; index-- {
if interactiondomain.IsRetryRequest(history[index].Content) {
if len(conversationHistory) > 0 {
for index := len(conversationHistory) - 1; index >= 0; index-- {
if interactiondomain.IsRetryRequest(conversationHistory[index].Content) {
continue
}
candidate := history[index]
candidate := conversationHistory[index]
previousTask = &candidate
effectiveTaskMessage = candidate.Content
break
@@ -534,6 +538,21 @@ func main() {
semantic = interactiondomain.CarryForwardPreviousTask(semantic, previousSemantic)
}
}
assistantName := interactiondomain.PreferredAssistantName(utterance.Content)
if assistantName == "" {
for index := len(conversationHistory) - 1; index >= 0; index-- {
if name := interactiondomain.PreferredAssistantName(conversationHistory[index].Content); name != "" {
assistantName = name
break
}
}
}
identityReply := ""
if interactiondomain.IsIdentityInquiry(utterance.Content) && assistantName != "" {
identityReply = "Меня зовут " + assistantName + ". Я Домовой, ваш помощник."
semantic.Reply = identityReply
semantic.NeedsCognition = false
}
routePlan := buildChatRoutePlan(semantic)
cognitiveAttempted := false
cognitiveAvailable := true
@@ -589,7 +608,7 @@ func main() {
activeFocusName = previousFocus.ProjectDisplayName
activeFocusProvenance = previousFocus.Provenance
}
var planningReply string
planningReply := identityReply
workPlanned := false
needsCognition := semantic.NeedsCognition
projectID := ""