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
5687f1a0
Commit
5687f1a0
authored
Nov 30, 2023
by
Jeffrey Morgan
Browse files
fix `unexpected end of response` errors when cancelling in `ollama run`
parent
7eda3d0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
7 deletions
+2
-7
cmd/cmd.go
cmd/cmd.go
+2
-7
No files found.
cmd/cmd.go
View file @
5687f1a0
...
...
@@ -496,12 +496,10 @@ func generate(cmd *cobra.Command, opts generateOptions) error {
sigChan
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
sigChan
,
syscall
.
SIGINT
)
var
abort
bool
go
func
()
{
<-
sigChan
cancel
()
abort
=
true
}()
var
currentLineLength
int
...
...
@@ -548,7 +546,7 @@ func generate(cmd *cobra.Command, opts generateOptions) error {
}
if
err
:=
client
.
Generate
(
cancelCtx
,
&
request
,
fn
);
err
!=
nil
{
if
strings
.
Contains
(
err
.
Error
()
,
"
context
c
anceled
"
)
&&
abort
{
if
errors
.
Is
(
err
,
context
.
C
anceled
)
{
return
nil
}
return
err
...
...
@@ -559,10 +557,7 @@ func generate(cmd *cobra.Command, opts generateOptions) error {
}
if
!
latest
.
Done
{
if
abort
{
return
nil
}
return
errors
.
New
(
"unexpected end of response"
)
return
nil
}
verbose
,
err
:=
cmd
.
Flags
()
.
GetBool
(
"verbose"
)
...
...
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