executeScript 执行前置脚本
(ctx context.Context, scriptPath string)
| 67 | |
| 68 | // executeScript 执行前置脚本 |
| 69 | func (e *Executor) executeScript(ctx context.Context, scriptPath string) error { |
| 70 | result, err := e.sandbox.Exec(ctx, "bash "+scriptPath, nil) |
| 71 | if err != nil { |
| 72 | return err |
| 73 | } |
| 74 | |
| 75 | if result.Code != 0 { |
| 76 | return fmt.Errorf("script failed with code %d: %s", result.Code, result.Stderr) |
| 77 | } |
| 78 | |
| 79 | return nil |
| 80 | } |
| 81 | |
| 82 | // renderPrompt 渲染提示词模板 |
| 83 | func (e *Executor) renderPrompt(template string, args map[string]string) string { |