Skip to content

Commit

Permalink
Added functionality to prompt user for natural language query when no…
Browse files Browse the repository at this point in the history
… arguments are provided.
  • Loading branch information
MikeBirdTech committed Nov 14, 2024
1 parent 62173e2 commit b552113
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/tool_use/scripts/ai_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ def execute_command(command: str) -> None:
print(f"Error output:\n{e.stderr}")


def get_user_query() -> str:
"""Prompt the user for their natural language query."""
print("\nPlease enter your command request (what would you like to do?):")
query = input("> ").strip()
while not query:
print("Query cannot be empty. Please try again:")
query = input("> ").strip()
return query


def main(args=None):
parser = argparse.ArgumentParser(description="AI CLI Tool")
parser.add_argument(
Expand All @@ -90,11 +100,10 @@ def main(args=None):
model = known_args.model or tool_config["ai_model"]
write_to_terminal_mode = tool_config.get("write_to_terminal", True)

# Get the task description
# Get the task description from arguments or prompt
input_text = " ".join(unknown_args) if unknown_args else ""
if not input_text:
parser.print_help()
sys.exit(1)
input_text = get_user_query()

# Get environment info and query AI
env_info = get_environment_info()
Expand Down

0 comments on commit b552113

Please sign in to comment.