mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: update API endpoint paths to include admin prefix
This commit is contained in:
parent
f9a8b9c270
commit
8c0361bbc2
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue