You've already forked panic-cli
mirror of
https://github.com/Print-and-Panic/panic-cli.git
synced 2026-01-21 10:17:41 -08:00
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package software
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"github.com/Print-and-Panic/panic-cli/cmd"
|
|
"github.com/Print-and-Panic/panic-cli/internal/ai"
|
|
"github.com/Print-and-Panic/panic-cli/internal/config"
|
|
"github.com/Print-and-Panic/panic-cli/internal/github"
|
|
"github.com/Print-and-Panic/panic-cli/internal/software"
|
|
"github.com/spf13/cobra"
|
|
"google.golang.org/genai"
|
|
)
|
|
|
|
var SoftwareCmd = &cobra.Command{
|
|
Use: "software",
|
|
Short: "Software management",
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
initSoftwareMap()
|
|
},
|
|
}
|
|
|
|
var softwareMap map[string]software.Launchable
|
|
|
|
func initSoftwareMap() {
|
|
|
|
geminiConfig := &genai.GenerateContentConfig{
|
|
SystemInstruction: genai.NewContentFromText(software.BambuReleaseSummarizer, genai.RoleUser),
|
|
}
|
|
geminiProvider, err := ai.NewGeminiProvider(context.Background(), config.AppConfig.AI.Gemini.APIKey, ai.GeminiModel2p5Flash, geminiConfig)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
softwareList := []software.Launchable{
|
|
&software.BambuStudio{
|
|
AppImage: software.AppImage{
|
|
Path: config.AppConfig.Software["bambu"].Path,
|
|
},
|
|
GitHubProject: github.GitHubProject{
|
|
Owner: "bambulab",
|
|
Repo: "BambuStudio",
|
|
},
|
|
GeminiProvider: *geminiProvider,
|
|
},
|
|
}
|
|
|
|
softwareMap = make(map[string]software.Launchable)
|
|
for _, s := range softwareList {
|
|
softwareMap[s.ID()] = s
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
cmd.RootCmd.AddCommand(SoftwareCmd)
|
|
}
|