Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
tangwenru committed Aug 3, 2023
1 parent 229c2b1 commit 94c0840
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/tangwenru/go-component-ktv-ai
go 1.18

require (
github.com/beego/beego/v2 v2.1.0 // indirect
github.com/beego/beego/v2 v2.1.1 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
github.com/beego/beego/v2 v2.1.0 h1:Lk0FtQGvDQCx5V5yEu4XwDsIgt+QOlNjt5emUa3/ZmA=
github.com/beego/beego/v2 v2.1.0/go.mod h1:6h36ISpaxNrrpJ27siTpXBG8d/Icjzsc7pU1bWpp0EE=
github.com/beego/beego/v2 v2.1.1 h1:VbvmrbFDg2xkaoawqZ1kSSXlV4/FcsOw6CJQD5qvMzU=
github.com/beego/beego/v2 v2.1.1/go.mod h1:0J0RQVIpepnRUfu6ax+kLVVB1FcdYryHK9lpRl5wvbY=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
8 changes: 4 additions & 4 deletions lib/api-get.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import (
"encoding/json"
"errors"
"fmt"
beego "github.com/beego/beego/v2/adapter"
"github.com/beego/beego/v2/client/httplib"
beego "github.com/beego/beego/v2/server/web"
"strings"
)

func MainSystem(userId int64, apiPath string, data interface{}, result interface{}) ([]byte, error) {
apiUrl := beego.AppConfig.String("KTVAI.APIUrl")
apiUrl, _ := beego.AppConfig.String("KTVAI.APIUrl")
return ApiGet(userId, apiUrl, apiPath, data, result)
}

func SubsystemChatgpt(userId int64, apiPath string, data interface{}, result interface{}) ([]byte, error) {
apiUrl := beego.AppConfig.String("Subsystem.ChatgptAPIUrl")
apiUrl, _ := beego.AppConfig.String("Subsystem.ChatgptAPIUrl")
if len(apiUrl) < 5 {
return nil, errors.New("请配置 app.conf 文件的 Subsystem.ChatgptAPIUrl")
}
return ApiGet(userId, apiUrl, apiPath, data, result)
}

func SubsystemChatgptApi(userId int64, apiPath string, data interface{}, result interface{}) ([]byte, error) {
apiUrl := beego.AppConfig.String("Subsystem.ChatgptApiAPIUrl")
apiUrl, _ := beego.AppConfig.String("Subsystem.ChatgptApiAPIUrl")
if len(apiUrl) < 5 {
return nil, errors.New("请配置 app.conf 文件的 Subsystem.ChatgptApiAPIUrl")
}
Expand Down

0 comments on commit 94c0840

Please sign in to comment.