Refactor logging levels in transform.ts and adjust JSON body parser configuration in app.ts

This commit is contained in:
Vaayne
2025-09-22 16:32:32 +08:00
parent 634c478e18
commit 2385fba695
3 changed files with 9 additions and 11 deletions
+5 -2
View File
@@ -15,6 +15,11 @@ import { modelsRoutes } from './routes/models'
const logger = loggerService.withContext('ApiServer')
const app = express()
app.use(
express.json({
limit: '50mb'
})
)
// Global middleware
app.use((req, res, next) => {
@@ -111,7 +116,6 @@ app.get('/', (_req, res) => {
// Provider-specific API routes with auth (must be before /v1 to avoid conflicts)
const providerRouter = express.Router({ mergeParams: true })
providerRouter.use(authMiddleware)
providerRouter.use(express.json())
// Mount provider-specific messages route
providerRouter.use('/v1/messages', messagesProviderRoutes)
app.use('/:provider', providerRouter)
@@ -119,7 +123,6 @@ app.use('/:provider', providerRouter)
// API v1 routes with auth
const apiRouter = express.Router()
apiRouter.use(authMiddleware)
apiRouter.use(express.json())
// Mount routes
apiRouter.use('/chat', chatRoutes)
apiRouter.use('/mcps', mcpRoutes)
+1 -1
View File
@@ -7,7 +7,7 @@ const logger = loggerService.withContext('ApiServerUtils')
// Cache configuration
const PROVIDERS_CACHE_KEY = 'api-server:providers'
const PROVIDERS_CACHE_TTL = 5 * 60 * 1000 // 5 minutes
const PROVIDERS_CACHE_TTL = 1 * 60 * 1000 // 1 minutes
export async function getAvailableProviders(): Promise<Provider[]> {
try {