|
10 | 10 | import json |
11 | 11 | import av |
12 | 12 |
|
13 | | - |
14 | | -def check_auth_token(auth_token): |
15 | | - """Verify that an auth token is present.""" |
16 | | - if auth_token is None: |
17 | | - raise Exception("Please login first to use this node.") |
18 | | - return auth_token |
19 | | - |
20 | 13 | class IdeogramTextToImage(ComfyNodeABC): |
21 | 14 | """ |
22 | 15 | Generates images synchronously based on a given prompt and optional parameters. |
@@ -281,23 +274,26 @@ def generate_video( |
281 | 274 | task_result = video_generate_operation.execute() |
282 | 275 |
|
283 | 276 | file_id = task_result.file_id |
284 | | - |
| 277 | + if file_id is None: |
| 278 | + raise Exception("Request was not successful. Missing file ID.") |
285 | 279 | file_retrieve_operation = SynchronousOperation( |
286 | 280 | endpoint=ApiEndpoint( |
287 | 281 | path="/proxy/minimax/files/retrieve", |
288 | 282 | method=HttpMethod.GET, |
289 | 283 | request_model=EmptyRequest, |
290 | 284 | response_model=MinimaxFileRetrieveResponse, |
291 | | - query_params={"file_id": file_id}, |
| 285 | + query_params={"file_id": int(file_id)}, |
292 | 286 | ), |
293 | 287 | request=EmptyRequest(), |
294 | 288 | auth_token=auth_token, |
295 | 289 | ) |
296 | 290 | file_result = file_retrieve_operation.execute() |
297 | 291 |
|
298 | 292 | file_url = file_result.file.download_url |
299 | | - |
| 293 | + if file_url is None: |
| 294 | + raise Exception(f"No video was found in the response. Full response: {file_result.model_dump()}") |
300 | 295 | logging.info(f"Generated video URL: {file_url}") |
| 296 | + _, filename = folder_paths.download_url_to_file("comfyapinodes", file_url, folder_paths.get_output_directory()) |
301 | 297 |
|
302 | 298 | # Construct the save path |
303 | 299 | full_output_folder, filename, counter, subfolder, filename_prefix = ( |
|
0 commit comments