From 6c880e65ca26b084f2e757e8e7c65780c4bc0ac2 Mon Sep 17 00:00:00 2001 From: Didier Durand Date: Tue, 27 Feb 2024 08:18:57 +0100 Subject: [PATCH] adding get_conversation() --- src/q_list_conversations.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/q_list_conversations.py b/src/q_list_conversations.py index 6ec697a..7c8bd56 100755 --- a/src/q_list_conversations.py +++ b/src/q_list_conversations.py @@ -82,6 +82,14 @@ def list_conversations_with_messages(app_id: str = "", usr_id: str = "", verbose return None +def get_q_conversation(app_id: str = "", usr_id: str = "", cnv_id="", verbose=False) -> dict | None: + convs = list_conversations_with_messages(app_id, usr_id, verbose) + for conv in convs: + if conv["conversationId"] == cnv_id: + return conv + return None + + if __name__ == "__main__": parser = argparse.ArgumentParser(description="list documents indexed by Amazon Q") parser.add_argument("-a", "--app_id", type=str, help="Q application id")