|
10 | 10 | from openai import OpenAI |
11 | 11 | from py_trees.display import render_dot_tree, unicode_tree |
12 | 12 |
|
13 | | -from .ai_parser import parse_message_with_ai |
14 | 13 | from .bht.conversation_state import InboxMessage |
15 | 14 | from .bht.conversation_tree import ( |
16 | 15 | create_conversation_root_node, |
@@ -356,77 +355,6 @@ def slack_bot( |
356 | 355 | ) |
357 | 356 |
|
358 | 357 |
|
359 | | -@app.command() |
360 | | -def ai( |
361 | | - message: str = typer.Option( |
362 | | - ..., "--message", "-m", help="Natural language release command" |
363 | | - ), |
364 | | - config_file: Optional[str] = typer.Option( |
365 | | - None, "--config", "-c", help="Path to config file (default: config.yaml)" |
366 | | - ), |
367 | | - openai_api_key: Optional[str] = typer.Option( |
368 | | - None, |
369 | | - "--openai-api-key", |
370 | | - help="OpenAI API key (if not provided, uses OPENAI_API_KEY env var)", |
371 | | - ), |
372 | | - model: str = typer.Option( |
373 | | - "gpt-4o-mini", |
374 | | - "--model", |
375 | | - help="OpenAI model to use (default: gpt-4o-mini)", |
376 | | - ), |
377 | | - execute: bool = typer.Option( |
378 | | - False, |
379 | | - "--execute", |
380 | | - help="Execute the release after parsing (default: just show the parsed args)", |
381 | | - ), |
382 | | - tree_cutoff: int = typer.Option( |
383 | | - 5000, "--tree-cutoff", help="Max number of ticks to run the tree for" |
384 | | - ), |
385 | | -) -> None: |
386 | | - """[EXPERIMENTAL] Parse natural language message into ReleaseArgs using AI. |
387 | | -
|
388 | | - This command uses OpenAI to parse a natural language description of a release |
389 | | - into a structured ReleaseArgs object. By default, it only displays the parsed |
390 | | - arguments. Use --execute to actually run the release. |
391 | | -
|
392 | | - Examples: |
393 | | - redis-release ai --message "Release 8.4-m01-int1" |
394 | | - redis-release ai --message "Release 8.4-m01-int1 for docker only" |
395 | | - redis-release ai --message "Force rebuild all packages for 8.4-m01-int1" |
396 | | - redis-release ai --message "Release 8.4-m01-int1 with docker as internal" --execute |
397 | | - """ |
398 | | - setup_logging() |
399 | | - |
400 | | - try: |
401 | | - # Parse the message using AI |
402 | | - args = parse_message_with_ai(message, api_key=openai_api_key, model=model) |
403 | | - |
404 | | - # Display the parsed arguments |
405 | | - logger.info("[green]Successfully parsed release arguments:[/green]") |
406 | | - print(json.dumps(args.model_dump(), indent=2, default=str)) |
407 | | - |
408 | | - if not execute: |
409 | | - logger.info( |
410 | | - "\n[yellow]Note:[/yellow] This is a dry run. Use --execute to actually run the release." |
411 | | - ) |
412 | | - return |
413 | | - |
414 | | - # Execute the release if requested |
415 | | - logger.info("\n[cyan]Executing release...[/cyan]") |
416 | | - config_path = config_file or "config.yaml" |
417 | | - config = load_config(config_path) |
418 | | - |
419 | | - with initialize_tree_and_state(config, args) as (tree, _): |
420 | | - asyncio.run(async_tick_tock(tree, cutoff=tree_cutoff)) |
421 | | - |
422 | | - except ValueError as e: |
423 | | - logger.error(f"[red]Error:[/red] {e}") |
424 | | - raise typer.Exit(1) |
425 | | - except Exception as e: |
426 | | - logger.error(f"[red]Unexpected error:[/red] {e}", exc_info=True) |
427 | | - raise typer.Exit(1) |
428 | | - |
429 | | - |
430 | 358 | @app.command() |
431 | 359 | def test_github_app( |
432 | 360 | github_app_id: str = typer.Option(..., "--github-app-id", help="GitHub App ID"), |
|
0 commit comments