public.go 638 B

1234567891011121314151617181920212223242526
  1. package public
  2. import (
  3. "github.com/eryajf/chatgpt-dingtalk/config"
  4. "github.com/eryajf/chatgpt-dingtalk/pkg/cache"
  5. "github.com/eryajf/chatgpt-dingtalk/pkg/db"
  6. )
  7. var UserService cache.UserServiceInterface
  8. var Config *config.Configuration
  9. var Prompt *[]config.Prompt
  10. func InitSvc() {
  11. // 加载配置
  12. Config = config.LoadConfig()
  13. // 加载prompt
  14. Prompt = config.LoadPrompt()
  15. // 初始化缓存
  16. UserService = cache.NewUserService()
  17. // 初始化数据库
  18. db.InitDB()
  19. // 暂时不在初始化时获取余额
  20. // if Config.Model == openai.GPT3Dot5Turbo0301 || Config.Model == openai.GPT3Dot5Turbo {
  21. // _, _ = GetBalance()
  22. // }
  23. }