mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 12:25:52 +08:00
fix LocalAI add bug (#1851)
### What problem does this PR solve? #1848 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
This commit is contained in:
parent
7bc9742674
commit
60428c4ad2
@ -102,7 +102,7 @@ class XinferenceChat(Base):
|
|||||||
if not base_url:
|
if not base_url:
|
||||||
raise ValueError("Local llm url cannot be None")
|
raise ValueError("Local llm url cannot be None")
|
||||||
if base_url.split("/")[-1] != "v1":
|
if base_url.split("/")[-1] != "v1":
|
||||||
self.base_url = os.path.join(base_url, "v1")
|
base_url = os.path.join(base_url, "v1")
|
||||||
key = "xxx"
|
key = "xxx"
|
||||||
super().__init__(key, model_name, base_url)
|
super().__init__(key, model_name, base_url)
|
||||||
|
|
||||||
@ -373,8 +373,8 @@ class LocalAIChat(Base):
|
|||||||
if not base_url:
|
if not base_url:
|
||||||
raise ValueError("Local llm url cannot be None")
|
raise ValueError("Local llm url cannot be None")
|
||||||
if base_url.split("/")[-1] != "v1":
|
if base_url.split("/")[-1] != "v1":
|
||||||
self.base_url = os.path.join(base_url, "v1")
|
base_url = os.path.join(base_url, "v1")
|
||||||
self.client = OpenAI(api_key="empty", base_url=self.base_url)
|
self.client = OpenAI(api_key="empty", base_url=base_url)
|
||||||
self.model_name = model_name.split("___")[0]
|
self.model_name = model_name.split("___")[0]
|
||||||
|
|
||||||
|
|
||||||
|
@ -510,8 +510,8 @@ class LmStudioEmbed(LocalAIEmbed):
|
|||||||
if not base_url:
|
if not base_url:
|
||||||
raise ValueError("Local llm url cannot be None")
|
raise ValueError("Local llm url cannot be None")
|
||||||
if base_url.split("/")[-1] != "v1":
|
if base_url.split("/")[-1] != "v1":
|
||||||
self.base_url = os.path.join(base_url, "v1")
|
base_url = os.path.join(base_url, "v1")
|
||||||
self.client = OpenAI(api_key="lm-studio", base_url=self.base_url)
|
self.client = OpenAI(api_key="lm-studio", base_url=base_url)
|
||||||
self.model_name = model_name
|
self.model_name = model_name
|
||||||
|
|
||||||
|
|
||||||
@ -520,6 +520,6 @@ class OpenAI_APIEmbed(OpenAIEmbed):
|
|||||||
if not base_url:
|
if not base_url:
|
||||||
raise ValueError("url cannot be None")
|
raise ValueError("url cannot be None")
|
||||||
if base_url.split("/")[-1] != "v1":
|
if base_url.split("/")[-1] != "v1":
|
||||||
self.base_url = os.path.join(base_url, "v1")
|
base_url = os.path.join(base_url, "v1")
|
||||||
self.client = OpenAI(api_key=key, base_url=base_url)
|
self.client = OpenAI(api_key=key, base_url=base_url)
|
||||||
self.model_name = model_name.split("___")[0]
|
self.model_name = model_name.split("___")[0]
|
Loading…
x
Reference in New Issue
Block a user