refactor(admin-web): 模型目录面板改走既有 API 层(adminGetLlmCatalog)
- 新增 lib/api/admin.ts 的 adminGetLlmCatalog({refresh}) + 目录响应类型(lib/types/admin.ts),并由 lib/api.ts 再导出
- LlmCatalogPanel 不再直连 lib/api/core(它曾是全仓唯一这样做的 admin 模块),行为不变:
五种状态判定、gzip 响应、离线粘贴导入均保持
- 复核:grep lib/api/core 全仓前端 0 命中;npx tsc --noEmit 0 错;npm run build 成功
This commit is contained in:
1 parent
fa33c79e11
commit
3972ea4007
4 files changed
+51
-6
No files matched your search
@@ -2,6 +2,7 @@ import type {
|
||||
AdminAutomationRecord,
|
||||
AdminChannelRecord,
|
||||
AdminIoTDevice,
|
||||
AdminLlmCatalog,
|
||||
AdminLlmConfig,
|
||||
AdminLlmProvider,
|
||||
AdminPluginRecord,
|
||||
@@ -90,6 +91,14 @@ export function adminListUsers(): Promise<AdminUserRecord[]> {
|
||||
export function adminGetLlm(): Promise<AdminLlmConfig> {
|
||||
return request<AdminLlmConfig>("/admin/llm");
|
||||
}
|
||||
/** GET /api/v1/admin/llm/catalog — models.dev 候选目录(RBAC owner|admin),面板
|
||||
* 「从模型目录自动化填入」的数据来源。服务端优先用本地快照,opts.refresh 时带
|
||||
* `?refresh=1` 强制在线刷新;无快照又抓不到时后端回 503 catalog_unavailable,
|
||||
* 调用方据此提示改用「粘贴导入」,而不是当空目录渲染。 */
|
||||
export function adminGetLlmCatalog(opts: { refresh?: boolean } = {}): Promise<AdminLlmCatalog> {
|
||||
const qs = opts.refresh ? "?refresh=1" : "";
|
||||
return request<AdminLlmCatalog>(`/admin/llm/catalog${qs}`);
|
||||
}
|
||||
/** GET /api/v1/admin/automations */
|
||||
export function adminListAutomations(): Promise<AdminAutomationRecord[]> {
|
||||
return request<AdminAutomationRecord[]>("/admin/automations");
|
||||
|
||||
Reference in new issue
Block a user