diff --git a/client/cmd/install.go b/client/cmd/install.go index 4503674..762a8d4 100644 --- a/client/cmd/install.go +++ b/client/cmd/install.go @@ -602,6 +602,10 @@ func setup(userSecret string, isOffline bool) error { config.HighlightMatches = true config.AiCompletion = true config.IsOffline = isOffline + if isOffline { + // By default, offline mode disables AI completion. Users can still enable it if they want it. See #220. + config.AiCompletion = false + } config.EnablePresaving = true err := hctx.SetConfig(&config) if err != nil { diff --git a/client/tui/tui.go b/client/tui/tui.go index 11f5d97..8e85547 100644 --- a/client/tui/tui.go +++ b/client/tui/tui.go @@ -499,7 +499,7 @@ func getRowsFromAiSuggestions(ctx context.Context, columnNames []string, shellNa func getRows(ctx context.Context, columnNames []string, shellName, defaultFilter, query string, numEntries int) ([]table.Row, []*data.HistoryEntry, error) { db := hctx.GetDb(ctx) config := hctx.GetConf(ctx) - if config.AiCompletion && !config.IsOffline && strings.HasPrefix(query, "?") && len(query) > 1 { + if config.AiCompletion && strings.HasPrefix(query, "?") && len(query) > 1 { return getRowsFromAiSuggestions(ctx, columnNames, shellName, query) } searchResults, err := lib.Search(ctx, db, defaultFilter+" "+query, numEntries)