File tree Expand file tree Collapse file tree
src/app/api/gateway/proxy Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import type { NextConfig } from "next" ;
22
33const nextConfig : NextConfig = {
4- /* config options here */
4+ async rewrites ( ) {
5+ return [
6+ {
7+ source : '/api/gateway/proxy/:path*' ,
8+ destination : '/api/gateway/proxy?path=:path*' ,
9+ } ,
10+ ]
11+ } ,
512} ;
613
714export default nextConfig ;
Original file line number Diff line number Diff line change @@ -81,12 +81,8 @@ function parseUsageFromSSEChunk(text: string): { inputTokens: number; outputToke
8181 return null
8282}
8383
84- export async function POST (
85- request : NextRequest ,
86- { params } : { params : Promise < { path ?: string [ ] } > } ,
87- ) {
88- const { path } = await params
89- const subPath = path ?. join ( '/' ) ?? 'chat/completions'
84+ export async function POST ( request : NextRequest ) {
85+ const subPath = request . nextUrl . searchParams . get ( 'path' ) || 'chat/completions'
9086
9187 const authHeader = request . headers . get ( 'authorization' )
9288 const token = authHeader ?. startsWith ( 'Bearer ' )
You can’t perform that action at this time.
0 commit comments