go-bot/workers/newworker.go
liyp 13483b9643 feat(config): 添加OpenAI API配置并优化打印配置函数
在config.toml中添加了OPENAI_API_KEY、OPENAI_BaseURL和MODEL配置项,以支持OpenAI API的集成。
同时,优化了PrintConfig函数,使其能够递归打印嵌套的配置结构,提高了配置管理的可读性和易用性。
2024-06-30 21:56:34 +08:00

38 lines
832 B
Go

package workers
import "fmt"
func NewWorker(parms []string, uid, gid, role, mid, rawMsg string) Worker {
fmt.Println("NewWorker:", parms)
switch parms[0] {
case "ping":
return &Ping{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
// 在这里添加其他 worker 的 case
case "pkg":
return &Pkg{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
case "hhsh":
return &Hhsh{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
case "ip":
return &Ip{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
case "lsp":
return &Lsp{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
case "ai":
return &AI{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg),
}
default:
return &Emm{
StdAns: NewStdAns(parms, uid, gid, role, mid, rawMsg)}
}
}