mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-11 08:17:03 +00:00
better error message when calling /api/generate or /api/chat with embedding models
This commit is contained in:
@@ -192,7 +192,7 @@ func GenerateHandler(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if model.IsEmbedding() {
|
if model.IsEmbedding() {
|
||||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": "model does not support generate"})
|
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": "embedding models do not support generate"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,7 +1149,7 @@ func ChatHandler(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if model.IsEmbedding() {
|
if model.IsEmbedding() {
|
||||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": "model does not support chat"})
|
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": "embedding models do not support chat"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user