Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
更新 reverse_proxy (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuweiyou authored Mar 11, 2023
1 parent c61f2aa commit e8ea76c
Show file tree
Hide file tree
Showing 8 changed files with 2,202 additions and 2,188 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true

[*.yml]
indent_style = space
4 changes: 2 additions & 2 deletions catch_error.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function catch_error(err, req, res, next) {
console.error(err)
res.json({ message: err.message })
console.error(err)
res.json({ message: err.message })
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
chatgpt-api:
image: zhuweiyou/chatgpt-api:7
image: zhuweiyou/chatgpt-api:8
restart: always
ports:
- 3000:3000
34 changes: 17 additions & 17 deletions get_access_token.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import axios from 'axios'

export async function get_access_token(req, res) {
const { email, password } = req.body
if (!email || !password) {
throw new Error('invalid [email] or [password]')
}
// 如果需要自建auth服务, 请fork: https://github.com/zhuweiyou/chatgpt-auth
const { data } = await axios({
method: 'POST',
url: 'https://chatgpt-auth.vercel.app/',
headers: {
'X-Email': email,
'X-Password': password,
},
})
if (!data) {
throw new Error('failed to get [access_token]')
}
res.json({ access_token: data })
const { email, password } = req.body
if (!email || !password) {
throw new Error('invalid [email] or [password]')
}
// 如果需要自建auth服务, 请fork: https://github.com/zhuweiyou/chatgpt-auth
const { data } = await axios({
method: 'POST',
url: 'https://chatgpt-auth.vercel.app/',
headers: {
'X-Email': email,
'X-Password': password,
},
})
if (!data) {
throw new Error('failed to get [access_token]')
}
res.json({ access_token: data })
}
Loading

0 comments on commit e8ea76c

Please sign in to comment.