Remember assistant name preferences in chat
This commit is contained in:
@@ -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 := ""
|
||||
|
||||
Reference in New Issue
Block a user