AddChatContext adds context-file and skill parts to an active chat.
(ctx context.Context, req AddChatContextRequest)
| 997 | |
| 998 | // AddChatContext adds context-file and skill parts to an active chat. |
| 999 | func (c *Client) AddChatContext(ctx context.Context, req AddChatContextRequest) (AddChatContextResponse, error) { |
| 1000 | res, err := c.SDK.Request(ctx, http.MethodPost, "/api/v2/workspaceagents/me/experimental/chat-context", req) |
| 1001 | if err != nil { |
| 1002 | return AddChatContextResponse{}, xerrors.Errorf("execute request: %w", err) |
| 1003 | } |
| 1004 | defer res.Body.Close() |
| 1005 | |
| 1006 | if res.StatusCode != http.StatusOK { |
| 1007 | return AddChatContextResponse{}, codersdk.ReadBodyAsError(res) |
| 1008 | } |
| 1009 | |
| 1010 | var resp AddChatContextResponse |
| 1011 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 1012 | } |
| 1013 | |
| 1014 | // ClearChatContext soft-deletes context-file and skill messages from an active chat. |
| 1015 | func (c *Client) ClearChatContext(ctx context.Context, req ClearChatContextRequest) (ClearChatContextResponse, error) { |