|
@@ -1136,18 +1136,6 @@ func ChatHandler(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- // an empty request loads the model
|
|
|
- if len(req.Messages) == 0 {
|
|
|
- resp := api.ChatResponse{
|
|
|
- CreatedAt: time.Now().UTC(),
|
|
|
- Model: req.Model,
|
|
|
- Done: true,
|
|
|
- Message: api.Message{Role: "assistant"},
|
|
|
- }
|
|
|
- c.JSON(http.StatusOK, resp)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
checkpointLoaded := time.Now()
|
|
|
|
|
|
chat, err := model.ChatPrompts(req.Messages)
|
|
@@ -1162,6 +1150,18 @@ func ChatHandler(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // an empty request loads the model
|
|
|
+ if len(prompt) == 0 {
|
|
|
+ resp := api.ChatResponse{
|
|
|
+ CreatedAt: time.Now().UTC(),
|
|
|
+ Model: req.Model,
|
|
|
+ Done: true,
|
|
|
+ Message: api.Message{Role: "assistant"},
|
|
|
+ }
|
|
|
+ c.JSON(http.StatusOK, resp)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
slog.Debug("chat handler", "prompt", prompt)
|
|
|
|
|
|
ch := make(chan any)
|