Skip to content

Commit d00ed40

Browse files
fixes
1 parent d9df8ff commit d00ed40

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

services/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ services:
877877
WEBSERVER_PORT: ${WB_API_WEBSERVER_PORT}
878878
WEBSERVER_RPC_NAMESPACE: ${WB_API_WEBSERVER_HOST}
879879
WEBSERVER_STATICWEB: "null"
880-
WEBSERVER_CONVERSATIONS: "false" # override *webserver_environment
880+
WEBSERVER_CONVERSATIONS: "null" # override *webserver_environment
881881
WEBSERVER_CHATBOT: "null" # override *webserver_environment
882882
WEBSERVER_FOGBUGZ: "null" # override *webserver_environment
883883

@@ -922,7 +922,7 @@ services:
922922
WEBSERVER_ANNOUNCEMENTS: ${WB_DB_EL_ANNOUNCEMENTS}
923923
WEBSERVER_CATALOG: ${WB_DB_EL_CATALOG}
924924
WEBSERVER_CHATBOT: "null"
925-
WEBSERVER_CONVERSATIONS: "false"
925+
WEBSERVER_CONVERSATIONS: "null"
926926
WEBSERVER_CELERY: "null"
927927
WEBSERVER_DB_LISTENER: ${WB_DB_EL_DB_LISTENER}
928928
WEBSERVER_DIAGNOSTICS: ${WB_DB_EL_DIAGNOSTICS}
@@ -1005,7 +1005,7 @@ services:
10051005
WEBSERVER_ANNOUNCEMENTS: ${WB_GC_ANNOUNCEMENTS}
10061006
WEBSERVER_CATALOG: ${WB_GC_CATALOG}
10071007
WEBSERVER_CHATBOT: "null"
1008-
WEBSERVER_CONVERSATIONS: "false"
1008+
WEBSERVER_CONVERSATIONS: "null"
10091009
WEBSERVER_CELERY: "null"
10101010
WEBSERVER_DB_LISTENER: ${WB_GC_DB_LISTENER}
10111011
WEBSERVER_DIAGNOSTICS: ${WB_GC_DIAGNOSTICS}
@@ -1082,7 +1082,7 @@ services:
10821082
WEBSERVER_ANNOUNCEMENTS: 0
10831083
WEBSERVER_CATALOG: "null"
10841084
WEBSERVER_CHATBOT: "null"
1085-
WEBSERVER_CONVERSATIONS: "false"
1085+
WEBSERVER_CONVERSATIONS: "null"
10861086
WEBSERVER_CELERY: "null"
10871087
WEBSERVER_DB_LISTENER: 0
10881088
WEBSERVER_DIRECTOR_V2: "null"

services/web/server/src/simcore_service_webserver/chatbot/_process_chatbot_trigger_service.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from servicelib.rabbitmq import RabbitMQClient
1414

1515
from ..conversations import conversations_service
16+
from ..conversations.errors import ConversationErrorNotFoundError
1617
from ..products import products_service
1718
from ..rabbitmq import get_rabbitmq_client
1819
from .chatbot_service import get_chatbot_rest_client
@@ -57,15 +58,21 @@ async def _process_chatbot_trigger_message(app: web.Application, data: bytes) ->
5758
chatbot_client = get_chatbot_rest_client(app)
5859
chat_response = await chatbot_client.ask_question(_question_for_chatbot)
5960

60-
await conversations_service.create_support_message(
61-
app=app,
62-
product_name=rabbit_message.conversation.product_name,
63-
user_id=_product.support_chatbot_user_id,
64-
conversation_user_type=ConversationUserType.CHATBOT_USER,
65-
conversation=rabbit_message.conversation,
66-
content=chat_response.answer,
67-
type_=ConversationMessageType.MESSAGE,
68-
)
61+
try:
62+
await conversations_service.create_support_message(
63+
app=app,
64+
product_name=rabbit_message.conversation.product_name,
65+
user_id=_product.support_chatbot_user_id,
66+
conversation_user_type=ConversationUserType.CHATBOT_USER,
67+
conversation=rabbit_message.conversation,
68+
content=chat_response.answer,
69+
type_=ConversationMessageType.MESSAGE,
70+
)
71+
except ConversationErrorNotFoundError:
72+
_logger.debug(
73+
"Can not create a support message as conversation %s was not found",
74+
rabbit_message.conversation.conversation_id,
75+
)
6976
return True
7077

7178

services/web/server/src/simcore_service_webserver/conversations/_conversation_message_repository.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
from sqlalchemy.sql import select
2525

2626
from ..db.plugin import get_asyncpg_engine
27-
from .errors import ConversationMessageErrorNotFoundError
27+
from .errors import (
28+
ConversationErrorNotFoundError,
29+
ConversationMessageErrorNotFoundError,
30+
)
2831

2932
_logger = logging.getLogger(__name__)
3033

@@ -56,7 +59,10 @@ async def create(
5659
)
5760
.returning(*_SELECTION_ARGS)
5861
)
59-
row = result.one()
62+
row = result.one_or_none()
63+
if row is None:
64+
raise ConversationErrorNotFoundError(conversation_id=conversation_id)
65+
6066
return ConversationMessageGetDB.model_validate(row)
6167

6268

0 commit comments

Comments
 (0)