Execute 执行代码
(ctx context.Context, lang Language, code string, input map[string]any)
| 611 | |
| 612 | // Execute 执行代码 |
| 613 | func (m *RuntimeManager) Execute(ctx context.Context, lang Language, code string, input map[string]any) (*ExecutionResult, error) { |
| 614 | runtime, exists := m.runtimes[lang] |
| 615 | if !exists { |
| 616 | return nil, fmt.Errorf("unsupported language: %s", lang) |
| 617 | } |
| 618 | |
| 619 | if !runtime.IsAvailable() { |
| 620 | return nil, fmt.Errorf("runtime not available: %s", lang) |
| 621 | } |
| 622 | |
| 623 | return runtime.Execute(ctx, code, input) |
| 624 | } |
| 625 | |
| 626 | // AvailableLanguages 返回可用的语言列表 |
| 627 | func (m *RuntimeManager) AvailableLanguages() []Language { |