add image support to the chat api (#1490)

This commit is contained in:
Patrick Devine
2023-12-12 13:28:58 -08:00
committed by GitHub
parent 4251b342de
commit d9e60f634b
3 changed files with 14 additions and 10 deletions

View File

@@ -994,7 +994,7 @@ func ChatHandler(c *gin.Context) {
checkpointLoaded := time.Now()
prompt, err := model.ChatPrompt(req.Messages)
prompt, images, err := model.ChatPrompt(req.Messages)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
@@ -1037,6 +1037,7 @@ func ChatHandler(c *gin.Context) {
Format: req.Format,
CheckpointStart: checkpointStart,
CheckpointLoaded: checkpointLoaded,
Images: images,
}
if err := loaded.runner.Predict(c.Request.Context(), predictReq, fn); err != nil {
ch <- gin.H{"error": err.Error()}