josStorer / RWKV-Runner

A RWKV management and startup tool, full automation, only 8MB. And provides an interface compatible with the OpenAI API. RWKV is a large language model that is fully open source and available for commercial use.
https://www.rwkv.com
MIT License
5.31k stars 502 forks source link

feat(backend-golang): add debug mode checker #382

Closed HaloWang closed 1 month ago

HaloWang commented 2 months ago

我发现在 macOS debug 模式下,Runner 寻找 backend-python 的路径有错误

我准备在添加完该函数后根据 debug 环境与否判断一下正确的执行路径路径

case "darwin":
    ex, err := os.Executable()
    if err != nil {
        return "", err
    }
    exDir := filepath.Dir(ex) + "/../../../"
    cmd := exec.Command("osascript", "-e", `tell application "Terminal" to do script "`+"cd "+exDir+" && "+strings.Join(args, " ")+`"`)
    err = cmd.Start()
    if err != nil {
        return "", err
    }
    cmd.Wait()
return "", nil