Validate input and return (input_content, resolved_input_type)
(input_str: str, input_type: str)
| 174 | |
| 175 | |
| 176 | def validate_input(input_str: str, input_type: str) -> tuple[str, str]: |
| 177 | """ |
| 178 | Validate input and return (input_content, resolved_input_type) |
| 179 | """ |
| 180 | if input_type in ["PDF", "PPTX"]: |
| 181 | path = Path(input_str) |
| 182 | if not path.exists(): |
| 183 | raise FileNotFoundError(f"Input file not found: {input_str}") |
| 184 | |
| 185 | # Validate extension |
| 186 | ext = path.suffix.lower() |
| 187 | if input_type == "PDF" and ext != ".pdf": |
| 188 | raise ValueError(f"Expected PDF file, got {ext}") |
| 189 | elif input_type == "PPTX" and ext not in [".pptx", ".ppt"]: |
| 190 | raise ValueError(f"Expected PPTX file, got {ext}") |
| 191 | |
| 192 | return str(path.resolve()), input_type |
| 193 | else: |
| 194 | # TEXT or TOPIC input |
| 195 | return input_str, input_type |
| 196 | |
| 197 | |
| 198 | def create_output_dir(args) -> Path: |