Skip to content

Commit 157d2c0

Browse files
howejacob1claude
andcommitted
Fix opts None crash and filter non-recording dialogs in wtf_transcribe
Guard against opts=None in run() and use is_dialog_recording() check instead of is_dialog_transcribable_type() to prevent non-audio dialogs from being sent to vfun. Remove unused functions. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent f42f9bd commit 157d2c0

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

server/links/wtf_transcribe/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ def analysis_dialog_index(analysis):
5454
def is_dialog_recording(dialog):
5555
return dialog.get("type") == "recording"
5656

57-
def does_dialog_have_content(dialog):
58-
return dialog.get("body") or dialog.get("url")
5957

6058
def is_dialog_index_already_transcribed(vcon: Any, dialog_index: int) -> bool:
6159
for analysis in vcon.analysis:
@@ -130,11 +128,9 @@ def dialog_to_binary(dialog, url_timeout=60):
130128
return base64_dialog_to_binary(dialog)
131129
raise TypeError("Failed to convert dialog to binary-- unrecognized type")
132130

133-
def is_dialog_transcribable_type(dialog):
134-
return is_url_dialog(dialog) or is_base64url_dialog(dialog) or is_base64_dialog(dialog)
135131

136132
def should_transcribe_dialog(vcon, dialog):
137-
if is_dialog_transcribable_type(dialog):
133+
if is_dialog_recording(dialog):
138134
if not is_dialog_already_transcribed(vcon, dialog):
139135
return True
140136
return False
@@ -263,6 +259,8 @@ def run(
263259
link_name: str,
264260
opts: Dict[str, Any] = None) -> Optional[str]:
265261
logger.info(f"Starting wtf_transcribe link for vCon: {vcon_uuid}")
262+
# default {} can be confusing
263+
opts = opts or {}
266264
install_opts(opts)
267265
redis = init_redis()
268266

0 commit comments

Comments
 (0)