Skip to content

Commit 27f491d

Browse files
🎨 Ensure support center chatbot is platform aware (#8717)
1 parent 7dafc79 commit 27f491d

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ async def _request() -> httpx.Response:
7777
for msg in messages
7878
],
7979
"model": self._chatbot_settings.CHATBOT_MODEL,
80+
"metadata": {
81+
"collection_name": self._chatbot_settings.CHATBOT_COLLECTION_NAME
82+
},
8083
},
8184
headers={
8285
"Content-Type": MIMETYPE_APPLICATION_JSON,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class ChatbotSettings(BaseCustomSettings, MixinServiceSettings):
1515
CHATBOT_HOST: str
1616
CHATBOT_PORT: PortInt
1717
CHATBOT_MODEL: str = "gpt-4o-mini"
18+
CHATBOT_COLLECTION_NAME: str = "sim4life_webplatform"
1819

1920
@cached_property
2021
def base_url(self) -> str:

services/web/server/tests/unit/with_dbs/04/chatbot/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def mocked_chatbot_api(faker: Faker) -> Iterator[respx.MockRouter]:
4848
choices=[ResponseItem(index=0, message=ResponseMessage(content="42"))],
4949
)
5050
]
51-
5251
with respx.mock(base_url=_BASE_URL) as mock:
5352
# Create a side_effect that returns responses in sequence
5453
mock.post(path="/v1/chat/completions").mock(

services/web/server/tests/unit/with_dbs/04/chatbot/test_chatbot_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# pylint: disable=too-many-statements
66

77

8+
import json
9+
810
import respx
911
from aiohttp.test_utils import TestClient
1012
from faker import Faker
@@ -37,3 +39,7 @@ async def test_chatbot_client(
3739
output = await chatbot_client.send(messages=[user_msg, developer_msg])
3840
assert isinstance(output, ResponseMessage)
3941
assert output.content == "42"
42+
request_json = json.loads(mocked_chatbot_api.calls[0].request.content.decode())
43+
metadata = request_json.get("metadata")
44+
assert metadata
45+
assert metadata.get("collection_name") == "sim4life_webplatform"

0 commit comments

Comments
 (0)