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
43606d6d
Commit
43606d6d
authored
Jul 18, 2024
by
Michael Yang
Browse files
fix parsing tool calls
parent
70b1010f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
server/model.go
server/model.go
+2
-1
No files found.
server/model.go
View file @
43606d6d
...
...
@@ -348,7 +348,7 @@ func (m *Model) parseToolCalls(s string) ([]api.ToolCall, bool) {
for
offset
:=
0
;
offset
<
len
(
s
);
{
var
obj
map
[
string
]
any
decoder
:=
json
.
NewDecoder
(
strings
.
NewReader
(
s
[
offset
:
]))
if
err
:=
decoder
.
Decode
(
&
obj
);
errors
.
Is
(
err
,
io
.
EOF
)
{
if
err
:=
decoder
.
Decode
(
&
obj
);
errors
.
Is
(
err
,
io
.
EOF
)
||
errors
.
Is
(
err
,
io
.
ErrUnexpectedEOF
)
{
break
}
else
if
syntax
:=
&
(
json
.
SyntaxError
{});
errors
.
As
(
err
,
&
syntax
)
{
// skip over any syntax errors
...
...
@@ -357,6 +357,7 @@ func (m *Model) parseToolCalls(s string) ([]api.ToolCall, bool) {
// skip over any unmarshalable types
offset
+=
int
(
unmarshalType
.
Offset
)
}
else
if
err
!=
nil
{
slog
.
Error
(
"parseToolCalls"
,
"error"
,
err
)
return
nil
,
false
}
else
{
offset
+=
int
(
decoder
.
InputOffset
())
...
...
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