diff --git a/.env b/.env index 99b4a00..3739ba7 100644 --- a/.env +++ b/.env @@ -3,8 +3,8 @@ IS_FIRST_LOAD=True CHAT_MODEL_BASE_URL=https://api.siliconflow.cn CHAT_MODEL_API_KEY=sk-iyhiltycmrfnhrnbljsgqjrinhbztwdplyvuhfihcdlepole CHAT_MODEL_NAME=zai-org/GLM-4.5 - -EMBEDDING_MODEL_BASE_URL=https://api.siliconflow.cn +#使用ai中台的模型 +EMBEDDING_MODEL_BASE_URL=http://10.225.128.2:13206/member1/small-model/bge/encode EMBEDDING_MODEL_API_KEY=sk-iyhiltycmrfnhrnbljsgqjrinhbztwdplyvuhfihcdlepole EMBEDDING_MODEL_NAME=BAAI/bge-m3 diff --git a/service/cus_vanna_srevice.py b/service/cus_vanna_srevice.py index f4dcfe0..f4da618 100644 --- a/service/cus_vanna_srevice.py +++ b/service/cus_vanna_srevice.py @@ -270,21 +270,21 @@ class CustomQdrant_VectorStore(Qdrant_VectorStore): request_body = { "model": self.embedding_model_name, - "input": data, + "sentences": [data], } request_body.update(kwargs) response = requests.post( - url=f"{self.embedding_api_base}/v1/embeddings", + url=f"{self.embedding_api_base}", json=request_body, - headers={"Authorization": f"Bearer {self.embedding_api_key}"}, + headers={"Authorization": f"Bearer {self.embedding_api_key}", 'Content-Type': 'application/json'}, ) if response.status_code != 200: raise RuntimeError( f"Failed to create the embeddings, detail: {_get_error_string(response)}" ) result = response.json() - embeddings = [d["embedding"] for d in result["data"]] + embeddings = result['embeddings'] return embeddings[0] class CustomVanna(CustomQdrant_VectorStore, OpenAICompatibleLLM):