mirror of
https://github.com/sst/opencode.git
synced 2025-08-04 13:30:52 +00:00
additional tools
This commit is contained in:
parent
005b8ac167
commit
904061c243
33 changed files with 3258 additions and 236 deletions
14
cmd/root.go
14
cmd/root.go
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/kujtimiihoxha/termai/internal/db"
|
||||
"github.com/kujtimiihoxha/termai/internal/llm/models"
|
||||
"github.com/kujtimiihoxha/termai/internal/tui"
|
||||
zone "github.com/lrstanley/bubblezone"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
@ -37,9 +38,11 @@ var rootCmd = &cobra.Command{
|
|||
|
||||
app := app.New(ctx, conn)
|
||||
app.Logger.Info("Starting termai...")
|
||||
zone.NewGlobal()
|
||||
tui := tea.NewProgram(
|
||||
tui.New(app),
|
||||
tea.WithAltScreen(),
|
||||
tea.WithMouseCellMotion(),
|
||||
)
|
||||
app.Logger.Info("Setting up subscriptions...")
|
||||
ch, unsub := setupSubscriptions(app)
|
||||
|
@ -102,6 +105,16 @@ func setupSubscriptions(app *app.App) (chan tea.Msg, func()) {
|
|||
wg.Done()
|
||||
}()
|
||||
}
|
||||
{
|
||||
sub := app.Permissions.Subscribe(ctx)
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
for ev := range sub {
|
||||
ch <- ev
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
return ch, func() {
|
||||
cancel()
|
||||
wg.Wait()
|
||||
|
@ -130,6 +143,7 @@ func loadConfig() {
|
|||
// LLM
|
||||
viper.SetDefault("models.big", string(models.DefaultBigModel))
|
||||
viper.SetDefault("models.small", string(models.DefaultLittleModel))
|
||||
|
||||
viper.SetDefault("providers.openai.key", os.Getenv("OPENAI_API_KEY"))
|
||||
viper.SetDefault("providers.anthropic.key", os.Getenv("ANTHROPIC_API_KEY"))
|
||||
viper.SetDefault("providers.groq.key", os.Getenv("GROQ_API_KEY"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue