mirror of
https://github.com/father-bot/chatgpt_telegram_bot.git
synced 2026-08-03 13:27:16 +03:00
512x512 is not a valid DALL-E 3 size. Default to 1024x1024 and update the example config to list the supported DALL-E 3 sizes and note the one-image-per-request limit.
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
import yaml
|
|
import dotenv
|
|
from pathlib import Path
|
|
|
|
config_dir = Path(__file__).parent.parent.resolve() / "config"
|
|
|
|
# load yaml config
|
|
with open(config_dir / "config.yml", 'r') as f:
|
|
config_yaml = yaml.safe_load(f)
|
|
|
|
# load .env config
|
|
config_env = dotenv.dotenv_values(config_dir / "config.env")
|
|
|
|
# config parameters
|
|
telegram_token = config_yaml["telegram_token"]
|
|
openai_api_key = config_yaml["openai_api_key"]
|
|
openai_api_base = config_yaml.get("openai_api_base", None)
|
|
openrouter_api_key = config_yaml.get("openrouter_api_key", None)
|
|
openrouter_api_base = config_yaml.get("openrouter_api_base", "https://openrouter.ai/api/v1")
|
|
allowed_telegram_usernames = config_yaml["allowed_telegram_usernames"]
|
|
new_dialog_timeout = config_yaml["new_dialog_timeout"]
|
|
enable_message_streaming = config_yaml.get("enable_message_streaming", True)
|
|
return_n_generated_images = config_yaml.get("return_n_generated_images", 1)
|
|
image_size = config_yaml.get("image_size", "1024x1024")
|
|
n_chat_modes_per_page = config_yaml.get("n_chat_modes_per_page", 5)
|
|
mongodb_uri = f"mongodb://mongo:{config_env['MONGODB_PORT']}"
|
|
|
|
# chat_modes
|
|
with open(config_dir / "chat_modes.yml", 'r') as f:
|
|
chat_modes = yaml.safe_load(f)
|
|
|
|
# models
|
|
with open(config_dir / "models.yml", 'r') as f:
|
|
models = yaml.safe_load(f)
|
|
|
|
# files
|
|
help_group_chat_video_path = Path(__file__).parent.parent.resolve() / "static" / "help_group_chat.mp4"
|