main.go 537 B

1234567891011121314151617181920212223
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/langgenius/dify-sandbox/internal/core/runner/python"
  5. "github.com/langgenius/dify-sandbox/internal/core/runner/types"
  6. "github.com/langgenius/dify-sandbox/internal/service"
  7. "github.com/langgenius/dify-sandbox/internal/static"
  8. )
  9. func main() {
  10. static.InitConfig("conf/config.yaml")
  11. python.PreparePythonDependenciesEnv()
  12. resp := service.RunPython3Code(`import json;print(json.dumps({"hello": "world"}))`,
  13. ``,
  14. &types.RunnerOptions{
  15. EnableNetwork: true,
  16. })
  17. fmt.Println(resp.Data)
  18. }