mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-07 12:17:17 +00:00
feat(cliproxy): source model pickers from upstream catalogs
- fetch live provider model definitions through /api/cliproxy/catalog - overlay CCS preset metadata without keeping UI dropdowns as the source of truth - wire /cliproxy and quick setup to the upstream-backed catalog path
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import { Router, Request, Response } from 'express';
|
||||
import { getAllResolvedCatalogs, getCacheAge } from '../../cliproxy/catalog-cache';
|
||||
import { getResolvedCatalogSnapshot } from '../../cliproxy/catalog-cache';
|
||||
|
||||
const router = Router();
|
||||
|
||||
/**
|
||||
* GET /api/cliproxy/catalog - Get merged model catalogs
|
||||
* Returns resolved catalogs (cached + static merged)
|
||||
* Returns resolved catalogs with live -> cache -> static fallback ordering.
|
||||
*/
|
||||
router.get('/', (_req: Request, res: Response): void => {
|
||||
router.get('/', async (_req: Request, res: Response): Promise<void> => {
|
||||
try {
|
||||
const catalogs = getAllResolvedCatalogs();
|
||||
const cacheAge = getCacheAge();
|
||||
const snapshot = await getResolvedCatalogSnapshot();
|
||||
res.json({
|
||||
catalogs,
|
||||
catalogs: snapshot.catalogs,
|
||||
source: snapshot.source,
|
||||
cache: {
|
||||
synced: cacheAge !== null,
|
||||
age: cacheAge,
|
||||
synced: snapshot.source !== 'static' || snapshot.cacheAge !== null,
|
||||
age: snapshot.cacheAge,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user