Revert "chat api (#991)" while context variable is fixed

This reverts commit 7a0899d62d.
This commit is contained in:
Jeffrey Morgan
2023-12-04 21:16:27 -08:00
parent f1ef3f9947
commit 00d06619a1
8 changed files with 144 additions and 559 deletions

View File

@@ -221,19 +221,6 @@ func (c *Client) Generate(ctx context.Context, req *GenerateRequest, fn Generate
})
}
type ChatResponseFunc func(ChatResponse) error
func (c *Client) Chat(ctx context.Context, req *ChatRequest, fn ChatResponseFunc) error {
return c.stream(ctx, http.MethodPost, "/api/chat", req, func(bts []byte) error {
var resp ChatResponse
if err := json.Unmarshal(bts, &resp); err != nil {
return err
}
return fn(resp)
})
}
type PullProgressFunc func(ProgressResponse) error
func (c *Client) Pull(ctx context.Context, req *PullRequest, fn PullProgressFunc) error {