feat: 灵犀 Studio Web UI 定制版
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import Router from '@koa/router'
|
||||
import type { Context, Next } from 'koa'
|
||||
import { proxy } from './proxy-handler'
|
||||
|
||||
export const proxyRoutes = new Router()
|
||||
|
||||
// Proxy unmatched /api/hermes/* and /v1/* to upstream Hermes API
|
||||
proxyRoutes.all('/api/hermes/{*any}', proxy)
|
||||
proxyRoutes.all('/v1/{*any}', proxy)
|
||||
|
||||
// Also register as middleware so it works reliably with nested .use()
|
||||
export async function proxyMiddleware(ctx: Context, next: Next) {
|
||||
if (ctx.path.startsWith('/api/hermes/') || ctx.path.startsWith('/v1/')) {
|
||||
return proxy(ctx)
|
||||
}
|
||||
await next()
|
||||
}
|
||||
Reference in New Issue
Block a user