config.yml.example 5.0 KB

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