Skip to content

Commit

Permalink
兼容docker环境变量
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyanming committed Mar 2, 2023
1 parent d3176e0 commit 26ae9fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ $ go run main.go
$ docker run -itd --name chatgpt-web --restart=always \
-e APIKEY=换成你的key \
-e MODEL=gpt-3.5-turbo-0301 \
-e BOT_DESC=你是一个AI助手,我需要你模拟一名温柔贴心的女朋友来回答我的问题. \
-e MAX_TOKENS=512 \
-e TEMPREATURE=0.9 \
-e TOP_P=1 \
Expand Down
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func LoadConfig() *Configuration {
TopP := os.Getenv("TOP_P")
FrequencyPenalty := os.Getenv("FREQ")
PresencePenalty := os.Getenv("PRES")
BotDesc := os.Getenv("BOT_DESC")
if ApiKey != "" {
config.ApiKey = ApiKey
}
Expand All @@ -77,6 +78,11 @@ func LoadConfig() *Configuration {
config.Model = Model
}

if BotDesc != "" {
config.BotDesc = BotDesc
}


if MaxTokens != "" {
max, err := strconv.Atoi(MaxTokens)
if err != nil {
Expand Down

0 comments on commit 26ae9fa

Please sign in to comment.