mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
Refactor voice recording and transcription to allow for specifying the language.
This commit is contained in:
parent
f4e1c1010b
commit
23579d4741
2 changed files with 9 additions and 4 deletions
|
@ -60,7 +60,7 @@ class Voice:
|
|||
except KeyboardInterrupt:
|
||||
return
|
||||
|
||||
def raw_record_and_transcribe(self, history):
|
||||
def raw_record_and_transcribe(self, history, language):
|
||||
self.q = queue.Queue()
|
||||
|
||||
filename = tempfile.mktemp(suffix=".wav")
|
||||
|
@ -77,7 +77,7 @@ class Voice:
|
|||
file.write(self.q.get())
|
||||
|
||||
with open(filename, "rb") as fh:
|
||||
transcript = openai.Audio.transcribe("whisper-1", fh, prompt=history)
|
||||
transcript = openai.Audio.transcribe("whisper-1", fh, prompt=history, language=language)
|
||||
|
||||
text = transcript["text"]
|
||||
return text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue