Set voice starters to make prompt out of the transcript

This commit is contained in:
Ivan Milov
2023-04-21 13:21:30 +02:00
parent 8faf704176
commit a919cbb71e
4 changed files with 7 additions and 1 deletions

View File

@@ -321,7 +321,10 @@ class ChatGPTTelegramBot:
if str(user_id) not in allowed_user_ids and 'guests' in self.usage:
self.usage["guests"].add_transcription_seconds(audio_track.duration_seconds, transcription_price)
if self.config['voice_reply_transcript']:
# check if transcript starts with any of the prefixes
response_to_transcription = any(transcript.startswith(prefix) for prefix in self.config['voice_reply_prompts'])
if self.config['voice_reply_transcript'] and not response_to_transcription:
# Split into chunks of 4096 characters (Telegram's message limit)
transcript_output = f"_{localized_text('transcript', bot_language)}:_\n\"{transcript}\""