feat: 扩展弹框配置重构
This commit is contained in:
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -53,6 +54,7 @@ func (h *AIHandler) Generate(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
ctx := r.Context()
|
||||
userID := ctx.Value("userID").(string)
|
||||
log.Printf("[AIHandler] Generate request from userID=%s strategy=%q provider=%q model=%q", userID, body.Strategy, body.Provider, body.Model)
|
||||
|
||||
// Fetch Product Profile Context
|
||||
var productContext string
|
||||
@@ -79,9 +81,11 @@ func (h *AIHandler) Generate(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
replyString, err := h.svc.GenerateReply(ctx, body.TweetContent, productContext, body.Identity, body.Provider, body.Model)
|
||||
if err != nil {
|
||||
log.Printf("[AIHandler] ERROR GenerateReply for userID=%s: %v", userID, err)
|
||||
SendError(w, http.StatusBadGateway, 5002, "Failed to generate AI reply: "+err.Error())
|
||||
return
|
||||
}
|
||||
log.Printf("[AIHandler] GenerateReply success for userID=%s, reply length=%d", userID, len(replyString))
|
||||
|
||||
// Clean up potential markdown wrappers from LLM output
|
||||
cleanReply := strings.TrimSpace(replyString)
|
||||
|
||||
Reference in New Issue
Block a user