From 8c0361bbc2f195ae3f155bcf8d3a604428fc2201 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 1 Jul 2025 18:08:12 +0800 Subject: [PATCH] refactor: update API endpoint paths to include admin prefix --- .../impl/local_model_provider/model/embedding.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/models_provider/impl/local_model_provider/model/embedding.py b/apps/models_provider/impl/local_model_provider/model/embedding.py index 3e296d5b1..94ea652af 100644 --- a/apps/models_provider/impl/local_model_provider/model/embedding.py +++ b/apps/models_provider/impl/local_model_provider/model/embedding.py @@ -30,7 +30,8 @@ class WebLocalEmbedding(MaxKBBaseModel, BaseModel, Embeddings): def embed_query(self, text: str) -> List[float]: 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}/embed_query', + prefix = CONFIG.get_admin_path() + res = requests.post(f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}{prefix}/api/model/{self.model_id}/embed_query', {'text': text}) result = res.json() if result.get('code', 500) == 200: @@ -39,7 +40,8 @@ class WebLocalEmbedding(MaxKBBaseModel, BaseModel, Embeddings): def embed_documents(self, texts: List[str]) -> List[List[float]]: 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}/embed_documents', + prefix = CONFIG.get_admin_path() + res = requests.post(f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}/{prefix}/api/model/{self.model_id}/embed_documents', {'texts': texts}) result = res.json() if result.get('code', 500) == 200: