Skip to content

Commit 0cbd54e

Browse files
review @pcrespov
1 parent fdad989 commit 0cbd54e

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +0,0 @@
1-
# mypy: disable-error-code=truthy-function
2-
from ._client import ChatbotRestClient, get_chatbot_rest_client
3-
4-
__all__ = [
5-
"get_chatbot_rest_client",
6-
"ChatbotRestClient",
7-
]

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
"""Interface to communicate with Fogbugz API
2-
3-
- Simple client to create cases in Fogbugz
4-
"""
5-
61
import logging
72
from typing import Annotated, Any, Final
8-
from urllib.parse import urljoin
93

104
import httpx
115
from aiohttp import web
@@ -67,7 +61,7 @@ def __init__(self, chatbot_settings: ChatbotSettings) -> None:
6761

6862
async def get_settings(self) -> dict[str, Any]:
6963
"""Fetches chatbot settings"""
70-
url = urljoin(f"{self._chatbot_settings.base_url}", "/v1/chat/settings")
64+
url = httpx.URL(self._chatbot_settings.base_url).join("/v1/chat/settings")
7165

7266
@_chatbot_retry()
7367
async def _request() -> httpx.Response:
@@ -85,7 +79,7 @@ async def _request() -> httpx.Response:
8579

8680
async def ask_question(self, question: str) -> ChatResponse:
8781
"""Asks a question to the chatbot"""
88-
url = urljoin(self._chatbot_settings.base_url, "/v1/chat")
82+
url = httpx.URL(self._chatbot_settings.base_url).join("/v1/chat")
8983

9084
@_chatbot_retry()
9185
async def _request() -> httpx.Response:
@@ -146,3 +140,4 @@ async def cleanup_chatbot_client(app: web.Application) -> None:
146140
def get_chatbot_rest_client(app: web.Application) -> ChatbotRestClient:
147141
app_key: ChatbotRestClient = app[_APPKEY]
148142
return app_key
143+
return app_key
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# mypy: disable-error-code=truthy-function
2+
from ._client import ChatbotRestClient, get_chatbot_rest_client
3+
4+
__all__ = [
5+
"get_chatbot_rest_client",
6+
"ChatbotRestClient",
7+
]

0 commit comments

Comments
 (0)