layout refine (#115)

This commit is contained in:
KevinHuSh
2024-03-08 18:59:53 +08:00
committed by GitHub
parent fa171dfe6c
commit bcb58b7e71
5 changed files with 19 additions and 6 deletions

View File

@ -82,8 +82,19 @@ def set_api_key():
@login_required
def my_llms():
try:
objs = TenantLLMService.get_my_llms(current_user.id)
return get_json_result(data=objs)
res = {}
for o in TenantLLMService.get_my_llms(current_user.id):
if o["llm_factory"] not in res:
res[o["llm_factory"]] = {
"tags": o["tags"],
"llm": []
}
res[o["llm_factory"]]["llm"].append({
"type": o["model_type"],
"name": o["model_name"],
"used_token": o["used_tokens"]
})
return get_json_result(data=res)
except Exception as e:
return server_error_response(e)

View File

@ -49,7 +49,9 @@ class TenantLLMService(CommonService):
LLMFactories.logo,
LLMFactories.tags,
cls.model.model_type,
cls.model.llm_name]
cls.model.llm_name,
cls.model.used_tokens
]
objs = cls.model.select(*fields).join(LLMFactories, on=(cls.model.llm_factory == LLMFactories.name)).where(
cls.model.tenant_id == tenant_id).dicts()