Skip to content

Commit

Permalink
feat: http basic auth可从env读取 & doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lu.bai committed Mar 6, 2023
1 parent 1d21717 commit 0262ef3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ $ docker run -itd --name chatgpt-web --restart=always \
-e FREQ=0.0 \
-e PRES=0.6 \
-e PROXY=http://host.docker.internal:10809 \
-e AUTH_USER= \
-e AUTH_PASSWORD= \
-p 8080:8080 \
qingshui869413421/chatgpt-web:latest
```
Expand Down Expand Up @@ -124,7 +126,9 @@ $ docker run -itd --name chatgpt-web -v `pwd`/config.json:/app/config.json -p 80
"temperature": 0.9,
"top_p": 1,
"frequency_penalty": 0.0,
"presence_penalty": 0.6
"presence_penalty": 0.6,
"auth_user": "",
"auth_password": ""
}
api_key:openai api_key
Expand All @@ -137,6 +141,8 @@ temperature: GPT热度,0到1,默认0.9。数字越大创造力越强,但
top_p: 使用温度采样的替代方法称为核心采样,其中模型考虑具有top_p概率质量的令牌的结果。因此,0.1 意味着只考虑包含前 10% 概率质量的代币。
frequency_penalty:
presence_penalty:
auth_user": http基本认证用户名(空表示不开启验证)
auth_password": http基本认证密码
````

# 免责声明 Disclaimers
Expand Down
9 changes: 9 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ func LoadConfig() *Configuration {
PresencePenalty := os.Getenv("PRES")
BotDesc := os.Getenv("BOT_DESC")
Proxy := os.Getenv("PROXY")
AuthUser := os.Getenv("AUTH_USER")
AuthPassword := os.Getenv("AUTH_PASSWORD")
if ApiKey != "" {
config.ApiKey = ApiKey
}
Expand Down Expand Up @@ -132,6 +134,13 @@ func LoadConfig() *Configuration {
}
config.PresencePenalty = float32(temp)
}
if AuthUser != "" {
config.AuthUser = AuthUser
}

if AuthPassword != "" {
config.AuthPassword = AuthPassword
}
})
if config.ApiKey == "" {
logger.Danger("config err: api key required")
Expand Down

0 comments on commit 0262ef3

Please sign in to comment.