fix xinference add rerank model bug (#2758)

### What problem does this PR solve?

Fix xinference add rerank model bug,
https://github.com/infiniflow/ragflow/issues/2294#issue-2510788135

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Sky Blue 2024-10-09 19:37:11 +08:00 committed by GitHub
parent 8f815a6c1e
commit 2df15742fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,8 @@
#
import re
import threading
from urllib.parse import urljoin
import requests
from huggingface_hub import snapshot_download
import os
@ -154,8 +156,8 @@ class YoudaoRerank(DefaultRerank):
class XInferenceRerank(Base):
def __init__(self, key="xxxxxxx", model_name="", base_url=""):
if base_url.split("/")[-1] != "v1":
base_url = os.path.join(base_url, "v1")
if base_url.find("/v1") == -1:
base_url = urljoin(base_url, "/v1/rerank")
self.model_name = model_name
self.base_url = base_url
self.headers = {