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
2aaf29ac
Commit
2aaf29ac
authored
Nov 10, 2025
by
Eva Ho
Browse files
app/ui: do not send to prevent errors with cloud provider
parent
a42f826a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
app/ui/ui.go
app/ui/ui.go
+27
-4
No files found.
app/ui/ui.go
View file @
2aaf29ac
...
@@ -782,6 +782,25 @@ func (s *Server) chat(w http.ResponseWriter, r *http.Request) error {
...
@@ -782,6 +782,25 @@ func (s *Server) chat(w http.ResponseWriter, r *http.Request) error {
var
thinkValue
any
var
thinkValue
any
if
req
.
Think
!=
nil
{
if
req
.
Think
!=
nil
{
// Validate that the model supports thinking if requested
thinkRequested
:=
false
switch
v
:=
req
.
Think
.
(
type
)
{
case
bool
:
thinkRequested
=
v
case
string
:
thinkRequested
=
v
!=
""
&&
v
!=
"none"
}
if
thinkRequested
&&
!
think
{
errorEvent
:=
responses
.
ErrorEvent
{
EventName
:
"error"
,
Error
:
fmt
.
Sprintf
(
"Model %q does not support thinking/reasoning"
,
req
.
Model
),
Code
:
"model_capability_error"
,
}
json
.
NewEncoder
(
w
)
.
Encode
(
errorEvent
)
flusher
.
Flush
()
return
nil
}
thinkValue
=
req
.
Think
thinkValue
=
req
.
Think
}
else
{
}
else
{
thinkValue
=
think
thinkValue
=
think
...
@@ -866,6 +885,9 @@ func (s *Server) chat(w http.ResponseWriter, r *http.Request) error {
...
@@ -866,6 +885,9 @@ func (s *Server) chat(w http.ResponseWriter, r *http.Request) error {
return
err
return
err
}
}
// Debug: Log what we're sending
s
.
log
()
.
Debug
(
"sending chat request"
,
"model"
,
chatReq
.
Model
,
"think"
,
chatReq
.
Think
,
"num_messages"
,
len
(
chatReq
.
Messages
))
err
=
c
.
Chat
(
ctx
,
chatReq
,
func
(
res
api
.
ChatResponse
)
error
{
err
=
c
.
Chat
(
ctx
,
chatReq
,
func
(
res
api
.
ChatResponse
)
error
{
if
loading
{
if
loading
{
// Remove the loading indicator on first token
// Remove the loading indicator on first token
...
@@ -1794,13 +1816,14 @@ func (s *Server) buildChatRequest(chat *store.Chat, model string, think any, ava
...
@@ -1794,13 +1816,14 @@ func (s *Server) buildChatRequest(chat *store.Chat, model string, think any, ava
var
thinkValue
*
api
.
ThinkValue
var
thinkValue
*
api
.
ThinkValue
if
think
!=
nil
{
if
think
!=
nil
{
// Only set Think if it's actually requesting thinking
if
boolValue
,
ok
:=
think
.
(
bool
);
ok
{
if
boolValue
,
ok
:=
think
.
(
bool
);
ok
{
thinkValue
=
&
api
.
ThinkValue
{
if
boolValue
{
Value
:
boolValue
,
thinkValue
=
&
api
.
ThinkValue
{
Value
:
boolValue
}
}
}
}
else
if
stringValue
,
ok
:=
think
.
(
string
);
ok
{
}
else
if
stringValue
,
ok
:=
think
.
(
string
);
ok
{
th
in
k
Value
=
&
api
.
Th
in
k
Value
{
if
str
in
g
Value
!
=
""
&&
str
in
g
Value
!=
"none"
{
Value
:
stringValue
,
thinkValue
=
&
api
.
ThinkValue
{
Value
:
stringValue
}
}
}
}
}
}
}
...
...
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