go-bot/test/test.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

31 lines
636 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"bufio"
"fmt"
"go-bot/workers"
"os"
"strings"
)
func main() {
for {
reader := bufio.NewReader(os.Stdin)
// cfg := config.GetConfig()
// config.PrintConfig(cfg, "")
fmt.Print("输入指令(不要带/)")
raw_msg, _ := reader.ReadString('\n')
// 去除末尾的换行符
// raw_msg = strings.TrimRight(raw_msg, "\r\n")
if raw_msg == "" {
raw_msg = "ping"
}
parms := strings.Fields(raw_msg)
worker := workers.NewWorker(parms, "11", "111", "111", "222", raw_msg)
fmt.Println("Test:", worker.CheckPermission())
message := worker.GetMsg()
fmt.Println("message:", message)
}
}