diff --git a/applogic/gensokyo.go b/applogic/gensokyo.go index f6149d0..328b3f5 100644 --- a/applogic/gensokyo.go +++ b/applogic/gensokyo.go @@ -141,6 +141,20 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) { return } + // 打印日志信息,包括prompt参数 + fmtf.Printf("收到onebotv11信息: %+v\n", string(body)) + + // 打印消息和其他相关信息 + fmtf.Printf("Received message: %v\n", message.Message) + fmtf.Printf("Full message details: %+v\n", message) + + // 进行array转换 + // 检查并解析消息类型 + if _, ok := message.Message.(string); !ok { + // 如果不是字符串,处理消息以转换为字符串,强制转换 + message.Message = ParseMessageContent(message.Message) + } + var promptstr string // 读取URL参数 "prompt" promptstr = r.URL.Query().Get("prompt") @@ -291,20 +305,6 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) { fmt.Printf("收到 skip_lang_check 参数: %v\n", skipLangCheck) } - // 打印日志信息,包括prompt参数 - fmtf.Printf("收到onebotv11信息: %+v\n", string(body)) - - // 打印消息和其他相关信息 - fmtf.Printf("Received message: %v\n", message.Message) - fmtf.Printf("Full message details: %+v\n", message) - - // 进行array转换 - // 检查并解析消息类型 - if _, ok := message.Message.(string); !ok { - // 如果不是字符串,处理消息以转换为字符串,强制转换 - message.Message = ParseMessageContent(message.Message) - } - // 判断message.Message的类型 switch msg := message.Message.(type) { case string: diff --git a/promptkb/promptkb.go b/promptkb/promptkb.go index 862a602..f8b4c78 100644 --- a/promptkb/promptkb.go +++ b/promptkb/promptkb.go @@ -95,8 +95,8 @@ func GetPromptKeyboardAI(msg string, promptstr string) []string { responseBody = bytes.ReplaceAll(responseBody, []byte{10}, []byte("")) // LF responseBody = bytes.ReplaceAll(responseBody, []byte{13}, []byte("")) // CR - fmtf.Printf("清洗后气泡Response: %v\n", responseBody) - //fmtf.Printf("清洗后气泡Response: %s\n", string(responseBody)) + //fmtf.Printf("清洗后气泡Response: %v\n", responseBody) + fmtf.Printf("清洗后气泡Response: %s\n", string(responseBody)) var responseData ResponseDataPromptKeyboard if err := json.Unmarshal(responseBody, &responseData); err != nil {