mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-23 06:30:00 +08:00
Fix: api-key issue for xinference. (#6490)
### What problem does this PR solve? #2792 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
384b6549a6
commit
60c3a253ad
@ -208,7 +208,7 @@ class YoudaoRerank(DefaultRerank):
|
|||||||
|
|
||||||
|
|
||||||
class XInferenceRerank(Base):
|
class XInferenceRerank(Base):
|
||||||
def __init__(self, key="xxxxxxx", model_name="", base_url=""):
|
def __init__(self, key="x", model_name="", base_url=""):
|
||||||
if base_url.find("/v1") == -1:
|
if base_url.find("/v1") == -1:
|
||||||
base_url = urljoin(base_url, "/v1/rerank")
|
base_url = urljoin(base_url, "/v1/rerank")
|
||||||
if base_url.find("/rerank") == -1:
|
if base_url.find("/rerank") == -1:
|
||||||
@ -217,9 +217,10 @@ class XInferenceRerank(Base):
|
|||||||
self.base_url = base_url
|
self.base_url = base_url
|
||||||
self.headers = {
|
self.headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"accept": "application/json",
|
"accept": "application/json"
|
||||||
"Authorization": f"Bearer {key}"
|
|
||||||
}
|
}
|
||||||
|
if key and key != "x":
|
||||||
|
self.headers["Authorization"] = f"Bearer {key}"
|
||||||
|
|
||||||
def similarity(self, query: str, texts: list):
|
def similarity(self, query: str, texts: list):
|
||||||
if len(texts) == 0:
|
if len(texts) == 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user