Parse command-line arguments
()
| 47 | |
| 48 | |
| 49 | def parse_args(): |
| 50 | """Parse command-line arguments""" |
| 51 | parser = argparse.ArgumentParser( |
| 52 | description="Paper2PPT CLI - Convert papers to PPT presentations", |
| 53 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 54 | epilog=""" |
| 55 | Examples: |
| 56 | # Basic usage |
| 57 | python script/run_paper2ppt_cli.py --input paper.pdf --api-key sk-xxx --page-count 15 |
| 58 | |
| 59 | # With custom style |
| 60 | python script/run_paper2ppt_cli.py --input paper.pdf --style "北京大学风格;英文;学术风格" --language zh |
| 61 | |
| 62 | # Long paper mode |
| 63 | python script/run_paper2ppt_cli.py --input long_paper.pdf --use-long-paper --page-count 60 |
| 64 | |
| 65 | Environment Variables: |
| 66 | DF_API_URL - Default LLM API URL |
| 67 | DF_API_KEY - Default API key |
| 68 | DF_MODEL - Default text model name |
| 69 | """ |
| 70 | ) |
| 71 | |
| 72 | # Required arguments |
| 73 | parser.add_argument( |
| 74 | "--input", |
| 75 | required=True, |
| 76 | help="Input file (PDF/PPTX) or text content" |
| 77 | ) |
| 78 | |
| 79 | # Optional arguments |
| 80 | parser.add_argument( |
| 81 | "--input-type", |
| 82 | choices=["PDF", "TEXT", "TOPIC", "PPTX"], |
| 83 | help="Input type (auto-detect if not specified)" |
| 84 | ) |
| 85 | |
| 86 | parser.add_argument( |
| 87 | "--api-url", |
| 88 | help="LLM API URL (default: from env DF_API_URL)" |
| 89 | ) |
| 90 | |
| 91 | parser.add_argument( |
| 92 | "--api-key", |
| 93 | help="LLM API key (default: from env DF_API_KEY)" |
| 94 | ) |
| 95 | |
| 96 | parser.add_argument( |
| 97 | "--image-api-url", |
| 98 | help="Image generation API URL (default: from env DF_IMAGE_API_URL)" |
| 99 | ) |
| 100 | |
| 101 | parser.add_argument( |
| 102 | "--image-api-key", |
| 103 | help="Image generation API key (default: from env DF_IMAGE_API_KEY)" |
| 104 | ) |
| 105 | |
| 106 | parser.add_argument( |