Utils
Utils for the public chat
Chat Bot
Celery tasks for processing Chat Bot messages
- async integreat_cms.api.v3.chat.utils.chat_bot.async_process_translate(message_text: str, source_language: str, target_language: str) dict [source]
Process automatic or counselor answers
- async integreat_cms.api.v3.chat.utils.chat_bot.async_process_user_message(zammad_chat_language_slug: str, region_slug: str, region_default_language_slug: str, messages: list[dict]) tuple[dict, dict] [source]
Process the message from an Integreat App user
- Parameters:
- Returns:
a tuple of the answer and translation dict
- Return type:
- async integreat_cms.api.v3.chat.utils.chat_bot.automatic_answer(messages: list, region_slug: str, language_slug: str, session: ClientSession) dict [source]
Get automatic answer to question asynchronously
- async integreat_cms.api.v3.chat.utils.chat_bot.automatic_translation(message: str, source_language_slug: str, target_language_slug: str, session: ClientSession) dict [source]
Use LLM to translate message asynchronously
- Parameters:
message (str) – Message text that should be translated
source_language – source language of the message to be translated
target_language – target language of the message to be translated
session (ClientSession) – the aiohttp session used for sending the request
source_language_slug (str)
target_language_slug (str)
- Returns:
dict containing the translated message
- Return type: