mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
♻️ Refactor Go to err != nil, err == nil (#12385)
This commit is contained in:
parent
473a159ef2
commit
b100721fee
147 changed files with 1661 additions and 1659 deletions
|
|
@ -17,10 +17,11 @@
|
|||
package conf
|
||||
|
||||
import (
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
|
||||
"github.com/sashabaranov/go-openai"
|
||||
)
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ func NewAI() *AI {
|
|||
|
||||
if timeout := os.Getenv("SIYUAN_OPENAI_API_TIMEOUT"); "" != timeout {
|
||||
timeoutInt, err := strconv.Atoi(timeout)
|
||||
if nil == err {
|
||||
if err == nil {
|
||||
openAI.APITimeout = timeoutInt
|
||||
}
|
||||
}
|
||||
|
|
@ -68,21 +69,21 @@ func NewAI() *AI {
|
|||
|
||||
if maxTokens := os.Getenv("SIYUAN_OPENAI_API_MAX_TOKENS"); "" != maxTokens {
|
||||
maxTokensInt, err := strconv.Atoi(maxTokens)
|
||||
if nil == err {
|
||||
if err == nil {
|
||||
openAI.APIMaxTokens = maxTokensInt
|
||||
}
|
||||
}
|
||||
|
||||
if temperature := os.Getenv("SIYUAN_OPENAI_API_TEMPERATURE"); "" != temperature {
|
||||
temperatureFloat, err := strconv.ParseFloat(temperature, 64)
|
||||
if nil == err {
|
||||
if err == nil {
|
||||
openAI.APITemperature = temperatureFloat
|
||||
}
|
||||
}
|
||||
|
||||
if maxContexts := os.Getenv("SIYUAN_OPENAI_API_MAX_CONTEXTS"); "" != maxContexts {
|
||||
maxContextsInt, err := strconv.Atoi(maxContexts)
|
||||
if nil == err {
|
||||
if err == nil {
|
||||
openAI.APIMaxContexts = maxContextsInt
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue