Skip to content

Commit

Permalink
兼容originalUrl模式
Browse files Browse the repository at this point in the history
  • Loading branch information
easychen committed Apr 16, 2023
1 parent 9aaec99 commit d22d318
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const mdClient = process.env.TENCENT_CLOUD_SID && process.env.TENCENT_CLOUD_SKEY
const controller = new AbortController();

app.all(`*`, async (req, res) => {

if(req.originalUrl) req.url = req.originalUrl;
let url = `https://api.openai.com${req.url}`;
// 从 header 中取得 Authorization': 'Bearer 后的 token
const token = req.headers.authorization?.split(' ')[1];
Expand Down
2 changes: 2 additions & 0 deletions docker/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const mdClient = process.env.TENCENT_CLOUD_SID && process.env.TENCENT_CLOUD_SKEY
const controller = new AbortController();

app.all(`*`, async (req, res) => {

if(req.originalUrl) req.url = req.originalUrl;
let url = `https://api.openai.com${req.url}`;
// 从 header 中取得 Authorization': 'Bearer 后的 token
const token = req.headers.authorization?.split(' ')[1];
Expand Down

0 comments on commit d22d318

Please sign in to comment.