Track if intent was processed locally (#132166)

pull/132245/head^2
Jan-Philipp Benecke 2024-12-04 09:52:15 +01:00 committed by GitHub
parent ab1f03f392
commit 6b7724c556
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 1 deletions

View File

@ -1018,6 +1018,7 @@ class PipelineRun:
"intent_input": intent_input,
"conversation_id": conversation_id,
"device_id": device_id,
"prefer_local_intents": self.pipeline.prefer_local_intents,
},
)
)
@ -1031,6 +1032,7 @@ class PipelineRun:
language=self.pipeline.language,
agent_id=self.intent_agent,
)
processed_locally = self.intent_agent == conversation.HOME_ASSISTANT_AGENT
conversation_result: conversation.ConversationResult | None = None
if user_input.agent_id != conversation.HOME_ASSISTANT_AGENT:
@ -1061,6 +1063,7 @@ class PipelineRun:
response=intent_response,
conversation_id=user_input.conversation_id,
)
processed_locally = True
if conversation_result is None:
# Fall back to pipeline conversation agent
@ -1085,7 +1088,10 @@ class PipelineRun:
self.process_event(
PipelineEvent(
PipelineEventType.INTENT_END,
{"intent_output": conversation_result.as_dict()},
{
"processed_locally": processed_locally,
"intent_output": conversation_result.as_dict(),
},
)
)

View File

@ -37,6 +37,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en',
'prefer_local_intents': False,
}),
'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}),
@ -60,6 +61,7 @@
}),
}),
}),
'processed_locally': True,
}),
'type': <PipelineEventType.INTENT_END: 'intent-end'>,
}),
@ -126,6 +128,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en-US',
'prefer_local_intents': False,
}),
'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}),
@ -149,6 +152,7 @@
}),
}),
}),
'processed_locally': True,
}),
'type': <PipelineEventType.INTENT_END: 'intent-end'>,
}),
@ -215,6 +219,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en-US',
'prefer_local_intents': False,
}),
'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}),
@ -238,6 +243,7 @@
}),
}),
}),
'processed_locally': True,
}),
'type': <PipelineEventType.INTENT_END: 'intent-end'>,
}),
@ -328,6 +334,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en',
'prefer_local_intents': False,
}),
'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}),
@ -351,6 +358,7 @@
}),
}),
}),
'processed_locally': True,
}),
'type': <PipelineEventType.INTENT_END: 'intent-end'>,
}),

View File

@ -36,6 +36,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_audio_pipeline.4
@ -58,6 +59,7 @@
}),
}),
}),
'processed_locally': True,
})
# ---
# name: test_audio_pipeline.5
@ -117,6 +119,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_audio_pipeline_debug.4
@ -139,6 +142,7 @@
}),
}),
}),
'processed_locally': True,
})
# ---
# name: test_audio_pipeline_debug.5
@ -210,6 +214,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_audio_pipeline_with_enhancements.4
@ -232,6 +237,7 @@
}),
}),
}),
'processed_locally': True,
})
# ---
# name: test_audio_pipeline_with_enhancements.5
@ -313,6 +319,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'test transcript',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_audio_pipeline_with_wake_word_no_timeout.6
@ -335,6 +342,7 @@
}),
}),
}),
'processed_locally': True,
})
# ---
# name: test_audio_pipeline_with_wake_word_no_timeout.7
@ -519,6 +527,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'Are the lights on?',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_intent_failed.2
@ -541,6 +550,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'Are the lights on?',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_intent_timeout.2
@ -569,6 +579,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'never mind',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_pipeline_empty_tts_output.2
@ -592,6 +603,7 @@
}),
}),
}),
'processed_locally': True,
})
# ---
# name: test_pipeline_empty_tts_output.3
@ -680,6 +692,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'Are the lights on?',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_text_only_pipeline[extra_msg0].2
@ -702,6 +715,7 @@
}),
}),
}),
'processed_locally': True,
})
# ---
# name: test_text_only_pipeline[extra_msg0].3
@ -724,6 +738,7 @@
'engine': 'conversation.home_assistant',
'intent_input': 'Are the lights on?',
'language': 'en',
'prefer_local_intents': False,
})
# ---
# name: test_text_only_pipeline[extra_msg1].2
@ -746,6 +761,7 @@
}),
}),
}),
'processed_locally': True,
})
# ---
# name: test_text_only_pipeline[extra_msg1].3