config.yml.example 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. bot:
  2. # Telegram bot token, passed via environment variable BOT_TOKEN.
  3. # Used by aiogram to connect to the Telegram Bot API.
  4. token: ${BOT_TOKEN}
  5. # HTTP timeout (in seconds) for requests made by aiogram to Telegram.
  6. # aiogram internally handles retries on some network errors; this value
  7. # only defines how long a single HTTP request may take before timing out.
  8. timeout: 15
  9. behavior:
  10. throttling:
  11. # Enable/disable throttling for user-submitted posts.
  12. # When enabled, each user must wait `delay` seconds between submissions.
  13. enabled: true
  14. # Minimal delay (in seconds) between two post submissions from the same user.
  15. # The delay is measured between the moments when the user's requests are processed by the bot.
  16. delay: 120
  17. subscription_requirement:
  18. # Require users to be subscribed to specific Telegram channels before they can use the bot.
  19. # If enabled, the bot checks subscription status for each user action.
  20. enabled: false
  21. # List of Telegram chat_ids (channels) that the user must be subscribed to.
  22. channel_ids: []
  23. database:
  24. # SQLAlchemy database backend/driver.
  25. # Any backend supported by SQLAlchemy can be used.
  26. backend: ${DB_BACKEND}
  27. # Database name or path:
  28. # - For server databases (Postgres, MySQL, etc.): logical DB name.
  29. # - For SQLite: filesystem path to the DB file.
  30. # For SQLite, all other connection fields (host, port, username, password) are ignored.
  31. name_or_path: ${DB_NAME_OR_PATH}
  32. # Database host (server address). Used for server databases only.
  33. # Ignored for SQLite.
  34. host: ${DB_HOST}
  35. # Database port. Used for server databases only.
  36. # Ignored for SQLite.
  37. port: ${DB_PORT}
  38. # Database user name. Used for server databases only.
  39. # Ignored for SQLite.
  40. username: ${DB_USERNAME}
  41. # Database user password. Used for server databases only.
  42. # Ignored for SQLite.
  43. password: ${DB_PASSWORD}
  44. migrations:
  45. # Migrations backend. Project uses Alembic for schema migrations.
  46. # Alembic is configured to work with the same SQLAlchemy URL.
  47. backend: ${DB_MIGRATIONS_BACKEND}
  48. repositories:
  49. user:
  50. # Maximum number of user records cached in memory.
  51. cache_size: 1024
  52. # Time-to-live for cached user objects (in seconds).
  53. cache_ttl: 60
  54. forwarding:
  55. # Telegram chat_ids where decisions of the moderation module are sent.
  56. # Typically these are chats for moderators that receive moderation results.
  57. moderation_chat_ids: []
  58. # Telegram chat_ids where approved posts are published.
  59. # Once approved, messages are forwarded to all configured publication channels.
  60. publication_channel_ids: []
  61. # List of Telegram message types that are handled and can be forwarded
  62. # by the bot: text messages, photos, videos, etc.
  63. # Types correspond to Telegram message content types.
  64. types:
  65. - text
  66. - photo
  67. - video
  68. openai:
  69. # OpenAI API key used by the client.
  70. # Can be provided via OPENAI_API_KEY environment variable.
  71. api_key: ${OPENAI_API_KEY}
  72. # HTTP timeout (in seconds) for requests made.
  73. # If a request exceeds this timeout, the client considers it failed and
  74. # may retry according to `max_retries`.
  75. timeout: 30
  76. # Maximum number of retry attempts for OpenAI requests when
  77. # a timeout or other transient error occurs. If all attempts fail,
  78. # an exception is raised and handled by the application code.
  79. max_retries: 2
  80. moderation:
  81. # Enable/disable automatic content moderation. If disabled, messages
  82. # are not checked by any OpenAI moderation models and are sent directly
  83. # to the configured moderation and/or publication chats.
  84. enabled: true
  85. # Name of the OpenAI model used for moderation.
  86. # This is a real model name and is passed directly
  87. # to the OpenAI SDK when performing moderation checks.
  88. model: gpt-5-mini
  89. # Types of moderation flows that are enabled:
  90. # - "omni": use omni-moderation (specialized moderation model).
  91. # - "gpt": use a ChatGPT model to analyze/check content.
  92. # Both flows rely on the OpenAI SDK, and the type determines which
  93. # moderation strategy is applied for a given request.
  94. types:
  95. - omni
  96. - gpt
  97. logging:
  98. # Global logging level for the application.
  99. # Typical values: DEBUG, INFO, WARNING, ERROR, CRITICAL.
  100. level: INFO
  101. # Log message format string.
  102. # Fields:
  103. # - %(asctime)s : timestamp (formatted with date_fmt)
  104. # - %(msecs)03d : milliseconds
  105. # - %(levelname)s: log level
  106. # - %(name)s : logger name
  107. # - %(message)s : log message text
  108. fmt: '%(asctime)s.%(msecs)03d %(levelname)s [%(name)s] %(message)s'
  109. # Date/time format for %(asctime)s (strftime syntax).
  110. # Example output: 2024-01-01 12:34:56
  111. date_fmt: '%Y-%m-%d %H:%M:%S'