mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 23:41:12 +08:00
Fix: replace tenant_llm apis (#16131)
Replace tenant_llm apis with provider-instance apis.
This commit is contained in:
@@ -91,19 +91,6 @@ def get_email():
|
||||
return EMAIL
|
||||
|
||||
|
||||
def get_my_llms(auth, name):
|
||||
# todo deprecated
|
||||
url = HOST_ADDRESS + "/v1/llm/my_llms"
|
||||
authorization = {"Authorization": auth}
|
||||
response = requests.get(url=url, headers=authorization)
|
||||
res = response.json()
|
||||
if res.get("code") != 0:
|
||||
raise Exception(res.get("message"))
|
||||
if name in res.get("data"):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_added_models(auth, factory_name):
|
||||
url = HOST_ADDRESS + "/api/v1/models"
|
||||
authorization = {"Authorization": auth}
|
||||
@@ -116,21 +103,6 @@ def get_added_models(auth, factory_name):
|
||||
return True
|
||||
return False
|
||||
|
||||
def add_models(auth):
|
||||
# todo deprecated
|
||||
url = HOST_ADDRESS + "/v1/llm/set_api_key"
|
||||
authorization = {"Authorization": auth}
|
||||
models_info = {
|
||||
"ZHIPU-AI": {"llm_factory": "ZHIPU-AI", "api_key": ZHIPU_AI_API_KEY},
|
||||
}
|
||||
|
||||
for name, model_info in models_info.items():
|
||||
if not get_my_llms(auth, name):
|
||||
response = requests.post(url=url, headers=authorization, json=model_info)
|
||||
res = response.json()
|
||||
if res.get("code") != 0:
|
||||
pytest.exit(f"Critical error in add_models: {res.get('message')}")
|
||||
|
||||
|
||||
def add_model_instance(auth):
|
||||
add_provider_api = HOST_ADDRESS + "/api/v1/providers"
|
||||
@@ -156,17 +128,6 @@ def add_model_instance(auth):
|
||||
pytest.exit("Critical error in check added model: add model failed")
|
||||
|
||||
|
||||
def get_tenant_info(auth):
|
||||
# todo deprecated
|
||||
url = HOST_ADDRESS + "/api/v1/users/me/models"
|
||||
authorization = {"Authorization": auth}
|
||||
response = requests.get(url=url, headers=authorization)
|
||||
res = response.json()
|
||||
if res.get("code") != 0:
|
||||
raise Exception(res.get("message"))
|
||||
return res["data"].get("tenant_id")
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def set_tenant_info(get_auth):
|
||||
auth = get_auth
|
||||
|
||||
Reference in New Issue
Block a user