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:
nullkey
2026-06-26 20:40:59 +08:00
committed by lyingbug
parent eba9fe7e78
commit 8f36ea2229
9 changed files with 203 additions and 8 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ func (c *Client) AgentQAStreamWithRequest(ctx context.Context,
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("HTTP error %d: %s", resp.StatusCode, string(body))
return newAPIError(resp.StatusCode, body)
}
// Process SSE stream