Browse Source

wip: refactoring tui

adamdottv 8 months ago
parent
commit
d7d5fc39fb

+ 1 - 1
packages/opencode/src/server/server.ts

@@ -422,7 +422,7 @@ export namespace Server {
           )
           return c.json({
             providers: Object.values(providers),
-            defaults: mapValues(
+            default: mapValues(
               providers,
               (item) => Provider.sort(Object.values(item.models))[0].id,
             ),

+ 1 - 1
packages/tui/internal/app/app.go

@@ -86,7 +86,7 @@ func New(ctx context.Context, version string, httpClient *client.ClientWithRespo
 		return nil, fmt.Errorf("no providers found")
 	}
 
-	appConfigPath := filepath.Join(Info.Path.Config, "tui.toml")
+	appConfigPath := filepath.Join(Info.Path.Config, "config")
 	appConfig, err := config.LoadConfig(appConfigPath)
 	if err != nil {
 		slog.Info("No TUI config found, using default values", "error", err)

+ 0 - 2
packages/tui/internal/components/util/simple-list.go

@@ -6,7 +6,6 @@ import (
 	"github.com/charmbracelet/lipgloss/v2"
 	"github.com/sst/opencode/internal/layout"
 	"github.com/sst/opencode/internal/styles"
-	"github.com/sst/opencode/internal/theme"
 )
 
 type SimpleListItem interface {
@@ -117,7 +116,6 @@ func (c *simpleListComponent[T]) SetSelectedIndex(idx int) {
 }
 
 func (c *simpleListComponent[T]) View() string {
-	t := theme.CurrentTheme()
 	baseStyle := styles.BaseStyle()
 
 	items := c.items

+ 3 - 3
packages/tui/internal/config/config.go

@@ -10,9 +10,9 @@ import (
 )
 
 type Config struct {
-	Theme    string `toml:"Theme"`
-	Provider string `toml:"Provider"`
-	Model    string `toml:"Model"`
+	Theme    string `toml:"theme"`
+	Provider string `toml:"provider"`
+	Model    string `toml:"model"`
 }
 
 // NewConfig creates a new Config instance with default values.