Skip to content

Commit 9957c41

Browse files
committed
Fixed problem with replies
1 parent 48919d9 commit 9957c41

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

backend/PyMatcha/utils/bot_actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _botaction_respond_to_unread(bot_user: User, chatbot):
117117
except IndexError:
118118
return
119119
bot_reply = chatbot.get_response(message_to_reply.content)
120-
bot_user.send_message(to_id=message_to_reply.from_id, content=bot_reply)
120+
bot_user.send_message(to_id=message_to_reply.from_id, content=bot_reply.text)
121121

122122

123123
def _botaction_send_message_over_old_one(bot_user: User, chatbot):
@@ -132,7 +132,7 @@ def _botaction_send_message_over_old_one(bot_user: User, chatbot):
132132
other_user = message_to_reply.to_id
133133

134134
bot_reply = chatbot.get_response(".")
135-
bot_user.send_message(to_id=other_user, content=bot_reply)
135+
bot_user.send_message(to_id=other_user, content=bot_reply.text)
136136

137137

138138
def decide_bot_action(bot_user: User):

backend/PyMatcha/utils/tasks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,12 @@ def bot_respond_to_message(bot_id: int, from_id: int, message_id: int):
163163
bot_user = User.get(id=bot_id)
164164
from_user = User.get(id=from_id)
165165
message = Message.get(id=message_id)
166+
167+
message.is_seen = True
168+
message.save()
169+
166170
chatbot = _prepare_chatbot(bot_user.username)
167171
reply = chatbot.get_response(message.content)
168-
bot_user.send_message(from_user.id, reply)
172+
bot_user.send_message(from_user.id, reply.text)
173+
169174
return f"Bot {bot_id} successfully replied to {from_id}"

backend/chatbot_database.sqlite3

260 KB
Binary file not shown.

workers.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ ENV PYTHONDONTWRITEBYTECODE 1
77
EXPOSE 5000
88
ADD .env .
99
RUN export $(cat .env | xargs)
10+
RUN python -m spacy download en
1011
CMD celery -A PyMatcha.celery worker -E --loglevel=INFO -B --pool=threads

0 commit comments

Comments
 (0)