2023-05-03 23:38:54 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
2023-06-14 22:21:17 +08:00
|
|
|
"os"
|
2023-05-30 11:04:11 +08:00
|
|
|
"runtime/debug"
|
|
|
|
"strings"
|
2023-05-03 23:38:54 +08:00
|
|
|
|
2023-05-05 23:23:34 +08:00
|
|
|
backend "rwkv-runner/backend-golang"
|
|
|
|
|
2023-05-03 23:38:54 +08:00
|
|
|
"github.com/wailsapp/wails/v2"
|
|
|
|
"github.com/wailsapp/wails/v2/pkg/options"
|
|
|
|
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
|
|
|
)
|
|
|
|
|
|
|
|
//go:embed all:frontend/dist
|
|
|
|
var assets embed.FS
|
|
|
|
|
2023-05-29 09:39:16 +08:00
|
|
|
//go:embed all:py310/Lib/site-packages/cyac
|
|
|
|
var cyac embed.FS
|
|
|
|
|
|
|
|
//go:embed all:py310/Lib/site-packages/cyac-1.7.dist-info
|
|
|
|
var cyacInfo embed.FS
|
|
|
|
|
|
|
|
//go:embed backend-python
|
|
|
|
var py embed.FS
|
|
|
|
|
2023-05-03 23:38:54 +08:00
|
|
|
func main() {
|
2023-05-30 11:04:11 +08:00
|
|
|
if buildInfo, ok := debug.ReadBuildInfo(); !ok || strings.Contains(buildInfo.String(), "-ldflags") {
|
|
|
|
backend.CopyEmbed(cyac)
|
|
|
|
backend.CopyEmbed(cyacInfo)
|
|
|
|
backend.CopyEmbed(py)
|
2023-06-14 22:21:17 +08:00
|
|
|
os.Mkdir("models", os.ModePerm)
|
2023-05-30 11:04:11 +08:00
|
|
|
}
|
2023-05-29 09:39:16 +08:00
|
|
|
|
2023-05-03 23:38:54 +08:00
|
|
|
// Create an instance of the app structure
|
2023-05-05 23:23:34 +08:00
|
|
|
app := backend.NewApp()
|
2023-05-03 23:38:54 +08:00
|
|
|
|
|
|
|
// Create application with options
|
|
|
|
err := wails.Run(&options.App{
|
2023-05-04 23:55:24 +08:00
|
|
|
Title: "RWKV-Runner",
|
|
|
|
Width: 1024,
|
2023-05-31 14:14:25 +08:00
|
|
|
Height: 680,
|
2023-05-06 20:17:39 +08:00
|
|
|
MinWidth: 375,
|
2023-05-04 23:55:24 +08:00
|
|
|
MinHeight: 640,
|
2023-05-03 23:38:54 +08:00
|
|
|
AssetServer: &assetserver.Options{
|
|
|
|
Assets: assets,
|
|
|
|
},
|
2023-05-05 23:23:34 +08:00
|
|
|
OnStartup: app.OnStartup,
|
2023-05-13 20:15:18 +08:00
|
|
|
Bind: []any{
|
2023-05-03 23:38:54 +08:00
|
|
|
app,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
println("Error:", err.Error())
|
|
|
|
}
|
|
|
|
}
|