mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-07 01:35:00 +08:00
normalize-policy phase-6: remove extra trimming in memory/sessions tool content paths
This commit is contained in:
@@ -96,7 +96,7 @@ func (t *MemoryGetTool) Execute(ctx context.Context, args map[string]interface{}
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
content := strings.TrimSpace(out.String())
|
content := out.String()
|
||||||
if content == "" {
|
if content == "" {
|
||||||
return fmt.Sprintf("No content in range for %s (from=%d, lines=%d)", rawPath, from, lines), nil
|
return fmt.Sprintf("No content in range for %s (from=%d, lines=%d)", rawPath, from, lines), nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,9 +65,8 @@ func (t *MemoryWriteTool) Parameters() map[string]interface{} {
|
|||||||
|
|
||||||
func (t *MemoryWriteTool) Execute(ctx context.Context, args map[string]interface{}) (string, error) {
|
func (t *MemoryWriteTool) Execute(ctx context.Context, args map[string]interface{}) (string, error) {
|
||||||
content, _ := args["content"].(string)
|
content, _ := args["content"].(string)
|
||||||
content = strings.TrimSpace(content)
|
|
||||||
if content == "" {
|
if content == "" {
|
||||||
return "", fmt.Errorf("content is required")
|
return "error: content is required", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
kind, _ := args["kind"].(string)
|
kind, _ := args["kind"].(string)
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ func (t *SessionsTool) Execute(ctx context.Context, args map[string]interface{})
|
|||||||
var sb strings.Builder
|
var sb strings.Builder
|
||||||
sb.WriteString(fmt.Sprintf("History for %s:\n", key))
|
sb.WriteString(fmt.Sprintf("History for %s:\n", key))
|
||||||
for _, item := range window {
|
for _, item := range window {
|
||||||
content := strings.TrimSpace(item.msg.Content)
|
content := item.msg.Content
|
||||||
if len(content) > 180 {
|
if len(content) > 180 {
|
||||||
content = content[:180] + "..."
|
content = content[:180] + "..."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user