mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 06:58:59 +08:00
fix: Replace path.join with urljoin. (#2631)
This commit is contained in:
parent
8495ffaa45
commit
b6d61a818e
@ -1,6 +1,6 @@
|
|||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
from os.path import join
|
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from httpx import Timeout
|
from httpx import Timeout
|
||||||
from openai import (
|
from openai import (
|
||||||
@ -313,10 +313,13 @@ class LocalAILarguageModel(LargeLanguageModel):
|
|||||||
:param credentials: credentials dict
|
:param credentials: credentials dict
|
||||||
:return: client kwargs
|
:return: client kwargs
|
||||||
"""
|
"""
|
||||||
|
if not credentials['server_url'].endswith('/'):
|
||||||
|
credentials['server_url'] += '/'
|
||||||
|
|
||||||
client_kwargs = {
|
client_kwargs = {
|
||||||
"timeout": Timeout(315.0, read=300.0, write=10.0, connect=5.0),
|
"timeout": Timeout(315.0, read=300.0, write=10.0, connect=5.0),
|
||||||
"api_key": "1",
|
"api_key": "1",
|
||||||
"base_url": join(credentials['server_url'], 'v1'),
|
"base_url": urljoin(credentials['server_url'], 'v1'),
|
||||||
}
|
}
|
||||||
|
|
||||||
return client_kwargs
|
return client_kwargs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user