瀏覽代碼

add model types to factories API (#2341)

### What problem does this PR solve?

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
tags/v0.11.0
Kevin Hu 1 年之前
父節點
當前提交
f60dfffb4b
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 12 行新增1 行删除
  1. 12
    1
      api/apps/llm_app.py

+ 12
- 1
api/apps/llm_app.py 查看文件

def factories(): def factories():
try: try:
fac = LLMFactoriesService.get_all() fac = LLMFactoriesService.get_all()
return get_json_result(data=[f.to_dict() for f in fac if f.name not in ["Youdao", "FastEmbed", "BAAI"]])
fac = [f.to_dict() for f in fac if f.name not in ["Youdao", "FastEmbed", "BAAI"]]
llms = LLMService.get_all()
mdl_types = {}
for m in llms:
if m.status != StatusEnum.VALID.value:
continue
if m.fid not in mdl_types:
mdl_types[m.fid] = set([])
mdl_types[m.fid].add(m.model_type)
for f in fac:
f["model_types"] = list(mdl_types.get(f["name"], []))
return get_json_result(data=fac)
except Exception as e: except Exception as e:
return server_error_response(e) return server_error_response(e)



Loading…
取消
儲存