Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
287ba115
Commit
287ba115
authored
Feb 20, 2024
by
Jeffrey Morgan
Browse files
better error message when calling `/api/generate` or `/api/chat` with embedding models
parent
63861f58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
server/routes.go
server/routes.go
+2
-2
No files found.
server/routes.go
View file @
287ba115
...
@@ -192,7 +192,7 @@ func GenerateHandler(c *gin.Context) {
...
@@ -192,7 +192,7 @@ func GenerateHandler(c *gin.Context) {
}
}
if
model
.
IsEmbedding
()
{
if
model
.
IsEmbedding
()
{
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"model do
es
not support generate"
})
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"
embedding
model
s
do not support generate"
})
return
return
}
}
...
@@ -1149,7 +1149,7 @@ func ChatHandler(c *gin.Context) {
...
@@ -1149,7 +1149,7 @@ func ChatHandler(c *gin.Context) {
}
}
if
model
.
IsEmbedding
()
{
if
model
.
IsEmbedding
()
{
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"model do
es
not support chat"
})
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"
embedding
model
s
do not support chat"
})
return
return
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment