Skip to content

Commit 8c0361b

Browse files
committed
refactor: update API endpoint paths to include admin prefix
1 parent f9a8b9c commit 8c0361b

File tree

1 file changed

+4
-2
lines changed
  • apps/models_provider/impl/local_model_provider/model

1 file changed

+4
-2
lines changed

apps/models_provider/impl/local_model_provider/model/embedding.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def __init__(self, **kwargs):
3030

3131
def embed_query(self, text: str) -> List[float]:
3232
bind = f'{CONFIG.get("LOCAL_MODEL_HOST")}:{CONFIG.get("LOCAL_MODEL_PORT")}'
33-
res = requests.post(f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}/api/model/{self.model_id}/embed_query',
33+
prefix = CONFIG.get_admin_path()
34+
res = requests.post(f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}{prefix}/api/model/{self.model_id}/embed_query',
3435
{'text': text})
3536
result = res.json()
3637
if result.get('code', 500) == 200:
@@ -39,7 +40,8 @@ def embed_query(self, text: str) -> List[float]:
3940

4041
def embed_documents(self, texts: List[str]) -> List[List[float]]:
4142
bind = f'{CONFIG.get("LOCAL_MODEL_HOST")}:{CONFIG.get("LOCAL_MODEL_PORT")}'
42-
res = requests.post(f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}/api/model/{self.model_id}/embed_documents',
43+
prefix = CONFIG.get_admin_path()
44+
res = requests.post(f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}/{prefix}/api/model/{self.model_id}/embed_documents',
4345
{'texts': texts})
4446
result = res.json()
4547
if result.get('code', 500) == 200:

0 commit comments

Comments
 (0)