Default to single line transcript
This commit is contained in:
parent
5be71fc7da
commit
4df67bd475
1 changed files with 4 additions and 2 deletions
|
@ -13,7 +13,7 @@ def summarize_text_file(content: str, prompt: str | None) -> str:
|
|||
return bot.chat(f"{prompt} {content}")
|
||||
|
||||
|
||||
def extract_transcript_contents(content: str) -> str:
|
||||
def extract_transcript_contents(content: str, keep_newlines: bool = False) -> str:
|
||||
jq_command = "jq '.events.[].segs | select(. != null).[].utf8'"
|
||||
result = subprocess.run(
|
||||
jq_command, shell=True, capture_output=True, text=True, input=content
|
||||
|
@ -22,7 +22,9 @@ def extract_transcript_contents(content: str) -> str:
|
|||
result = result.replace("\n", "").split()
|
||||
|
||||
# Join lines back together with newlines
|
||||
processed = " ".join(result).replace('"', "").replace("\\n", "\n")
|
||||
processed = (
|
||||
" ".join(result).replace('"', "").replace("\\n", "\n" if keep_newlines else " ")
|
||||
)
|
||||
|
||||
return processed
|
||||
|
||||
|
|
Loading…
Reference in a new issue