Skip to content

Commit

Permalink
fix: strip / from base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
ej52 committed Nov 4, 2023
1 parent 848a69b commit eeb85e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/ollama_conversation/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
session: aiohttp.ClientSession,
) -> None:
"""Sample API Client."""
self._base_url = base_url
self._base_url = base_url.rstrip("/")
self._session = session

async def async_get_heartbeat(self) -> any:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/ollama_conversation/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def async_step_user(
errors = {}
try:
client = OllamaApiClient(
base_url=cv.url_no_path(user_input[CONF_BASE_URL]).rstrip("/"),
base_url=cv.url_no_path(user_input[CONF_BASE_URL]),
session=async_create_clientsession(self.hass),
)
await client.async_get_heartbeat()
Expand Down Expand Up @@ -129,7 +129,7 @@ async def async_step_init(

try:
client = OllamaApiClient(
base_url=cv.url_no_path(self.config_entry.data[CONF_BASE_URL]).rstrip("/"),
base_url=cv.url_no_path(self.config_entry.data[CONF_BASE_URL]),
session=async_create_clientsession(self.hass),
)
response = await client.async_get_models()
Expand Down

0 comments on commit eeb85e6

Please sign in to comment.