refactor: replace jobs proxy with local controller and optimize model loading (#174)
* refactor: replace jobs proxy with local controller and optimize model loading - Add local jobs controller that directly fetches upstream gateway with profile support and 30s timeout, replacing unreliable proxy catch-all - Upstream errors (non-200) return 502 instead of leaking to frontend - Switch loadModels() from fetchAvailableModels (slow, fetches all provider APIs) to fetchConfigModels (reads config.yaml only) - Hide logo dance video in sidebar Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve TypeScript errors from previous refactor - Remove unused imports (danceVideo, useTheme) in AppSidebar - Map ConfigModelsResponse.groups to AvailableModelGroup[] format Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import Router from '@koa/router'
|
||||
import * as ctrl from '../../controllers/hermes/jobs'
|
||||
|
||||
export const jobRoutes = new Router()
|
||||
|
||||
jobRoutes.get('/api/hermes/jobs', ctrl.list)
|
||||
jobRoutes.get('/api/hermes/jobs/:id', ctrl.get)
|
||||
jobRoutes.post('/api/hermes/jobs', ctrl.create)
|
||||
jobRoutes.patch('/api/hermes/jobs/:id', ctrl.update)
|
||||
jobRoutes.delete('/api/hermes/jobs/:id', ctrl.remove)
|
||||
jobRoutes.post('/api/hermes/jobs/:id/pause', ctrl.pause)
|
||||
jobRoutes.post('/api/hermes/jobs/:id/resume', ctrl.resume)
|
||||
jobRoutes.post('/api/hermes/jobs/:id/run', ctrl.run)
|
||||
@@ -22,6 +22,7 @@ import { gatewayRoutes } from './hermes/gateways'
|
||||
import { weixinRoutes } from './hermes/weixin'
|
||||
import { fileRoutes } from './hermes/files'
|
||||
import { downloadRoutes } from './hermes/download'
|
||||
import { jobRoutes } from './hermes/jobs'
|
||||
import { proxyRoutes, proxyMiddleware } from './hermes/proxy'
|
||||
|
||||
/**
|
||||
@@ -56,6 +57,7 @@ export function registerRoutes(app: any, requireAuth: (ctx: Context, next: Next)
|
||||
app.use(weixinRoutes.routes())
|
||||
app.use(fileRoutes.routes()) // Must be before proxy (proxy catch-all matches everything)
|
||||
app.use(downloadRoutes.routes()) // Must be before proxy
|
||||
app.use(jobRoutes.routes()) // Must be before proxy
|
||||
app.use(proxyRoutes.routes())
|
||||
|
||||
// Proxy catch-all middleware (must be last)
|
||||
|
||||
Reference in New Issue
Block a user