返回提交历史
Modified
g4f-go/main.go
+5
-6
XFEstudio/gpt4free
Update main.go
8faee7b2
代码差异
1 个文件
+5
-6
@@ -9,8 +9,8 @@ import (
9
9
)
10
10
11
11
func main() {
12
// Meta commands must work even without an embedded runtime.
13
module := "g4f"
12
module := "g4f"
13
14
14
switch {
15
15
case len(os.Args) == 1:
16
16
printHelp()
@@ -21,11 +21,10 @@ func main() {
21
21
case os.Args[1] == "help" || os.Args[1] == "--help" || os.Args[1] == "-h":
22
22
printHelp()
23
23
os.Exit(0)
24
case os.Args[1] == "install" || os.Args[1] == "uninstall":
25
module := "pip"
24
case os.Args[1] == "install" || os.Args[1] == "uninstall":
25
module = "pip" // Fixed: Assign to the existing variable, don't redeclare
26
26
}
27
27
28
// Make sure the embedded Python runtime is extracted to ~/.g4f/python-embed.
29
28
py, err := ensureRuntime()
30
29
if err != nil {
31
30
fmt.Fprintln(os.Stderr, "g4f-go:", err)
@@ -35,7 +34,7 @@ func main() {
35
34
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
36
35
defer stop()
37
36
38
// Forward all arguments to g4f's own CLI entry point.
37
// Runs: python -m [module] [args...]
39
38
code, err := runPython(ctx, py, append([]string{"-m", module}, os.Args[1:]...))
40
39
if err != nil {
41
40
fmt.Fprintln(os.Stderr, "g4f-go:", err)