Browse Source

dont translate from en to en

master
Hendrik Langer 2 years ago
parent
commit
da691ed8a1
  1. 7
      matrix_pygmalion_bot/core.py

7
matrix_pygmalion_bot/core.py

@ -257,11 +257,12 @@ class Callbacks(object):
answer = await self.bot.text_ai.generate_sync(full_prompt, self.bot.runpod_api_key, self.bot, typing)
answer = answer.strip()
await self.client.room_typing(room.room_id, False)
if not (self.bot.translate is None):
if (self.bot.translate is None) or (self.bot.translate == "en"):
await self.bot.send_message(self.client, room.room_id, answer, reply_to=chat_message.event_id)
else:
translated_answer = translate.translate(answer, "en", self.bot.translate)
await self.bot.send_message(self.client, room.room_id, translated_answer, reply_to=chat_message.event_id, original_message=answer)
else:
await self.bot.send_message(self.client, room.room_id, answer, reply_to=chat_message.event_id)
if not "message_count" in self.bot.room_config[room.room_id]:
self.bot.room_config[room.room_id]["message_count"] = 0
self.bot.room_config[room.room_id]["message_count"] += 1

Loading…
Cancel
Save