Skip to content

Commit f38fdaf

Browse files
Handle optional audio path in the dialog.to_audio() method
1 parent d1e17b9 commit f38fdaf

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/sdialog/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def to_file(self, path: str = None, type: str = "auto",
466466

467467
def to_audio(
468468
self,
469-
path: str,
469+
path: str = None,
470470
**kwargs: dict
471471
):
472472
"""
@@ -530,7 +530,8 @@ def to_audio(
530530
except Exception:
531531
raise Exception("The audio module is not installed. Please install it with `pip install sdialog[audio]`")
532532

533-
kwargs["dir_audio"] = path
533+
if path is not None:
534+
kwargs["dir_audio"] = path
534535

535536
return to_audio(
536537
self,

src/sdialog/audio/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def inference(
594594
))
595595

596596
# Override the dialog directory name if provided otherwise use the dialog id as the directory name
597-
dialog_directory = dialog_dir_name or ""
597+
dialog_directory = dialog_dir_name or str(dialog.id) or ""
598598
dialog.audio_dir_path = self.dir_audio
599599

600600
dialog.audio_step_1_filepath = os.path.join(

0 commit comments

Comments
 (0)