siliconflow / BizyAir

BizyAir: Comfy Nodes that can run in any environment.
https://siliconflow.github.io/BizyAir/
MIT License
290 stars 18 forks source link

Implement Automatic Model List Retrieval for SiliconCloud LLM API Node #135

Closed lcolok closed 4 days ago

lcolok commented 1 month ago

Implement Automatic Model List Retrieval for SiliconCloud LLM API Node

Description

This PR implements the functionality of automatically retrieving the model list for the "☁️BizyAir SiliconCloud LLM API" node. By querying the https://api.siliconflow.cn/v1/models interface, it dynamically updates the model dropdown options, thereby enhancing user experience and allowing users to access real-time information about available models.

Changes

The automatic model list retrieval for the "☁️BizyAir SiliconCloud LLM API" node is implemented through frontend-backend interaction:

Backend:

Frontend:

Frontend-Backend Interaction:

This implementation ensures that users see the most up-to-date model list every time they create a node, without the need for manual updates or application restarts.

Current Limitations

Currently, the API response does not include information about model categories or whether models are free or not. This limits our ability to effectively filter models. As a result, all available models are displayed without categorization.

Future Improvements

SiliconFlow has indicated that model filtering functionality will be supported in the near future. Once this feature becomes available, we can further improve this implementation:


image


为SiliconCloud LLM API节点实现自动获取模型列表功能

描述

本 PR 为"☁️BizyAir SiliconCloud LLM API"节点实现了自动获取模型列表的功能。通过查询 https://api.siliconflow.cn/v1/models 接口,动态更新模型下拉选项,从而提升了用户体验,使用户能够实时了解可用的模型。

变更

为"☁️BizyAir SiliconCloud LLM API"节点实现了自动获取模型列表的功能,主要通过前后端的联动实现:

后端:

前端:

前后端联动:

这种实现确保了每次创建节点时,用户都能看到最新的模型列表,无需手动更新或重启应用。

当前局限性

目前,API 返回的信息不包含模型分类或是否免费等信息,这限制了我们有效筛选模型的能力。因此,所有可用模型都会被显示,没有进行分类。

未来改进

SiliconFlow 表示近期将支持模型筛选功能。一旦这个功能可用,我们可以进一步改进此实现:

doombeaker commented 1 week ago

非常感谢你的工作,做了我们一直想做但是没做的事情。

有个小小的建议,现在 model list 已经可以通过加 type 参数过滤出语言模型了,可否同步更新上:

import requests

url = "https://api.siliconflow.cn/v1/models"

querystring = {"type":"text"}

headers = {"Authorization": "Bearer xxxx"}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)