mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-13 18:15:34 +00:00
feat(tools): auto-deliver write_file results as channel attachments
Flip write_file deliver param default from false to true so result files (reports, articles, generated content) are automatically sent as document attachments to chat channels without requiring explicit LLM opt-in. Add .md MIME type to mimeFromExt for proper markdown file delivery.
This commit is contained in:
1 parent
66de3504d4
commit
70f3e1f5d5
2 files changed
+7
-2
No files matched your search
@@ -98,6 +98,8 @@ func mimeFromExt(ext string) string {
|
||||
return "application/msword"
|
||||
case ".xls", ".xlsx":
|
||||
return "application/vnd.ms-excel"
|
||||
case ".md":
|
||||
return "text/markdown"
|
||||
default:
|
||||
return "application/octet-stream"
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func (t *WriteFileTool) Parameters() map[string]any {
|
||||
},
|
||||
"deliver": map[string]any{
|
||||
"type": "boolean",
|
||||
"description": "If true, deliver this file to the user as an attachment (image, document, etc.)",
|
||||
"description": "Deliver this file to the user as an attachment. Defaults to true. Set to false for intermediate/temporary files (e.g. config, cache, temp scripts).",
|
||||
},
|
||||
},
|
||||
"required": []string{"path", "content"},
|
||||
@@ -87,7 +87,10 @@ func (t *WriteFileTool) Parameters() map[string]any {
|
||||
func (t *WriteFileTool) Execute(ctx context.Context, args map[string]any) *Result {
|
||||
path, _ := args["path"].(string)
|
||||
content, _ := args["content"].(string)
|
||||
deliver, _ := args["deliver"].(bool)
|
||||
deliver := true
|
||||
if v, ok := args["deliver"].(bool); ok {
|
||||
deliver = v
|
||||
}
|
||||
if path == "" {
|
||||
return ErrorResult("path is required")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user