mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-19 21:55:06 +01:00
Simplify telegram_config setter
This commit is contained in:
@@ -68,7 +68,7 @@ def main():
|
|||||||
'stream': os.environ.get('STREAM', 'true').lower() == 'true',
|
'stream': os.environ.get('STREAM', 'true').lower() == 'true',
|
||||||
'proxy': os.environ.get('PROXY', None),
|
'proxy': os.environ.get('PROXY', None),
|
||||||
'voice_reply_transcript': os.environ.get('VOICE_REPLY_WITH_TRANSCRIPT_ONLY', 'false').lower() == 'true',
|
'voice_reply_transcript': os.environ.get('VOICE_REPLY_WITH_TRANSCRIPT_ONLY', 'false').lower() == 'true',
|
||||||
'voice_reply_prompts': () if os.environ.get('VOICE_REPLY_PROMPTS', None) is None else os.environ.get('VOICE_REPLY_PROMPTS').split(";"),
|
'voice_reply_prompts': os.environ.get('VOICE_REPLY_PROMPTS', '').split(';'),
|
||||||
'ignore_group_transcriptions': os.environ.get('IGNORE_GROUP_TRANSCRIPTIONS', 'true').lower() == 'true',
|
'ignore_group_transcriptions': os.environ.get('IGNORE_GROUP_TRANSCRIPTIONS', 'true').lower() == 'true',
|
||||||
'group_trigger_keyword': os.environ.get('GROUP_TRIGGER_KEYWORD', ''),
|
'group_trigger_keyword': os.environ.get('GROUP_TRIGGER_KEYWORD', ''),
|
||||||
'token_price': float(os.environ.get('TOKEN_PRICE', 0.002)),
|
'token_price': float(os.environ.get('TOKEN_PRICE', 0.002)),
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ class ChatGPTTelegramBot:
|
|||||||
self.usage["guests"].add_transcription_seconds(audio_track.duration_seconds, transcription_price)
|
self.usage["guests"].add_transcription_seconds(audio_track.duration_seconds, transcription_price)
|
||||||
|
|
||||||
# check if transcript starts with any of the prefixes
|
# check if transcript starts with any of the prefixes
|
||||||
response_to_transcription = any(transcript.startswith(prefix) for prefix in self.config['voice_reply_prompts'])
|
response_to_transcription = any(transcript.startswith(prefix) if prefix else False for prefix in self.config['voice_reply_prompts'])
|
||||||
|
|
||||||
if self.config['voice_reply_transcript'] and not response_to_transcription:
|
if self.config['voice_reply_transcript'] and not response_to_transcription:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user