Better types and naming closer to style.

This commit is contained in:
Vyacheslav Moskalev 2024-08-01 19:43:44 +07:00
parent 49a5483139
commit b0c216584c

View file

@ -187,9 +187,9 @@ func (s *Server) GenerateHandler(c *gin.Context) {
values.Messages = append(msgs, api.Message{Role: "user", Content: req.Prompt}) values.Messages = append(msgs, api.Message{Role: "user", Content: req.Prompt})
} }
var s string
var b bytes.Buffer var b bytes.Buffer
var t bytes.Buffer if err := tmpl.Execute(&b, values); err != nil {
if err := tmpl.Execute(&t, values); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return return
} }
@ -200,11 +200,11 @@ func (s *Server) GenerateHandler(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return return
} }
b.WriteString(prev) s += prev
} }
b.WriteString(t.String()); s += b.String();
prompt = b.String() prompt = s
} }
slog.Debug("generate request", "prompt", prompt, "images", images) slog.Debug("generate request", "prompt", prompt, "images", images)