mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-27 02:42:00 +08:00
Feat: add skills space to context engine (#13908)
### What problem does this PR solve? issue #13714 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
ce "ragflow/internal/cli/contextengine"
|
||||
ce "ragflow/internal/cli/filesystem"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -1818,6 +1818,36 @@ func (c *RAGFlowClient) AddCustomModel(cmd *Command) (ResponseIf, error) {
|
||||
|
||||
// Context related commands
|
||||
|
||||
// CECat handles the cat command - shows content using Context Engine
|
||||
func (c *RAGFlowClient) CECat(cmd *Command) (ResponseIf, error) {
|
||||
if c.HTTPClient.APIToken == "" && c.HTTPClient.LoginToken == "" {
|
||||
return nil, fmt.Errorf("API token not set. Please login first")
|
||||
}
|
||||
if c.ServerType != "user" {
|
||||
return nil, fmt.Errorf("this command is only allowed in USER mode")
|
||||
}
|
||||
|
||||
path, ok := cmd.Params["path"].(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("fail to convert 'path' to string")
|
||||
}
|
||||
|
||||
// Execute cat command through Filesystem Engine
|
||||
ctx := context.Background()
|
||||
content, err := c.ContextEngine.Cat(ctx, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Convert to response
|
||||
var response ContextCatResponse
|
||||
response.OutputFormat = c.OutputFormat
|
||||
response.Code = 0
|
||||
response.Content = string(content)
|
||||
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
// CEList handles the ls command - lists nodes using Context Engine
|
||||
func (c *RAGFlowClient) CEList(cmd *Command) (ResponseIf, error) {
|
||||
// Get path from command params, default to "datasets"
|
||||
@@ -1838,7 +1868,7 @@ func (c *RAGFlowClient) CEList(cmd *Command) (ResponseIf, error) {
|
||||
opts.Offset = offset
|
||||
}
|
||||
|
||||
// Execute list command through Context Engine
|
||||
// Execute list command through Filesystem Engine
|
||||
ctx := context.Background()
|
||||
result, err := c.ContextEngine.List(ctx, path, opts)
|
||||
if err != nil {
|
||||
@@ -1877,7 +1907,7 @@ func (c *RAGFlowClient) CESearch(cmd *Command) (ResponseIf, error) {
|
||||
opts.Recursive = recursive
|
||||
}
|
||||
|
||||
// Execute search command through Context Engine
|
||||
// Execute search command through Filesystem Engine
|
||||
ctx := context.Background()
|
||||
result, err := c.ContextEngine.Search(ctx, path, opts)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user