Parse command-line arguments
()
| 45 | |
| 46 | |
| 47 | def parse_args(): |
| 48 | """Parse command-line arguments""" |
| 49 | parser = argparse.ArgumentParser( |
| 50 | description="PPT2Polish CLI - Beautify existing PPT files", |
| 51 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 52 | epilog=""" |
| 53 | Examples: |
| 54 | # Basic beautification |
| 55 | python script/run_ppt2polish_cli.py --input old_presentation.pptx --style "学术风格,简洁大方" --api-key sk-xxx |
| 56 | |
| 57 | # With reference image for consistent style |
| 58 | python script/run_ppt2polish_cli.py --input old_presentation.pptx --style "现代简约风格" --ref-img reference_style.png |
| 59 | |
| 60 | Environment Variables: |
| 61 | DF_API_URL - Default LLM API URL |
| 62 | DF_API_KEY - Default API key |
| 63 | DF_MODEL - Default text model name |
| 64 | """ |
| 65 | ) |
| 66 | |
| 67 | # Required arguments |
| 68 | parser.add_argument( |
| 69 | "--input", |
| 70 | required=True, |
| 71 | help="Input PPT/PPTX file path" |
| 72 | ) |
| 73 | |
| 74 | # Optional arguments |
| 75 | parser.add_argument( |
| 76 | "--api-url", |
| 77 | help="LLM API URL (default: from env DF_API_URL)" |
| 78 | ) |
| 79 | |
| 80 | parser.add_argument( |
| 81 | "--api-key", |
| 82 | help="LLM API key (default: from env DF_API_KEY)" |
| 83 | ) |
| 84 | |
| 85 | parser.add_argument( |
| 86 | "--image-api-url", |
| 87 | help="Image generation API URL (default: from env DF_IMAGE_API_URL)" |
| 88 | ) |
| 89 | |
| 90 | parser.add_argument( |
| 91 | "--image-api-key", |
| 92 | help="Image generation API key (default: from env DF_IMAGE_API_KEY)" |
| 93 | ) |
| 94 | |
| 95 | parser.add_argument( |
| 96 | "--model", |
| 97 | default=settings.PAPER2PPT_CONTENT_MODEL, |
| 98 | help=f"Text model name (default: {settings.PAPER2PPT_CONTENT_MODEL})" |
| 99 | ) |
| 100 | |
| 101 | parser.add_argument( |
| 102 | "--gen-fig-model", |
| 103 | default=settings.PAPER2PPT_IMAGE_GEN_MODEL, |
| 104 | help=f"Image generation model (default: {settings.PAPER2PPT_IMAGE_GEN_MODEL})" |