-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.go
More file actions
43 lines (35 loc) · 903 Bytes
/
Copy pathapp.go
File metadata and controls
43 lines (35 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//go:build !cli && !clib
package main
import (
"context"
"nstudio/app/common/eventManager"
"nstudio/app/common/issue"
"nstudio/app/common/response"
"nstudio/app/common/status"
"nstudio/app/tts/modelManager"
"os"
)
type App struct {
context context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (app *App) startup(ctx context.Context) {
app.context = ctx
eventManager.GetInstance().Initialize(ctx)
if err := initializeApp(""); err != nil {
issue.Panic("Failed to initialize app", err)
}
modelManager.Initialize(true)
registerEngines()
response.Initialize()
status.Set(status.Ready, "")
}
func clearConsole() error {
_, err := os.Stdout.WriteString("\033[2J\033[H")
return err
}