Skip to content

Commit 8dbf181

Browse files
committed
Fix wtf_transcribe option handling and dialog filtering
1 parent f42f9bd commit 8dbf181

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

server/links/wtf_transcribe/__init__.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +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")
59-
6057
def is_dialog_index_already_transcribed(vcon: Any, dialog_index: int) -> bool:
6158
for analysis in vcon.analysis:
6259
if (analysis_is_wtf_transcription(analysis) and
@@ -134,7 +131,7 @@ def is_dialog_transcribable_type(dialog):
134131
return is_url_dialog(dialog) or is_base64url_dialog(dialog) or is_base64_dialog(dialog)
135132

136133
def should_transcribe_dialog(vcon, dialog):
137-
if is_dialog_transcribable_type(dialog):
134+
if is_dialog_recording(dialog) and is_dialog_transcribable_type(dialog):
138135
if not is_dialog_already_transcribed(vcon, dialog):
139136
return True
140137
return False
@@ -161,10 +158,10 @@ def create_wtf_analysis(
161158
}
162159

163160
def install_opts(opts):
164-
for key, value in default_options.items():
165-
if key not in opts:
166-
opts[key] = value
167-
161+
merged_opts = default_options.copy()
162+
if opts:
163+
merged_opts.update(opts)
164+
return merged_opts
168165

169166
def verify_opts(opts):
170167
if not opts.get("vfun-server-url"):
@@ -263,7 +260,7 @@ def run(
263260
link_name: str,
264261
opts: Dict[str, Any] = None) -> Optional[str]:
265262
logger.info(f"Starting wtf_transcribe link for vCon: {vcon_uuid}")
266-
install_opts(opts)
263+
opts = install_opts(opts)
267264
redis = init_redis()
268265

269266
if not verify_opts(opts):

0 commit comments

Comments
 (0)