XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Run python scripts

737b054d
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +15 -0
Modified g4f-go/main.go +15 -0
@@ -17,6 +17,7 @@ func printHelp() {
17 17
18 18 Usage:
19 19 g4f-go <g4f args...> run gpt4free (e.g. g4f-go client "hello")
20 g4f-go script.py [args...] run a .py file with the bundled Python
20 21 g4f-go api --port 8080 start the OpenAI-compatible API server
21 22 g4f-go gui launch the web GUI
22 23 g4f-go status show runtime download/install status
@@ -103,6 +104,20 @@ func runMain() int {
103 104 return 0
104 105 }
105 106
107 // If the first argument is a .py file, run it directly with the bundled
108 // Python interpreter (forwarding any remaining args to the script).
109 if strings.HasSuffix(args[0], ".py") {
110 if _, serr := os.Stat(args[0]); serr != nil {
111 fmt.Fprintln(os.Stderr, "g4f-go:", serr)
112 return 1
113 }
114 code, err := runPython(ctx, py, args)
115 if err != nil {
116 fmt.Fprintln(os.Stderr, "g4f-go:", err)
117 }
118 return code
119 }
120
106 121 exe, err := pythonExecutable(binDir)
107 122 if err != nil {
108 123 fmt.Fprintln(os.Stderr, "g4f-go:", err)