Fix: replace tenant_llm apis (#16131)

Replace tenant_llm apis with provider-instance apis.
This commit is contained in:
Lynn
2026-06-18 16:38:32 +08:00
committed by GitHub
parent 72db9044e2
commit 47bd9dd049
8 changed files with 244 additions and 379 deletions

View File

@@ -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