refactor: 更改 OpenAI 请求 Body 数据结构,兼容函数调用请求

This commit is contained in:
RockYang
2023-07-15 18:00:40 +08:00
parent a5ad9648bf
commit cc1b56501d
11 changed files with 335 additions and 214 deletions

View File

@@ -11,6 +11,7 @@ import (
"chatplus/store"
"context"
"embed"
"errors"
"io"
"log"
"os"
@@ -101,9 +102,12 @@ func main() {
}),
// 创建函数
fx.Provide(func() *function.FuncZaoBao {
fx.Provide(func() (*function.FuncZaoBao, error) {
token := os.Getenv("AL_API_TOKEN")
return function.NewZaoBao(token)
if token == "" {
return nil, errors.New("invalid AL api token")
}
return function.NewZaoBao(token), nil
}),
// 创建控制器