diff --git a/question.py b/question.py index 11c7b7d..9f1809c 100755 --- a/question.py +++ b/question.py @@ -20,6 +20,9 @@ openai.api_key = api_key +# App version +APP_VERSION = "0.7.0" + def call_openai_api(question): try: MODEL = "gpt-4-0613" @@ -43,16 +46,21 @@ def call_openai_api(question): exit(1) # Get user input from command line argument - question = sys.argv[1] - logging.info(f"Received input: {question}") - - # Call OpenAI API - response = call_openai_api(question) + arg = sys.argv[1] - # Output response or failure message - if response: - markdown_response = Markdown(response) - rprint("Assistant says:", markdown_response) + if arg == "--version": + print(f"App version: {APP_VERSION}") + exit(0) else: - print("Failed to get a response.") + logging.info(f"Received input: {arg}") + + # Call OpenAI API + response = call_openai_api(arg) + + # Output response or failure message + if response: + markdown_response = Markdown(response) + rprint("Assistant says:", markdown_response) + else: + print("Failed to get a response.")