init: initial commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
_ "embed"
|
||||
"log"
|
||||
"log/slog"
|
||||
|
||||
"engimind/internal/chat"
|
||||
"engimind/internal/config"
|
||||
"engimind/internal/parser"
|
||||
"engimind/internal/project"
|
||||
"engimind/internal/vector"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
// --- Initialize services ---
|
||||
configSvc := config.NewConfigService()
|
||||
if err := configSvc.Init(); err != nil {
|
||||
log.Fatalf("failed to init config: %v", err)
|
||||
}
|
||||
|
||||
projectSvc := project.NewProjectService()
|
||||
projectSvc.SetGlobalDB(configSvc.GetDB())
|
||||
|
||||
parseSvc := parser.NewParseService()
|
||||
embeddingSvc := vector.NewEmbeddingService()
|
||||
|
||||
ragSvc := vector.NewRAGService(embeddingSvc, nil) // RAG store is dynamically initialized later when used
|
||||
chatSvc := chat.NewChatService(configSvc, projectSvc, ragSvc)
|
||||
|
||||
_ = parseSvc // Used for file import
|
||||
|
||||
slog.Info("EngiMind services initialized")
|
||||
|
||||
// --- Create Wails app ---
|
||||
app := application.New(application.Options{
|
||||
Name: "EngiMind",
|
||||
Description: "Engineering AI Collaboration Space",
|
||||
Services: []application.Service{
|
||||
application.NewService(configSvc),
|
||||
application.NewService(projectSvc),
|
||||
application.NewService(parseSvc),
|
||||
application.NewService(chatSvc),
|
||||
},
|
||||
Assets: application.AssetOptions{
|
||||
Handler: application.AssetFileServerFS(assets),
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
|
||||
app.Window.NewWithOptions(application.WebviewWindowOptions{
|
||||
Title: "EngiMind — 工程 AI 协作空间",
|
||||
Width: 1600,
|
||||
Height: 960,
|
||||
Mac: application.MacWindow{
|
||||
InvisibleTitleBarHeight: 50,
|
||||
Backdrop: application.MacBackdropTranslucent,
|
||||
TitleBar: application.MacTitleBarHiddenInset,
|
||||
},
|
||||
BackgroundColour: application.NewRGB(255, 255, 255),
|
||||
URL: "/",
|
||||
})
|
||||
|
||||
if err := app.Run(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user