feat: add agent management functionality
- Introduced a new package for managing custom agents, including CRUD operations for agent creation, retrieval, updating, and deletion. - Implemented API endpoints for listing agents and retrieving agent placeholders. - Added data structures for agent configuration and requests, enhancing the overall agent management capabilities. - Enhanced the client with methods to interact with the new agent management features, improving user experience in managing agents. These changes significantly expand the application's functionality for handling custom agents, providing users with a comprehensive toolset for agent management.
This commit is contained in:
@@ -154,6 +154,39 @@ func (c *Client) DeleteChunk(ctx context.Context, knowledgeID string, chunkID st
|
||||
return parseResponse(resp, &response)
|
||||
}
|
||||
|
||||
// GetChunkByIDOnly retrieves a chunk by its ID without requiring knowledge ID
|
||||
func (c *Client) GetChunkByIDOnly(ctx context.Context, chunkID string) (*Chunk, error) {
|
||||
path := fmt.Sprintf("/api/v1/chunks/get-by-id/%s", chunkID)
|
||||
resp, err := c.doRequest(ctx, http.MethodGet, path, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var response ChunkResponse
|
||||
if err := parseResponse(resp, &response); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &response.Data, nil
|
||||
}
|
||||
|
||||
// DeleteGeneratedQuestion deletes a generated question from a chunk
|
||||
func (c *Client) DeleteGeneratedQuestion(ctx context.Context, chunkID string, questionID string) error {
|
||||
path := fmt.Sprintf("/api/v1/chunks/%s/delete-question", chunkID)
|
||||
req := map[string]string{"question_id": questionID}
|
||||
resp, err := c.doRequest(ctx, http.MethodDelete, path, req, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var response struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
return parseResponse(resp, &response)
|
||||
}
|
||||
|
||||
// DeleteChunksByKnowledgeID deletes all chunks under a knowledge document
|
||||
// Batch deletes all chunks under the specified knowledge document
|
||||
// Parameters:
|
||||
|
||||
Reference in New Issue
Block a user