mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-19 21:55:06 +01:00
minor improvements
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
|
||||
import tiktoken
|
||||
|
||||
@@ -26,21 +27,12 @@ def default_max_tokens(model: str) -> int:
|
||||
"""
|
||||
return 1200 if model in GPT_3_MODELS else 2400
|
||||
|
||||
|
||||
### this will reload the correct translations.json which is located inside the parent directory
|
||||
|
||||
import os
|
||||
|
||||
# Load translations
|
||||
parent_dir_path = os.path.join(os.path.dirname(__file__), os.pardir)
|
||||
translations_file_path = os.path.join(parent_dir_path, 'translations.json')
|
||||
|
||||
with open(translations_file_path, 'r', encoding='utf-8') as f:
|
||||
translations = json.load(f)
|
||||
|
||||
#with open('translations.json', 'r', encoding='utf-8') as f:
|
||||
# translations = json.load(f)
|
||||
|
||||
|
||||
def localized_text(key, bot_language):
|
||||
"""
|
||||
Return translated text for a key in specified bot_language.
|
||||
|
||||
Reference in New Issue
Block a user