fix: reranker prefix (#3605)

This commit is contained in:
shaohuzhang1 2025-07-15 16:00:22 +08:00 committed by GitHub
parent 8e5ff3b1f4
commit a67b39c87e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,9 +52,10 @@ class WebLocalBaseReranker(MaxKBBaseModel, BaseDocumentCompressor):
Sequence[Document]:
if documents is None or len(documents) == 0:
return []
prefix = CONFIG.get_admin_path()
bind = f'{CONFIG.get("LOCAL_MODEL_HOST")}:{CONFIG.get("LOCAL_MODEL_PORT")}'
res = requests.post(
f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}/api/model/{self.model_id}/compress_documents',
f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}{prefix}/api/model/{self.model_id}/compress_documents',
json={'documents': [{'page_content': document.page_content, 'metadata': document.metadata} for document in
documents], 'query': query}, headers={'Content-Type': 'application/json'})
result = res.json()