mirror of
https://github.com/SevaSk/ecoute.git
synced 2025-02-23 18:10:22 +00:00
bug fixes
This commit is contained in:
parent
86b97d0039
commit
5fb82347c3
@ -92,7 +92,7 @@ class AudioTranscriber:
|
||||
|
||||
if source_info["new_phrase"] or len(transcript) == 0:
|
||||
if len(transcript) > MAX_PHRASES:
|
||||
transcript.pop(0) # remove oldest phrase
|
||||
transcript.pop(-1)
|
||||
transcript.insert(0, (f"{who_spoke}: [{text}]\n\n", time_spoken))
|
||||
else:
|
||||
transcript[0] = (f"{who_spoke}: [{text}]\n\n", time_spoken)
|
||||
|
@ -25,12 +25,21 @@ class GPTResponder:
|
||||
def respond_to_transcriber(self, transcriber):
|
||||
while True:
|
||||
if transcriber.transcript_changed_event.is_set():
|
||||
start_time = time.time()
|
||||
|
||||
transcriber.transcript_changed_event.clear()
|
||||
transcript_string = transcriber.get_transcript()
|
||||
response = generate_response_from_transcript(transcript_string)
|
||||
|
||||
end_time = time.time() # Measure end time
|
||||
execution_time = end_time - start_time # Calculate the time it took to execute the function
|
||||
|
||||
if response != '':
|
||||
self.response = response
|
||||
time.sleep(self.response_interval)
|
||||
|
||||
remaining_time = self.response_interval - execution_time
|
||||
if remaining_time > 0:
|
||||
time.sleep(remaining_time)
|
||||
else:
|
||||
time.sleep(0.3)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user