-
Notifications
You must be signed in to change notification settings - Fork 60k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into website
- Loading branch information
Showing
65 changed files
with
2,595 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { ApiPath } from "@/app/constant"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { handle as openaiHandler } from "../../openai"; | ||
import { handle as azureHandler } from "../../azure"; | ||
import { handle as googleHandler } from "../../google"; | ||
import { handle as anthropicHandler } from "../../anthropic"; | ||
import { handle as baiduHandler } from "../../baidu"; | ||
import { handle as bytedanceHandler } from "../../bytedance"; | ||
import { handle as alibabaHandler } from "../../alibaba"; | ||
import { handle as moonshotHandler } from "../../moonshot"; | ||
import { handle as stabilityHandler } from "../../stability"; | ||
import { handle as iflytekHandler } from "../../iflytek"; | ||
async function handle( | ||
req: NextRequest, | ||
{ params }: { params: { provider: string; path: string[] } }, | ||
) { | ||
const apiPath = `/api/${params.provider}`; | ||
console.log(`[${params.provider} Route] params `, params); | ||
switch (apiPath) { | ||
case ApiPath.Azure: | ||
return azureHandler(req, { params }); | ||
case ApiPath.Google: | ||
return googleHandler(req, { params }); | ||
case ApiPath.Anthropic: | ||
return anthropicHandler(req, { params }); | ||
case ApiPath.Baidu: | ||
return baiduHandler(req, { params }); | ||
case ApiPath.ByteDance: | ||
return bytedanceHandler(req, { params }); | ||
case ApiPath.Alibaba: | ||
return alibabaHandler(req, { params }); | ||
// case ApiPath.Tencent: using "/api/tencent" | ||
case ApiPath.Moonshot: | ||
return moonshotHandler(req, { params }); | ||
case ApiPath.Stability: | ||
return stabilityHandler(req, { params }); | ||
case ApiPath.Iflytek: | ||
return iflytekHandler(req, { params }); | ||
default: | ||
return openaiHandler(req, { params }); | ||
} | ||
} | ||
|
||
export const GET = handle; | ||
export const POST = handle; | ||
|
||
export const runtime = "edge"; | ||
export const preferredRegion = [ | ||
"arn1", | ||
"bom1", | ||
"cdg1", | ||
"cle1", | ||
"cpt1", | ||
"dub1", | ||
"fra1", | ||
"gru1", | ||
"hnd1", | ||
"iad1", | ||
"icn1", | ||
"kix1", | ||
"lhr1", | ||
"pdx1", | ||
"sfo1", | ||
"sin1", | ||
"syd1", | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
faac0d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nextchat – ./
nextchat-nextchat.vercel.app
nextchat-git-website-nextchat.vercel.app
next-chat-plum-phi.vercel.app
*.pr.nextchat.dev
app.nextchat.dev
vercel.gh.nextchat.dev