Skip to content

Commit

Permalink
feat: 增加WS_ENDPOINT
Browse files Browse the repository at this point in the history
  • Loading branch information
weaigc committed Sep 9, 2023
1 parent ae60767 commit 98e9dc7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/api/sydney.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const config = {
},
}

const { WS_ENDPOINT = 'sydney.bing.com' } = process.env

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const conversationContext = req.body
const headers = createHeaders(req.cookies)
Expand All @@ -19,7 +21,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
debug(id, conversationContext, headers)
res.setHeader('Content-Type', 'text/stream; charset=UTF-8')

const ws = new WebSocket('wss://sydney.bing.com/sydney/ChatHub', {
const ws = new WebSocket(`wss://${WS_ENDPOINT}/sydney/ChatHub`, {
headers: {
...headers,
'accept-language': 'zh-CN,zh;q=0.9',
Expand Down

0 comments on commit 98e9dc7

Please sign in to comment.