mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-12-26 01:35:58 +08:00
Compare commits
2 Commits
v0.5.10-al
...
v0.5.11-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7fcb319da | ||
|
|
67c64e71c8 |
@@ -36,7 +36,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if os.Getenv("SESSION_SECRET") != "" {
|
if os.Getenv("SESSION_SECRET") != "" {
|
||||||
SessionSecret = os.Getenv("SESSION_SECRET")
|
if os.Getenv("SESSION_SECRET") == "random_string" {
|
||||||
|
SysError("SESSION_SECRET is set to an example value, please change it to a random string.")
|
||||||
|
} else {
|
||||||
|
SessionSecret = os.Getenv("SESSION_SECRET")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if os.Getenv("SQLITE_PATH") != "" {
|
if os.Getenv("SQLITE_PATH") != "" {
|
||||||
SQLitePath = os.Getenv("SQLITE_PATH")
|
SQLitePath = os.Getenv("SQLITE_PATH")
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errorWrapper(err, "bind_request_body_failed", http.StatusBadRequest)
|
return errorWrapper(err, "bind_request_body_failed", http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
if textRequest.MaxTokens < 0 || textRequest.MaxTokens > math.MaxInt32/2 {
|
||||||
|
return errorWrapper(errors.New("max_tokens is invalid"), "invalid_max_tokens", http.StatusBadRequest)
|
||||||
|
}
|
||||||
if relayMode == RelayModeModerations && textRequest.Model == "" {
|
if relayMode == RelayModeModerations && textRequest.Model == "" {
|
||||||
textRequest.Model = "text-moderation-latest"
|
textRequest.Model = "text-moderation-latest"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user