Skip to content

Commit

Permalink
Merge pull request n3d1117#244 from bestmgmt/patch-1
Browse files Browse the repository at this point in the history
Fixing the path to the tranlsations.json
  • Loading branch information
n3d1117 authored and Yaroslav Malykh committed Apr 19, 2023
1 parent 7104190 commit f527920
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bot/openai_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@ def default_max_tokens(model: str) -> int:
return 1200 if model in GPT_3_MODELS else 2400


with open('translations.json', 'r', encoding='utf-8') as f:
### this will reload the correct translations.json which is located inside the parent directory

import os

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):
"""
Expand Down

0 comments on commit f527920

Please sign in to comment.