Skip to content

Commit

Permalink
Missing submit button (#30)
Browse files Browse the repository at this point in the history
* Updates MessageTypeEnum to include options and message types

* Update app/user_prompt_support/user_prompt_manager.py

Co-authored-by: antonio-amjr <116589331+antonio-amjr@users.noreply.github.com>

* Update app/constants/websockets_constants.py

Co-authored-by: hiltonlima <116589806+hiltonlima@users.noreply.github.com>

* Update app/user_prompt_support/user_prompt_manager.py

---------

Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
Co-authored-by: antonio-amjr <116589331+antonio-amjr@users.noreply.github.com>
Co-authored-by: hiltonlima <116589806+hiltonlima@users.noreply.github.com>
Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com>
  • Loading branch information
5 people authored Nov 17, 2023
1 parent 8708d9b commit 78c6ba6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/constants/websockets_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
# Enum Keys for different types of messages currently supported by the tool
class MessageTypeEnum(str, Enum):
PROMPT_REQUEST = "prompt_request"
OPTIONS_REQUEST = "options_request"
MESSAGE_REQUEST = "message_request"
PROMPT_RESPONSE = "prompt_response"
TEST_UPDATE = "test_update"
TIME_OUT_NOTIFICATION = "time_out_notification"
Expand Down
2 changes: 1 addition & 1 deletion app/tests/user_prompts/test_options_select_user_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def __expected_response_dict_cancelled() -> Dict[str, Any]:

def __expected_prompt_dict(timeout: int = 2, message_id: int = 1) -> Dict[str, Any]:
return {
MessageKeysEnum.TYPE: MessageTypeEnum.PROMPT_REQUEST,
MessageKeysEnum.TYPE: MessageTypeEnum.OPTIONS_REQUEST,
MessageKeysEnum.PAYLOAD: {
OPTIONS_KEY: test_options,
TIMEOUT_KEY: timeout,
Expand Down
10 changes: 9 additions & 1 deletion app/user_prompt_support/user_prompt_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ def __init__(self, prompt: PromptRequest, message_id: int) -> None:
def as_dictionary(self) -> Dict[MessageKeysEnum, Any]:
prompt_dict = self.prompt.dict()
prompt_dict[MESSAGE_ID_KEY] = self.message_id
message_type = MessageTypeEnum.PROMPT_REQUEST

# Check if options exist
if "options" in prompt_dict:
if prompt_dict["options"]:
message_type = MessageTypeEnum.OPTIONS_REQUEST
else:
message_type = MessageTypeEnum.MESSAGE_REQUEST
message_dict = {
MessageKeysEnum.TYPE: MessageTypeEnum.PROMPT_REQUEST,
MessageKeysEnum.TYPE: message_type,
MessageKeysEnum.PAYLOAD: prompt_dict,
}
return message_dict
Expand Down

0 comments on commit 78c6ba6

Please sign in to comment.