aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/ollama/ollama.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/web/ollama/ollama.go b/web/ollama/ollama.go
index 130dc34..c679ec3 100644
--- a/web/ollama/ollama.go
+++ b/web/ollama/ollama.go
@@ -30,12 +30,13 @@ type Message struct {
}
type CompleteRequest struct {
- Model string `json:"model"`
- Messages []Message `json:"messages"`
- Format *string `json:"format,omitempty"`
- Template *string `json:"template,omitempty"`
- Stream bool `json:"stream"`
- Options map[string]any `json:"options"`
+ Model string `json:"model"`
+ Messages []Message `json:"messages"`
+ Format *string `json:"format,omitempty"`
+ Template *string `json:"template,omitempty"`
+ Stream bool `json:"stream"`
+ Options map[string]any `json:"options"`
+ KeepAlive string `json:"keep_alive"`
}
type CompleteResponse struct {
@@ -52,6 +53,8 @@ type CompleteResponse struct {
}
func (c *Client) Chat(ctx context.Context, inp *CompleteRequest) (*CompleteResponse, error) {
+ inp.KeepAlive = "-1"
+
buf := &bytes.Buffer{}
if err := json.NewEncoder(buf).Encode(inp); err != nil {
return nil, fmt.Errorf("ollama: error encoding request: %w", err)