From b62b3b0dc3b7d0286b7d6fb41e33a417cc1e651a Mon Sep 17 00:00:00 2001 From: Mikhail Date: Tue, 25 Aug 2026 20:56:21 +0300 Subject: [PATCH] Explain missing research evidence --- cmd/core-runtime/main.go | 3 + contracts/interaction/types.go | 95 +++++++++++++------------ modules/interaction/domain/chat.go | 3 + modules/interaction/domain/chat_test.go | 1 + 4 files changed, 55 insertions(+), 47 deletions(-) diff --git a/cmd/core-runtime/main.go b/cmd/core-runtime/main.go index 7846dfa..c61a1fc 100644 --- a/cmd/core-runtime/main.go +++ b/cmd/core-runtime/main.go @@ -755,6 +755,9 @@ func main() { case interaction.InformationRequestTimeDifference: planningReply = humanTimeDifferenceReply(effectiveTaskMessage) needsCognition = false + case interaction.InformationRequestResearchFailureExplanation: + planningReply = "Я не выдаю предположение как факт, если не получил согласованных проверяемых данных. Могу повторить поиск, уточнить запрос или проверить другой источник." + needsCognition = false case interaction.InformationRequestCapabilityInventory: kinds, err := capabilityRepository.AvailableCapabilityKinds(r.Context(), session.PrincipalID) if err == nil && len(kinds) > 0 { diff --git a/contracts/interaction/types.go b/contracts/interaction/types.go index eaec928..73266db 100644 --- a/contracts/interaction/types.go +++ b/contracts/interaction/types.go @@ -27,53 +27,54 @@ type SemanticCandidateSelectionState string type InformationRequestKind string const ( - ChannelWebChat Channel = "WEB_CHAT" - ConversationOpen ConversationState = "OPEN" - ConversationArchived ConversationState = "ARCHIVED" - SpeechActDirective SpeechAct = "DIRECTIVE" - SpeechActAssertion SpeechAct = "ASSERTION" - SpeechActDecision SpeechAct = "DECISION" - SpeechActPreference SpeechAct = "PREFERENCE" - SpeechActQuestion SpeechAct = "QUESTION" - SpeechActHypothesis SpeechAct = "HYPOTHESIS" - SpeechActCorrection SpeechAct = "CORRECTION" - SpeechActRequestToInvestigate SpeechAct = "REQUEST_TO_INVESTIGATE" - SpeechActConfirmation SpeechAct = "CONFIRMATION" - SpeechActRejection SpeechAct = "REJECTION" - SpeechActCancellation SpeechAct = "CANCELLATION" - SpeechActConversational SpeechAct = "CONVERSATIONAL" - SpeechActUnknown SpeechAct = "UNKNOWN" - InterpretationRecorded InterpretationState = "RECORDED" - InterpretationInterpreted InterpretationState = "INTERPRETED" - RelationCorrects InteractionRelationKind = "CORRECTS" - RelationRespondsTo InteractionRelationKind = "RESPONDS_TO" - RelationRequestsCognition InteractionRelationKind = "REQUESTS_COGNITION" - RelationCognitionFallback InteractionRelationKind = "COGNITION_FALLBACK" - RelationSupersedes InteractionRelationKind = "SUPERSEDES" - RelationClarifies InteractionRelationKind = "CLARIFIES" - ProjectRolePrimary ProjectReferenceRole = "PRIMARY" - ProjectRoleRelated ProjectReferenceRole = "RELATED" - ProjectRoleReferenceSource ProjectReferenceRole = "REFERENCE_SOURCE" - ClarificationNotRequired ClarificationState = "NOT_REQUIRED" - ClarificationRequired ClarificationState = "REQUIRED" - SemanticApplicable SemanticApplicability = "APPLICABLE" - SemanticLowConfidence SemanticApplicability = "LOW_CONFIDENCE" - SemanticMixedIntent SemanticApplicability = "MIXED_INTENT" - SemanticNeedsBroaderInterpret SemanticApplicability = "NEEDS_BROADER_INTERPRETATION" - SemanticCandidateClarify SemanticApplicability = "CLARIFICATION_REQUIRED" - CandidateSourceDeterministic SemanticCandidateSource = "DETERMINISTIC_V2" - CandidateSourceCognitive SemanticCandidateSource = "COGNITIVE_V1" - CandidateSelected SemanticCandidateSelectionState = "SELECTED" - CandidateObserved SemanticCandidateSelectionState = "OBSERVED" - CandidateRejected SemanticCandidateSelectionState = "REJECTED" - InformationRequestCapabilityInventory InformationRequestKind = "CAPABILITY_INVENTORY" - InformationRequestLocalCapabilityInventory InformationRequestKind = "LOCAL_CAPABILITY_INVENTORY" - InformationRequestCognitiveModelInventory InformationRequestKind = "COGNITIVE_MODEL_INVENTORY" - InformationRequestCognitiveCurrentModel InformationRequestKind = "COGNITIVE_CURRENT_MODEL" - InformationRequestCognitiveChannelStatus InformationRequestKind = "COGNITIVE_CHANNEL_STATUS" - InformationRequestCognitiveRecovery InformationRequestKind = "COGNITIVE_RECOVERY" - InformationRequestMemoryInventory InformationRequestKind = "MEMORY_INVENTORY" - InformationRequestTimeDifference InformationRequestKind = "TIME_DIFFERENCE" + ChannelWebChat Channel = "WEB_CHAT" + ConversationOpen ConversationState = "OPEN" + ConversationArchived ConversationState = "ARCHIVED" + SpeechActDirective SpeechAct = "DIRECTIVE" + SpeechActAssertion SpeechAct = "ASSERTION" + SpeechActDecision SpeechAct = "DECISION" + SpeechActPreference SpeechAct = "PREFERENCE" + SpeechActQuestion SpeechAct = "QUESTION" + SpeechActHypothesis SpeechAct = "HYPOTHESIS" + SpeechActCorrection SpeechAct = "CORRECTION" + SpeechActRequestToInvestigate SpeechAct = "REQUEST_TO_INVESTIGATE" + SpeechActConfirmation SpeechAct = "CONFIRMATION" + SpeechActRejection SpeechAct = "REJECTION" + SpeechActCancellation SpeechAct = "CANCELLATION" + SpeechActConversational SpeechAct = "CONVERSATIONAL" + SpeechActUnknown SpeechAct = "UNKNOWN" + InterpretationRecorded InterpretationState = "RECORDED" + InterpretationInterpreted InterpretationState = "INTERPRETED" + RelationCorrects InteractionRelationKind = "CORRECTS" + RelationRespondsTo InteractionRelationKind = "RESPONDS_TO" + RelationRequestsCognition InteractionRelationKind = "REQUESTS_COGNITION" + RelationCognitionFallback InteractionRelationKind = "COGNITION_FALLBACK" + RelationSupersedes InteractionRelationKind = "SUPERSEDES" + RelationClarifies InteractionRelationKind = "CLARIFIES" + ProjectRolePrimary ProjectReferenceRole = "PRIMARY" + ProjectRoleRelated ProjectReferenceRole = "RELATED" + ProjectRoleReferenceSource ProjectReferenceRole = "REFERENCE_SOURCE" + ClarificationNotRequired ClarificationState = "NOT_REQUIRED" + ClarificationRequired ClarificationState = "REQUIRED" + SemanticApplicable SemanticApplicability = "APPLICABLE" + SemanticLowConfidence SemanticApplicability = "LOW_CONFIDENCE" + SemanticMixedIntent SemanticApplicability = "MIXED_INTENT" + SemanticNeedsBroaderInterpret SemanticApplicability = "NEEDS_BROADER_INTERPRETATION" + SemanticCandidateClarify SemanticApplicability = "CLARIFICATION_REQUIRED" + CandidateSourceDeterministic SemanticCandidateSource = "DETERMINISTIC_V2" + CandidateSourceCognitive SemanticCandidateSource = "COGNITIVE_V1" + CandidateSelected SemanticCandidateSelectionState = "SELECTED" + CandidateObserved SemanticCandidateSelectionState = "OBSERVED" + CandidateRejected SemanticCandidateSelectionState = "REJECTED" + InformationRequestCapabilityInventory InformationRequestKind = "CAPABILITY_INVENTORY" + InformationRequestLocalCapabilityInventory InformationRequestKind = "LOCAL_CAPABILITY_INVENTORY" + InformationRequestCognitiveModelInventory InformationRequestKind = "COGNITIVE_MODEL_INVENTORY" + InformationRequestCognitiveCurrentModel InformationRequestKind = "COGNITIVE_CURRENT_MODEL" + InformationRequestCognitiveChannelStatus InformationRequestKind = "COGNITIVE_CHANNEL_STATUS" + InformationRequestCognitiveRecovery InformationRequestKind = "COGNITIVE_RECOVERY" + InformationRequestMemoryInventory InformationRequestKind = "MEMORY_INVENTORY" + InformationRequestTimeDifference InformationRequestKind = "TIME_DIFFERENCE" + InformationRequestResearchFailureExplanation InformationRequestKind = "RESEARCH_FAILURE_EXPLANATION" ) type Conversation struct { diff --git a/modules/interaction/domain/chat.go b/modules/interaction/domain/chat.go index 36555b8..d634d30 100644 --- a/modules/interaction/domain/chat.go +++ b/modules/interaction/domain/chat.go @@ -651,6 +651,9 @@ func informationRequestKind(message string, candidate interaction.SemanticCandid if containsStemInTokens(tokens, "разниц") && containsStemInTokens(tokens, "времен", "час") { return interaction.InformationRequestTimeDifference } + if containsStemInTokens(tokens, "почему", "зачем") && containsStemInTokens(tokens, "смог", "неполуч", "нашел", "нашёл") && containsStemInTokens(tokens, "ответ", "данн", "найт") { + return interaction.InformationRequestResearchFailureExplanation + } inquiry := candidate.PrimarySpeechAct == interaction.SpeechActQuestion || candidate.PrimarySpeechAct == interaction.SpeechActRequestToInvestigate || candidate.SecondarySpeechAct == interaction.SpeechActQuestion || candidate.SecondarySpeechAct == interaction.SpeechActRequestToInvestigate cognitiveSubject := containsStemInTokens(tokens, "модел", "ии", "ai", "локальн", "когнитив", "канал") if cognitiveSubject && inquiry && containsStemInTokens(tokens, "какая", "какой", "текущ", "сейчас", "отвеч") && containsStemInTokens(tokens, "модел") { diff --git a/modules/interaction/domain/chat_test.go b/modules/interaction/domain/chat_test.go index cb51ff1..6038a19 100644 --- a/modules/interaction/domain/chat_test.go +++ b/modules/interaction/domain/chat_test.go @@ -120,6 +120,7 @@ func TestInformationRequestsAreClassifiedOnceByInteraction(t *testing.T) { {"какие модели доступны?", interaction.InformationRequestCognitiveModelInventory}, {"назови доступные модели", interaction.InformationRequestCognitiveModelInventory}, {"какая модель отвечает?", interaction.InformationRequestCognitiveCurrentModel}, + {"почему ты не смог найти ответ?", interaction.InformationRequestResearchFailureExplanation}, {"что ты можешь сделать без внешних моделей?", interaction.InformationRequestLocalCapabilityInventory}, {"что ты умеешь?", interaction.InformationRequestCapabilityInventory}, {"проверь состояние локального канала", interaction.InformationRequestCognitiveChannelStatus}, -- 2.54.0