sqlsaber 0.28.0__py3-none-any.whl → 0.29.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sqlsaber might be problematic. Click here for more details.
- sqlsaber/application/auth_setup.py +3 -3
- sqlsaber/application/db_setup.py +2 -2
- sqlsaber/application/model_selection.py +2 -2
- sqlsaber/cli/auth.py +10 -8
- sqlsaber/cli/commands.py +5 -3
- sqlsaber/cli/database.py +22 -20
- sqlsaber/cli/interactive.py +11 -5
- sqlsaber/cli/memory.py +10 -10
- sqlsaber/cli/models.py +12 -12
- sqlsaber/cli/onboarding.py +41 -44
- sqlsaber/cli/theme.py +146 -0
- sqlsaber/cli/threads.py +3 -3
- sqlsaber/config/api_keys.py +5 -5
- sqlsaber/config/oauth_flow.py +11 -10
- sqlsaber/config/oauth_tokens.py +7 -5
- sqlsaber/database/schema.py +1 -1
- sqlsaber/theme/manager.py +87 -85
- {sqlsaber-0.28.0.dist-info → sqlsaber-0.29.1.dist-info}/METADATA +1 -1
- {sqlsaber-0.28.0.dist-info → sqlsaber-0.29.1.dist-info}/RECORD +22 -21
- {sqlsaber-0.28.0.dist-info → sqlsaber-0.29.1.dist-info}/WHEEL +0 -0
- {sqlsaber-0.28.0.dist-info → sqlsaber-0.29.1.dist-info}/entry_points.txt +0 -0
- {sqlsaber-0.28.0.dist-info → sqlsaber-0.29.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -104,7 +104,7 @@ async def setup_auth(
|
|
|
104
104
|
"""
|
|
105
105
|
# Check if auth is already configured
|
|
106
106
|
if auth_manager.has_auth_configured():
|
|
107
|
-
console.print("[
|
|
107
|
+
console.print("[success]✓ Authentication already configured![/success]")
|
|
108
108
|
return True, None
|
|
109
109
|
|
|
110
110
|
# Select provider
|
|
@@ -137,7 +137,7 @@ async def setup_auth(
|
|
|
137
137
|
)
|
|
138
138
|
return True, provider
|
|
139
139
|
else:
|
|
140
|
-
console.print("[
|
|
140
|
+
console.print("[error]✗ Anthropic OAuth setup failed.[/error]")
|
|
141
141
|
return False, None
|
|
142
142
|
|
|
143
143
|
# API key flow
|
|
@@ -160,5 +160,5 @@ async def setup_auth(
|
|
|
160
160
|
)
|
|
161
161
|
return True, provider
|
|
162
162
|
else:
|
|
163
|
-
console.print("[
|
|
163
|
+
console.print("[warning]No API key provided.[/warning]")
|
|
164
164
|
return False, None
|
sqlsaber/application/db_setup.py
CHANGED
|
@@ -88,7 +88,7 @@ async def collect_db_input(
|
|
|
88
88
|
try:
|
|
89
89
|
port = int(port_str)
|
|
90
90
|
except ValueError:
|
|
91
|
-
console.print("[
|
|
91
|
+
console.print("[error]Invalid port number. Using default.[/error]")
|
|
92
92
|
port = default_port
|
|
93
93
|
|
|
94
94
|
database = await prompter.text("Database name:")
|
|
@@ -205,7 +205,7 @@ async def test_connection(config: DatabaseConfig, password: str | None) -> bool:
|
|
|
205
205
|
await db_conn.close()
|
|
206
206
|
return True
|
|
207
207
|
except Exception as e:
|
|
208
|
-
console.print(f"[bold
|
|
208
|
+
console.print(f"[bold error]Connection failed:[/bold error] {e}", style="error")
|
|
209
209
|
return False
|
|
210
210
|
|
|
211
211
|
|
|
@@ -34,7 +34,7 @@ async def choose_model(
|
|
|
34
34
|
Selected model ID (provider:model_id) or None if cancelled
|
|
35
35
|
"""
|
|
36
36
|
if not models:
|
|
37
|
-
console.print("[
|
|
37
|
+
console.print("[warning]No models available[/warning]")
|
|
38
38
|
return None
|
|
39
39
|
|
|
40
40
|
# Filter by provider if restricted
|
|
@@ -42,7 +42,7 @@ async def choose_model(
|
|
|
42
42
|
models = [m for m in models if m.get("provider") == restrict_provider]
|
|
43
43
|
if not models:
|
|
44
44
|
console.print(
|
|
45
|
-
f"[
|
|
45
|
+
f"[warning]No models available for {restrict_provider}[/warning]"
|
|
46
46
|
)
|
|
47
47
|
return None
|
|
48
48
|
|
sqlsaber/cli/auth.py
CHANGED
|
@@ -49,7 +49,7 @@ def setup():
|
|
|
49
49
|
success, _ = asyncio.run(run_setup())
|
|
50
50
|
|
|
51
51
|
if not success:
|
|
52
|
-
console.print("\n[
|
|
52
|
+
console.print("\n[warning]No authentication configured.[/warning]")
|
|
53
53
|
|
|
54
54
|
console.print(
|
|
55
55
|
"\nYou can change this anytime by running [cyan]saber auth setup[/cyan] again."
|
|
@@ -64,8 +64,10 @@ def status():
|
|
|
64
64
|
console.print("\n[bold blue]Authentication Status[/bold blue]")
|
|
65
65
|
|
|
66
66
|
if auth_method is None:
|
|
67
|
-
console.print("[
|
|
68
|
-
console.print(
|
|
67
|
+
console.print("[warning]No authentication method configured[/warning]")
|
|
68
|
+
console.print(
|
|
69
|
+
"Run [primary]saber auth setup[/primary] to configure authentication."
|
|
70
|
+
)
|
|
69
71
|
return
|
|
70
72
|
|
|
71
73
|
# Show configured method summary
|
|
@@ -90,7 +92,7 @@ def status():
|
|
|
90
92
|
elif from_keyring:
|
|
91
93
|
console.print(f"> {provider}: [green]configured[/green]")
|
|
92
94
|
else:
|
|
93
|
-
console.print(f"> {provider}: [
|
|
95
|
+
console.print(f"> {provider}: [warning]not configured[/warning]")
|
|
94
96
|
|
|
95
97
|
|
|
96
98
|
@auth_app.command
|
|
@@ -105,7 +107,7 @@ def reset():
|
|
|
105
107
|
).ask()
|
|
106
108
|
|
|
107
109
|
if provider is None:
|
|
108
|
-
console.print("[
|
|
110
|
+
console.print("[warning]Reset cancelled.[/warning]")
|
|
109
111
|
return
|
|
110
112
|
|
|
111
113
|
api_key_manager = APIKeyManager()
|
|
@@ -121,7 +123,7 @@ def reset():
|
|
|
121
123
|
|
|
122
124
|
if not api_key_present and not oauth_present:
|
|
123
125
|
console.print(
|
|
124
|
-
f"[
|
|
126
|
+
f"[warning]No stored credentials found for {provider}. Nothing to reset.[/warning]"
|
|
125
127
|
)
|
|
126
128
|
return
|
|
127
129
|
|
|
@@ -153,7 +155,7 @@ def reset():
|
|
|
153
155
|
# Already absent; treat as success
|
|
154
156
|
pass
|
|
155
157
|
except Exception as e:
|
|
156
|
-
console.print(f"Warning: Could not remove API key: {e}", style="
|
|
158
|
+
console.print(f"Warning: Could not remove API key: {e}", style="warning")
|
|
157
159
|
|
|
158
160
|
# Optionally clear global auth method if removing Anthropic OAuth configuration
|
|
159
161
|
if provider == "anthropic" and oauth_present:
|
|
@@ -169,7 +171,7 @@ def reset():
|
|
|
169
171
|
config_manager._save_config(config)
|
|
170
172
|
console.print("Global auth method unset.", style="green")
|
|
171
173
|
|
|
172
|
-
console.print("\n[
|
|
174
|
+
console.print("\n[success]✓ Reset complete.[/success]")
|
|
173
175
|
console.print(
|
|
174
176
|
"Environment variables are not modified by this command.", style="dim"
|
|
175
177
|
)
|
sqlsaber/cli/commands.py
CHANGED
|
@@ -11,6 +11,7 @@ from sqlsaber.cli.database import create_db_app
|
|
|
11
11
|
from sqlsaber.cli.memory import create_memory_app
|
|
12
12
|
from sqlsaber.cli.models import create_models_app
|
|
13
13
|
from sqlsaber.cli.onboarding import needs_onboarding, run_onboarding
|
|
14
|
+
from sqlsaber.cli.theme import create_theme_app
|
|
14
15
|
from sqlsaber.cli.threads import create_threads_app
|
|
15
16
|
|
|
16
17
|
# Lazy imports - only import what's needed for CLI parsing
|
|
@@ -35,6 +36,7 @@ app.command(create_auth_app(), name="auth")
|
|
|
35
36
|
app.command(create_db_app(), name="db")
|
|
36
37
|
app.command(create_memory_app(), name="memory")
|
|
37
38
|
app.command(create_models_app(), name="models")
|
|
39
|
+
app.command(create_theme_app(), name="theme")
|
|
38
40
|
app.command(create_threads_app(), name="threads")
|
|
39
41
|
|
|
40
42
|
console = create_console()
|
|
@@ -162,7 +164,7 @@ def query(
|
|
|
162
164
|
streaming_handler = StreamingQueryHandler(console)
|
|
163
165
|
db_type = sqlsaber_agent.db_type
|
|
164
166
|
console.print(
|
|
165
|
-
f"[
|
|
167
|
+
f"[primary]Connected to:[/primary] {db_name} ({db_type})\n"
|
|
166
168
|
)
|
|
167
169
|
run = await streaming_handler.execute_streaming_query(
|
|
168
170
|
actual_query, sqlsaber_agent
|
|
@@ -198,13 +200,13 @@ def query(
|
|
|
198
200
|
finally:
|
|
199
201
|
# Clean up
|
|
200
202
|
await db_conn.close()
|
|
201
|
-
console.print("\n[
|
|
203
|
+
console.print("\n[success]Goodbye![/success]")
|
|
202
204
|
|
|
203
205
|
# Run the async function with proper error handling
|
|
204
206
|
try:
|
|
205
207
|
asyncio.run(run_session())
|
|
206
208
|
except CLIError as e:
|
|
207
|
-
console.print(f"[
|
|
209
|
+
console.print(f"[error]Error:[/error] {e}")
|
|
208
210
|
sys.exit(e.exit_code)
|
|
209
211
|
|
|
210
212
|
|
sqlsaber/cli/database.py
CHANGED
|
@@ -95,7 +95,7 @@ def add(
|
|
|
95
95
|
db_input = asyncio.run(collect_input())
|
|
96
96
|
|
|
97
97
|
if db_input is None:
|
|
98
|
-
console.print("[
|
|
98
|
+
console.print("[warning]Operation cancelled[/warning]")
|
|
99
99
|
return
|
|
100
100
|
|
|
101
101
|
# Extract values from db_input
|
|
@@ -114,7 +114,7 @@ def add(
|
|
|
114
114
|
if type == "sqlite":
|
|
115
115
|
if not database:
|
|
116
116
|
console.print(
|
|
117
|
-
"[bold
|
|
117
|
+
"[bold error]Error:[/bold error] Database file path is required for SQLite"
|
|
118
118
|
)
|
|
119
119
|
sys.exit(1)
|
|
120
120
|
host = "localhost"
|
|
@@ -124,7 +124,7 @@ def add(
|
|
|
124
124
|
elif type == "duckdb":
|
|
125
125
|
if not database:
|
|
126
126
|
console.print(
|
|
127
|
-
"[bold
|
|
127
|
+
"[bold error]Error:[/bold error] Database file path is required for DuckDB"
|
|
128
128
|
)
|
|
129
129
|
sys.exit(1)
|
|
130
130
|
database = str(Path(database).expanduser().resolve())
|
|
@@ -135,7 +135,7 @@ def add(
|
|
|
135
135
|
else:
|
|
136
136
|
if not all([host, database, username]):
|
|
137
137
|
console.print(
|
|
138
|
-
"[bold
|
|
138
|
+
"[bold error]Error:[/bold error] Host, database, and username are required"
|
|
139
139
|
)
|
|
140
140
|
sys.exit(1)
|
|
141
141
|
|
|
@@ -179,7 +179,7 @@ def add(
|
|
|
179
179
|
console.print(f"[blue]Set '{name}' as default database[/blue]")
|
|
180
180
|
|
|
181
181
|
except Exception as e:
|
|
182
|
-
console.print(f"[bold
|
|
182
|
+
console.print(f"[bold error]Error adding database:[/bold error] {e}")
|
|
183
183
|
sys.exit(1)
|
|
184
184
|
|
|
185
185
|
|
|
@@ -190,19 +190,19 @@ def list():
|
|
|
190
190
|
default_name = config_manager.get_default_name()
|
|
191
191
|
|
|
192
192
|
if not databases:
|
|
193
|
-
console.print("[
|
|
193
|
+
console.print("[warning]No database connections configured[/warning]")
|
|
194
194
|
console.print("Use 'sqlsaber db add <name>' to add a database connection")
|
|
195
195
|
return
|
|
196
196
|
|
|
197
197
|
table = Table(title="Database Connections")
|
|
198
198
|
table.add_column("Name", style="cyan")
|
|
199
|
-
table.add_column("Type", style="
|
|
200
|
-
table.add_column("Host", style="
|
|
201
|
-
table.add_column("Port", style="
|
|
202
|
-
table.add_column("Database", style="
|
|
203
|
-
table.add_column("Username", style="
|
|
204
|
-
table.add_column("SSL", style="
|
|
205
|
-
table.add_column("Default", style="
|
|
199
|
+
table.add_column("Type", style="accent")
|
|
200
|
+
table.add_column("Host", style="success")
|
|
201
|
+
table.add_column("Port", style="warning")
|
|
202
|
+
table.add_column("Database", style="info")
|
|
203
|
+
table.add_column("Username", style="info")
|
|
204
|
+
table.add_column("SSL", style="success")
|
|
205
|
+
table.add_column("Default", style="error")
|
|
206
206
|
|
|
207
207
|
for db in databases:
|
|
208
208
|
is_default = "✓" if db.name == default_name else ""
|
|
@@ -239,7 +239,7 @@ def remove(
|
|
|
239
239
|
"""Remove a database connection."""
|
|
240
240
|
if not config_manager.get_database(name):
|
|
241
241
|
console.print(
|
|
242
|
-
f"[bold
|
|
242
|
+
f"[bold error]Error:[/bold error] Database connection '{name}' not found"
|
|
243
243
|
)
|
|
244
244
|
sys.exit(1)
|
|
245
245
|
|
|
@@ -252,7 +252,7 @@ def remove(
|
|
|
252
252
|
)
|
|
253
253
|
else:
|
|
254
254
|
console.print(
|
|
255
|
-
f"[bold
|
|
255
|
+
f"[bold error]Error:[/bold error] Failed to remove database connection '{name}'"
|
|
256
256
|
)
|
|
257
257
|
sys.exit(1)
|
|
258
258
|
else:
|
|
@@ -269,14 +269,16 @@ def set_default(
|
|
|
269
269
|
"""Set the default database connection."""
|
|
270
270
|
if not config_manager.get_database(name):
|
|
271
271
|
console.print(
|
|
272
|
-
f"[bold
|
|
272
|
+
f"[bold error]Error:[/bold error] Database connection '{name}' not found"
|
|
273
273
|
)
|
|
274
274
|
sys.exit(1)
|
|
275
275
|
|
|
276
276
|
if config_manager.set_default_database(name):
|
|
277
277
|
console.print(f"[green]Successfully set '{name}' as default database[/green]")
|
|
278
278
|
else:
|
|
279
|
-
console.print(
|
|
279
|
+
console.print(
|
|
280
|
+
f"[bold error]Error:[/bold error] Failed to set '{name}' as default"
|
|
281
|
+
)
|
|
280
282
|
sys.exit(1)
|
|
281
283
|
|
|
282
284
|
|
|
@@ -299,14 +301,14 @@ def test(
|
|
|
299
301
|
db_config = config_manager.get_database(name)
|
|
300
302
|
if not db_config:
|
|
301
303
|
console.print(
|
|
302
|
-
f"[bold
|
|
304
|
+
f"[bold error]Error:[/bold error] Database connection '{name}' not found"
|
|
303
305
|
)
|
|
304
306
|
sys.exit(1)
|
|
305
307
|
else:
|
|
306
308
|
db_config = config_manager.get_default_database()
|
|
307
309
|
if not db_config:
|
|
308
310
|
console.print(
|
|
309
|
-
"[bold
|
|
311
|
+
"[bold error]Error:[/bold error] No default database configured"
|
|
310
312
|
)
|
|
311
313
|
console.print(
|
|
312
314
|
"Use 'sqlsaber db add <name>' to add a database connection"
|
|
@@ -328,7 +330,7 @@ def test(
|
|
|
328
330
|
)
|
|
329
331
|
|
|
330
332
|
except Exception as e:
|
|
331
|
-
console.print(f"[bold
|
|
333
|
+
console.print(f"[bold error]✗ Connection failed:[/bold error] {e}")
|
|
332
334
|
sys.exit(1)
|
|
333
335
|
|
|
334
336
|
asyncio.run(test_connection())
|
sqlsaber/cli/interactive.py
CHANGED
|
@@ -84,14 +84,14 @@ class InteractiveSession:
|
|
|
84
84
|
|
|
85
85
|
def _banner(self) -> str:
|
|
86
86
|
"""Get the ASCII banner."""
|
|
87
|
-
return """
|
|
87
|
+
return """[primary]
|
|
88
88
|
███████ ██████ ██ ███████ █████ ██████ ███████ ██████
|
|
89
89
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
90
90
|
███████ ██ ██ ██ ███████ ███████ ██████ █████ ██████
|
|
91
91
|
██ ██ ▄▄ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
92
92
|
███████ ██████ ███████ ███████ ██ ██ ██████ ███████ ██ ██
|
|
93
93
|
▀▀
|
|
94
|
-
"""
|
|
94
|
+
[/primary]"""
|
|
95
95
|
|
|
96
96
|
def _instructions(self) -> str:
|
|
97
97
|
"""Get the instruction text."""
|
|
@@ -123,12 +123,18 @@ class InteractiveSession:
|
|
|
123
123
|
def show_welcome_message(self):
|
|
124
124
|
"""Display welcome message for interactive mode."""
|
|
125
125
|
if self.first_message:
|
|
126
|
-
self.console.print(Panel.fit(self._banner()))
|
|
127
|
-
self.console.print(
|
|
126
|
+
self.console.print(Panel.fit(self._banner(), border_style="primary"))
|
|
127
|
+
self.console.print(
|
|
128
|
+
Markdown(
|
|
129
|
+
self._instructions(),
|
|
130
|
+
code_theme=self.tm.pygments_style_name,
|
|
131
|
+
inline_code_theme=self.tm.pygments_style_name,
|
|
132
|
+
)
|
|
133
|
+
)
|
|
128
134
|
|
|
129
135
|
db_name = self.database_name or "Unknown"
|
|
130
136
|
self.console.print(
|
|
131
|
-
f"[heading]\
|
|
137
|
+
f"[heading]\nConnected to {db_name} ({self._db_type_name()})[/heading]\n"
|
|
132
138
|
)
|
|
133
139
|
|
|
134
140
|
if self._thread_id:
|
sqlsaber/cli/memory.py
CHANGED
|
@@ -29,7 +29,7 @@ def _get_database_name(database: str | None = None) -> str:
|
|
|
29
29
|
db_config = config_manager.get_database(database)
|
|
30
30
|
if not db_config:
|
|
31
31
|
console.print(
|
|
32
|
-
f"[bold
|
|
32
|
+
f"[bold error]Error:[/bold error] Database connection '{database}' not found."
|
|
33
33
|
)
|
|
34
34
|
sys.exit(1)
|
|
35
35
|
return database
|
|
@@ -37,7 +37,7 @@ def _get_database_name(database: str | None = None) -> str:
|
|
|
37
37
|
db_config = config_manager.get_default_database()
|
|
38
38
|
if not db_config:
|
|
39
39
|
console.print(
|
|
40
|
-
"[bold
|
|
40
|
+
"[bold error]Error:[/bold error] No database connections configured."
|
|
41
41
|
)
|
|
42
42
|
console.print("Use 'sqlsaber db add <name>' to add a database connection.")
|
|
43
43
|
sys.exit(1)
|
|
@@ -64,7 +64,7 @@ def add(
|
|
|
64
64
|
console.print(f"[dim]Memory ID:[/dim] {memory.id}")
|
|
65
65
|
console.print(f"[dim]Content:[/dim] {memory.content}")
|
|
66
66
|
except Exception as e:
|
|
67
|
-
console.print(f"[bold
|
|
67
|
+
console.print(f"[bold error]Error adding memory:[/bold error] {e}")
|
|
68
68
|
sys.exit(1)
|
|
69
69
|
|
|
70
70
|
|
|
@@ -85,7 +85,7 @@ def list(
|
|
|
85
85
|
|
|
86
86
|
if not memories:
|
|
87
87
|
console.print(
|
|
88
|
-
f"[
|
|
88
|
+
f"[warning]No memories found for database '{database_name}'[/warning]"
|
|
89
89
|
)
|
|
90
90
|
console.print("Use 'sqlsaber memory add \"<content>\"' to add memories")
|
|
91
91
|
return
|
|
@@ -125,7 +125,7 @@ def show(
|
|
|
125
125
|
|
|
126
126
|
if not memory:
|
|
127
127
|
console.print(
|
|
128
|
-
f"[bold
|
|
128
|
+
f"[bold error]Error:[/bold error] Memory with ID '{memory_id}' not found for database '{database_name}'"
|
|
129
129
|
)
|
|
130
130
|
sys.exit(1)
|
|
131
131
|
|
|
@@ -154,12 +154,12 @@ def remove(
|
|
|
154
154
|
memory = memory_manager.get_memory_by_id(database_name, memory_id)
|
|
155
155
|
if not memory:
|
|
156
156
|
console.print(
|
|
157
|
-
f"[bold
|
|
157
|
+
f"[bold error]Error:[/bold error] Memory with ID '{memory_id}' not found for database '{database_name}'"
|
|
158
158
|
)
|
|
159
159
|
sys.exit(1)
|
|
160
160
|
|
|
161
161
|
# Show memory content before removal
|
|
162
|
-
console.print("[
|
|
162
|
+
console.print("[warning]Removing memory:[/warning]")
|
|
163
163
|
console.print(f"[dim]Content:[/dim] {memory.content}")
|
|
164
164
|
|
|
165
165
|
if memory_manager.remove_memory(database_name, memory_id):
|
|
@@ -168,7 +168,7 @@ def remove(
|
|
|
168
168
|
)
|
|
169
169
|
else:
|
|
170
170
|
console.print(
|
|
171
|
-
f"[bold
|
|
171
|
+
f"[bold error]Error:[/bold error] Failed to remove memory '{memory_id}'"
|
|
172
172
|
)
|
|
173
173
|
sys.exit(1)
|
|
174
174
|
|
|
@@ -198,14 +198,14 @@ def clear(
|
|
|
198
198
|
|
|
199
199
|
if memories_count == 0:
|
|
200
200
|
console.print(
|
|
201
|
-
f"[
|
|
201
|
+
f"[warning]No memories to clear for database '{database_name}'[/warning]"
|
|
202
202
|
)
|
|
203
203
|
return
|
|
204
204
|
|
|
205
205
|
if not force:
|
|
206
206
|
# Show confirmation
|
|
207
207
|
console.print(
|
|
208
|
-
f"[
|
|
208
|
+
f"[warning]About to clear {memories_count} memories for database '{database_name}'[/warning]"
|
|
209
209
|
)
|
|
210
210
|
|
|
211
211
|
if not questionary.confirm("Are you sure you want to proceed?").ask():
|
sqlsaber/cli/models.py
CHANGED
|
@@ -106,7 +106,7 @@ class ModelManager:
|
|
|
106
106
|
results.sort(key=lambda x: (x["provider"], x["name"]))
|
|
107
107
|
return results
|
|
108
108
|
except Exception as e:
|
|
109
|
-
console.print(f"[
|
|
109
|
+
console.print(f"[error]Error fetching models: {e}[/error]")
|
|
110
110
|
return []
|
|
111
111
|
|
|
112
112
|
def get_current_model(self) -> str:
|
|
@@ -121,7 +121,7 @@ class ModelManager:
|
|
|
121
121
|
config.set_model(model_id)
|
|
122
122
|
return True
|
|
123
123
|
except Exception as e:
|
|
124
|
-
console.print(f"[
|
|
124
|
+
console.print(f"[error]Error setting model: {e}[/error]")
|
|
125
125
|
return False
|
|
126
126
|
|
|
127
127
|
def reset_model(self) -> bool:
|
|
@@ -142,17 +142,17 @@ def list():
|
|
|
142
142
|
|
|
143
143
|
if not models:
|
|
144
144
|
console.print(
|
|
145
|
-
"[
|
|
145
|
+
"[warning]No models available or failed to fetch models[/warning]"
|
|
146
146
|
)
|
|
147
147
|
return
|
|
148
148
|
|
|
149
149
|
table = Table(title="Available Models")
|
|
150
150
|
table.add_column("Provider", style="magenta")
|
|
151
151
|
table.add_column("ID", style="cyan")
|
|
152
|
-
table.add_column("Name", style="
|
|
153
|
-
table.add_column("Description", style="
|
|
154
|
-
table.add_column("Context", style="
|
|
155
|
-
table.add_column("Current", style="bold
|
|
152
|
+
table.add_column("Name", style="success")
|
|
153
|
+
table.add_column("Description", style="info")
|
|
154
|
+
table.add_column("Context", style="warning", justify="right")
|
|
155
|
+
table.add_column("Current", style="bold accent", justify="center")
|
|
156
156
|
|
|
157
157
|
current_model = model_manager.get_current_model()
|
|
158
158
|
|
|
@@ -196,7 +196,7 @@ def set():
|
|
|
196
196
|
models = await fetch_models(model_manager)
|
|
197
197
|
|
|
198
198
|
if not models:
|
|
199
|
-
console.print("[
|
|
199
|
+
console.print("[error]Failed to fetch models. Cannot set model.[/error]")
|
|
200
200
|
sys.exit(1)
|
|
201
201
|
|
|
202
202
|
prompter = AsyncPrompter()
|
|
@@ -208,10 +208,10 @@ def set():
|
|
|
208
208
|
if model_manager.set_model(selected_model):
|
|
209
209
|
console.print(f"[green]✓ Model set to: {selected_model}[/green]")
|
|
210
210
|
else:
|
|
211
|
-
console.print("[
|
|
211
|
+
console.print("[error]✗ Failed to set model[/error]")
|
|
212
212
|
sys.exit(1)
|
|
213
213
|
else:
|
|
214
|
-
console.print("[
|
|
214
|
+
console.print("[warning]Operation cancelled[/warning]")
|
|
215
215
|
|
|
216
216
|
asyncio.run(interactive_set())
|
|
217
217
|
|
|
@@ -236,10 +236,10 @@ def reset():
|
|
|
236
236
|
f"[green]✓ Model reset to default: {ModelManager.DEFAULT_MODEL}[/green]"
|
|
237
237
|
)
|
|
238
238
|
else:
|
|
239
|
-
console.print("[
|
|
239
|
+
console.print("[error]✗ Failed to reset model[/error]")
|
|
240
240
|
sys.exit(1)
|
|
241
241
|
else:
|
|
242
|
-
console.print("[
|
|
242
|
+
console.print("[warning]Operation cancelled[/warning]")
|
|
243
243
|
|
|
244
244
|
asyncio.run(interactive_reset())
|
|
245
245
|
|