Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support client alert handling #54

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion neon_messagebus_mq_connector/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def register_bus_handlers(self):
self._bus.on('ovos.languages.tts.response', self.handle_neon_message)
self._bus.on('neon.languages.skills.response', self.handle_neon_message)
self._bus.on('neon.languages.get.response', self.handle_neon_message)
self._bus.on('neon.alert_expired', self.handle_neon_message)

def connect_bus(self, refresh: bool = False):
"""
Expand Down Expand Up @@ -253,7 +254,9 @@ def validate_request(cls, msg_data: dict):
else:
message_templates.append(matching_template_model)
else:
raise ValueError(f"Unable to validate input message: {msg_data}")
LOG.warning(f"Handling arbitrary message: {msg_type}")
message_templates = [templates.get('message')]
# raise ValueError(f"Unable to validate input message: {msg_data}")
detected_error, msg_data = cls.__validate_message_templates(
msg_data=msg_data, message_templates=message_templates)
return detected_error, msg_data
Expand Down
9 changes: 8 additions & 1 deletion neon_messagebus_mq_connector/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class Config:
extra = "allow"


class MessageModel(BaseModel):
msg_type: str
data: dict
context: dict


class RecognizerMessage(BaseModel):
msg_type: str = "recognizer_loop:utterance"
data: create_model("Data",
Expand All @@ -51,7 +57,7 @@ class RecognizerMessage(BaseModel):
timing=(dict, {}),
neon_should_respond=(bool, True),
username=(str, "guest"),
klat_data=(dict, {'key': 'val'}),
klat_data=(dict, {}),
mq=(dict, None),
user_profiles=(list, []),
request_skills=(List[str], None),
Expand Down Expand Up @@ -108,4 +114,5 @@ class TTSMessage(BaseModel):
"tts": TTSMessage,
"audio_input": AudioInput,
"recognizer": RecognizerMessage,
"message": MessageModel
}
Loading