Finalize WEB UI V2 loose endsfixes

This commit is contained in:
jmd1010
2025-04-12 17:15:14 -04:00
parent 13e9d22ec6
commit 3d2903cb47
10 changed files with 217 additions and 33 deletions

View File

@@ -34,6 +34,7 @@ type PromptRequest struct {
type ChatRequest struct {
Prompts []PromptRequest `json:"prompts"`
Language string `json:"language"` // Add Language field to bind from request
common.ChatOptions // Embed the ChatOptions from common package
}
@@ -64,7 +65,8 @@ func (h *ChatHandler) HandleChat(c *gin.Context) {
return
}
log.Printf("Received chat request with %d prompts", len(request.Prompts))
// Add log to check received language field
log.Printf("Received chat request - Language: '%s', Prompts: %d", request.Language, len(request.Prompts))
// Set headers for SSE
c.Writer.Header().Set("Content-Type", "text/readystream")
@@ -110,6 +112,7 @@ func (h *ChatHandler) HandleChat(c *gin.Context) {
return
}
// Pass the language received in the initial request to the common.ChatRequest
chatReq := &common.ChatRequest{
Message: &goopenai.ChatCompletionMessage{
Role: "user",
@@ -117,6 +120,7 @@ func (h *ChatHandler) HandleChat(c *gin.Context) {
},
PatternName: p.PatternName,
ContextName: p.ContextName,
Language: request.Language, // Pass the language field
}
opts := &common.ChatOptions{