feat(sdk): typed errors, enums, and KB model config for the CLI
Adds the client-library surface the agent-first CLI builds on: - named server error-code constants + typed *APIError from non-2xx responses, - MessageSearchMode / AgentMode / KBSelectionMode and model type/source enumerators so the CLI validates flags against the server vocabulary, - SetKBModelConfig for binding embedding/chat models to a knowledge base.
This commit is contained in:
+1
-1
@@ -441,7 +441,7 @@ func (c *Client) OpenKnowledgeFile(ctx context.Context, knowledgeID string) (str
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
_ = resp.Body.Close()
|
||||
return "", nil, fmt.Errorf("HTTP error %d: %s", resp.StatusCode, string(body))
|
||||
return "", nil, newAPIError(resp.StatusCode, body)
|
||||
}
|
||||
filename := filenameFromContentDisposition(resp.Header.Get("Content-Disposition"))
|
||||
return filename, resp.Body, nil
|
||||
|
||||
Reference in New Issue
Block a user