Write 写入文件
(ctx context.Context, path string, content string)
| 247 | |
| 248 | // Write 写入文件 |
| 249 | func (vfs *VolcengineFS) Write(ctx context.Context, path string, content string) error { |
| 250 | absPath := vfs.absPath(path) |
| 251 | |
| 252 | _, err := vfs.mcpClient.CallTool(ctx, "computer_write_file", map[string]any{ |
| 253 | "session_id": vfs.sessionID, |
| 254 | "path": absPath, |
| 255 | "content": content, |
| 256 | }) |
| 257 | if err != nil { |
| 258 | return fmt.Errorf("write file: %w", err) |
| 259 | } |
| 260 | |
| 261 | return nil |
| 262 | } |
| 263 | |
| 264 | // Temp 生成临时文件路径 |
| 265 | func (vfs *VolcengineFS) Temp(name string) string { |