mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +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
|
|
@ -50,7 +50,7 @@ func ChatGPT(msg string, contextMsgs []string, c *openai.Client, model string, m
|
|||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
|
||||
defer cancel()
|
||||
resp, err := c.CreateChatCompletion(ctx, req)
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
PushErrMsg("Requesting failed, please check kernel log for more details", 3000)
|
||||
logging.LogErrorf("create chat completion failed: %s", err)
|
||||
stop = true
|
||||
|
|
@ -86,7 +86,7 @@ func NewOpenAIClient(apiKey, apiProxy, apiBaseURL, apiUserAgent, apiVersion, api
|
|||
transport := &http.Transport{}
|
||||
if "" != apiProxy {
|
||||
proxyUrl, err := url.Parse(apiProxy)
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
logging.LogErrorf("OpenAI API proxy failed: %v", err)
|
||||
} else {
|
||||
transport.Proxy = http.ProxyURL(proxyUrl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue