anixcode 0.12.4__tar.gz → 0.12.5__tar.gz
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.
- {anixcode-0.12.4 → anixcode-0.12.5}/PKG-INFO +1 -1
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/__init__.py +1 -1
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/commands.py +4 -4
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/i18n_en.py +12 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tui/app.py +38 -2
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tui/app.tcss +4 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tui/screens.py +111 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode.egg-info/PKG-INFO +1 -1
- {anixcode-0.12.4 → anixcode-0.12.5}/pyproject.toml +1 -1
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_v011_features.py +23 -1
- {anixcode-0.12.4 → anixcode-0.12.5}/LICENSE +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/README.md +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/__main__.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/agent.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/airpc.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/browser.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/checkpoints.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/cli.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/compaction.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/danger.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/i18n.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/images.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/llm.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/mcp.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/mentions.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/projects.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/prompts.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/providers.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/settings.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/storage.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/__init__.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/base.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/browser.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/files.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/search.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/shell.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/todo.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tools/web.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tui/__init__.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tui/anim.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode/tui/widgets.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode.egg-info/SOURCES.txt +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode.egg-info/dependency_links.txt +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode.egg-info/entry_points.txt +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode.egg-info/requires.txt +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/anixcode.egg-info/top_level.txt +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/setup.cfg +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_agent.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_commands.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_i18n.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_images.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_llm.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_mcp.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_projects.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_providers.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_reliability.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_safety_mentions.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_settings.py +0 -0
- {anixcode-0.12.4 → anixcode-0.12.5}/tests/test_tools.py +0 -0
|
@@ -79,9 +79,8 @@ ACTIONS: tuple[Command, ...] = (
|
|
|
79
79
|
Command("undo", tr("откатить правки файлов из последнего ответа"), action="undo"),
|
|
80
80
|
Command("redo", tr("вернуть то, что откатили /undo"), action="redo"),
|
|
81
81
|
Command("compact", tr("сжать историю, чтобы освободить контекст"), action="compact"),
|
|
82
|
-
Command("model", tr("
|
|
83
|
-
Command("
|
|
84
|
-
Command("connect", tr("подключить провайдера"), action="connect"),
|
|
82
|
+
Command("model", tr("быстро переключить модель текущего провайдера"), action="model", args_hint=tr("[имя]")),
|
|
83
|
+
Command("connect", tr("подключить провайдера и API-ключ"), action="connect"),
|
|
85
84
|
Command("project", tr("выбрать проект или склонировать репозиторий"), action="project"),
|
|
86
85
|
Command("theme", tr("выбрать тему"), action="theme"),
|
|
87
86
|
Command("themes", tr("выбрать тему"), action="theme"),
|
|
@@ -159,7 +158,8 @@ def all_commands(root: Path | None = None, config_dir: Path | None = None) -> li
|
|
|
159
158
|
|
|
160
159
|
|
|
161
160
|
def find(name: str, commands: list[Command]) -> Command | None:
|
|
162
|
-
|
|
161
|
+
target = "model" if name.lower() == "models" else name.lower()
|
|
162
|
+
return next((c for c in commands if c.name == target), None)
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
def parse(text: str) -> tuple[str, str]:
|
|
@@ -529,4 +529,16 @@ EN: dict[str, str] = {
|
|
|
529
529
|
'✓ Подключение работает! Найдено моделей: {0}. Можно нажимать «Сохранить и начать».':
|
|
530
530
|
'✓ Connection works! Found {0} models. Click “Save & start”.',
|
|
531
531
|
'✓ Цель достигнута ({0}/{1})': '✓ Goal achieved ({0}/{1})',
|
|
532
|
+
# v0.12.5: quick model picker (/model & clicking model in statusbar)
|
|
533
|
+
'[имя]': '[name]',
|
|
534
|
+
'Выбрать': 'Select',
|
|
535
|
+
'Моделей: {0} · ↑↓ и Enter для выбора': 'Models: {0} · ↑↓ and Enter to pick',
|
|
536
|
+
'Модель · {0}': 'Model · {0}',
|
|
537
|
+
'Модель: {0}': 'Model: {0}',
|
|
538
|
+
'Поиск или название модели…': 'Search or enter a model name…',
|
|
539
|
+
'Провайдер и ключ': 'Provider & key',
|
|
540
|
+
'Сервер не вернул список — введите название модели и нажмите Enter.':
|
|
541
|
+
'Server returned no list — type a model name and press Enter.',
|
|
542
|
+
'быстро переключить модель текущего провайдера': 'quickly switch model for the current provider',
|
|
543
|
+
'подключить провайдера и API-ключ': 'connect a provider and API key',
|
|
532
544
|
}
|
|
@@ -37,7 +37,7 @@ from ..settings import Credentials, Settings, config_dir, load_auth, load_projec
|
|
|
37
37
|
from ..storage import Session, Store
|
|
38
38
|
from ..tools import ToolContext, ToolResult, default_tools
|
|
39
39
|
from .anim import THEME_LABELS, ActivityIndicator, AnimatedLogo, Gradient, make_themes, palette
|
|
40
|
-
from .screens import HelpScreen, ProjectScreen, SessionsScreen, SetupScreen, ThemeScreen
|
|
40
|
+
from .screens import HelpScreen, ModelPickerScreen, ProjectScreen, SessionsScreen, SetupScreen, ThemeScreen
|
|
41
41
|
from .widgets import (
|
|
42
42
|
AssistantMessage, AttachmentBar, BrowserPane, BtwCard, Chip, ErrorMessage, MentionList, Notice, PermissionBar,
|
|
43
43
|
PromptInput, ReasoningBlock, TodoBar, ToolCard, UserMessage,
|
|
@@ -119,7 +119,7 @@ class AnixApp(App):
|
|
|
119
119
|
yield MentionList(id="mentions")
|
|
120
120
|
yield PromptInput(id="prompt")
|
|
121
121
|
with Horizontal(id="statusbar"):
|
|
122
|
-
yield Chip("", self.
|
|
122
|
+
yield Chip("", self.action_model, id="status-model")
|
|
123
123
|
yield Static(id="status-usage")
|
|
124
124
|
yield Chip("", self.action_toggle_access, id="status-access")
|
|
125
125
|
|
|
@@ -534,6 +534,9 @@ class AnixApp(App):
|
|
|
534
534
|
if cmd.action == "browser":
|
|
535
535
|
self.action_browser(args)
|
|
536
536
|
return
|
|
537
|
+
if cmd.action == "model":
|
|
538
|
+
self.action_model(args)
|
|
539
|
+
return
|
|
537
540
|
if cmd.action == "reasoning":
|
|
538
541
|
self.action_reasoning(args)
|
|
539
542
|
return
|
|
@@ -1203,6 +1206,39 @@ class AnixApp(App):
|
|
|
1203
1206
|
self.notify(tr("Plan: агент только читает и планирует") if self._agent_mode == "plan"
|
|
1204
1207
|
else tr("Build: агент может править код"), timeout=2)
|
|
1205
1208
|
|
|
1209
|
+
def action_model(self, args: str = "") -> None:
|
|
1210
|
+
if isinstance(self.screen, (ModelPickerScreen, SetupScreen)):
|
|
1211
|
+
return
|
|
1212
|
+
if not self.settings.provider or self._llm_client is None:
|
|
1213
|
+
self.action_connect()
|
|
1214
|
+
return
|
|
1215
|
+
direct = args.strip()
|
|
1216
|
+
if direct:
|
|
1217
|
+
self._switch_model(direct)
|
|
1218
|
+
return
|
|
1219
|
+
provider_name = providers.get(self.settings.provider, self.settings).name
|
|
1220
|
+
|
|
1221
|
+
def done(choice: str | None) -> None:
|
|
1222
|
+
if choice == "__connect__":
|
|
1223
|
+
self.action_connect()
|
|
1224
|
+
return
|
|
1225
|
+
if choice:
|
|
1226
|
+
self._switch_model(choice)
|
|
1227
|
+
self.query_one(PromptInput).focus()
|
|
1228
|
+
|
|
1229
|
+
self.push_screen(ModelPickerScreen(provider_name, self.settings.model, self._llm_client), done)
|
|
1230
|
+
|
|
1231
|
+
def _switch_model(self, model_id: str) -> None:
|
|
1232
|
+
self.settings.model = model_id
|
|
1233
|
+
save_settings(self.settings, self.config_base)
|
|
1234
|
+
if self.agent is not None:
|
|
1235
|
+
self.agent.model = model_id
|
|
1236
|
+
else:
|
|
1237
|
+
self._build_agent()
|
|
1238
|
+
self.session.model = model_id
|
|
1239
|
+
self._refresh_bars()
|
|
1240
|
+
self.notify(tr("Модель: {0}", model_id), timeout=3)
|
|
1241
|
+
|
|
1206
1242
|
def action_connect(self) -> None:
|
|
1207
1243
|
if isinstance(self.screen, SetupScreen):
|
|
1208
1244
|
return
|
|
@@ -270,6 +270,117 @@ class SetupScreen(ModalScreen[bool]):
|
|
|
270
270
|
self.dismiss(False)
|
|
271
271
|
|
|
272
272
|
|
|
273
|
+
class ModelPickerScreen(ModalScreen[str | None]):
|
|
274
|
+
"""Quick model switcher for the active provider: live fetch + search filter.
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
- chosen model id (str)
|
|
278
|
+
- "__connect__" if the user wants to switch provider / edit API key
|
|
279
|
+
- None on cancel
|
|
280
|
+
"""
|
|
281
|
+
|
|
282
|
+
BINDINGS = [("escape", "cancel", tr("Отмена"))]
|
|
283
|
+
|
|
284
|
+
def __init__(self, provider_name: str, current_model: str, client) -> None:
|
|
285
|
+
super().__init__()
|
|
286
|
+
self._provider_name = provider_name
|
|
287
|
+
self._current_model = current_model
|
|
288
|
+
self._client = client
|
|
289
|
+
self._all_models: list[str] = []
|
|
290
|
+
self._filtered: list[str] = []
|
|
291
|
+
|
|
292
|
+
def compose(self) -> ComposeResult:
|
|
293
|
+
with Vertical(id="dialog"):
|
|
294
|
+
yield Label(tr("Модель · {0}", self._provider_name), classes="dialog-title")
|
|
295
|
+
yield Input(placeholder=tr("Поиск или название модели…"), id="model-filter")
|
|
296
|
+
yield Static(tr("Загружаю список моделей…"), id="model-picker-status", classes="hint")
|
|
297
|
+
yield OptionList(id="model-picker-list")
|
|
298
|
+
with Horizontal(classes="buttons"):
|
|
299
|
+
yield Button(tr("Выбрать"), id="mp-pick", variant="primary")
|
|
300
|
+
yield Button(tr("Провайдер и ключ"), id="mp-connect")
|
|
301
|
+
yield Button(tr("Отмена"), id="mp-cancel")
|
|
302
|
+
|
|
303
|
+
def on_mount(self) -> None:
|
|
304
|
+
self.query_one("#model-filter", Input).focus()
|
|
305
|
+
self._load_models()
|
|
306
|
+
|
|
307
|
+
@work(exclusive=True, group="model-picker")
|
|
308
|
+
async def _load_models(self) -> None:
|
|
309
|
+
status = self.query_one("#model-picker-status", Static)
|
|
310
|
+
try:
|
|
311
|
+
models = await self._client.list_models()
|
|
312
|
+
except LLMError as e:
|
|
313
|
+
status.update(Text(str(e).splitlines()[0], style="red"))
|
|
314
|
+
return
|
|
315
|
+
self._all_models = models
|
|
316
|
+
if not models:
|
|
317
|
+
status.update(tr("Сервер не вернул список — введите название модели и нажмите Enter."))
|
|
318
|
+
return
|
|
319
|
+
self._render_list(self.query_one("#model-filter", Input).value)
|
|
320
|
+
|
|
321
|
+
def _render_list(self, query: str) -> None:
|
|
322
|
+
q = query.strip().lower()
|
|
323
|
+
self._filtered = [m for m in self._all_models if not q or q in m.lower()]
|
|
324
|
+
box = self.query_one("#model-picker-list", OptionList)
|
|
325
|
+
box.clear_options()
|
|
326
|
+
for m in self._filtered:
|
|
327
|
+
if m == self._current_model:
|
|
328
|
+
box.add_option(Text.assemble(("● ", "bold"), (m, "bold")))
|
|
329
|
+
else:
|
|
330
|
+
box.add_option(Text(f" {m}"))
|
|
331
|
+
status = self.query_one("#model-picker-status", Static)
|
|
332
|
+
status.update(tr("Моделей: {0} · ↑↓ и Enter для выбора", len(self._filtered)))
|
|
333
|
+
if self._filtered:
|
|
334
|
+
if self._current_model in self._filtered and not q:
|
|
335
|
+
box.highlighted = self._filtered.index(self._current_model)
|
|
336
|
+
else:
|
|
337
|
+
box.highlighted = 0
|
|
338
|
+
|
|
339
|
+
@on(Input.Changed, "#model-filter")
|
|
340
|
+
def _filter_changed(self, event: Input.Changed) -> None:
|
|
341
|
+
if self._all_models:
|
|
342
|
+
self._render_list(event.value)
|
|
343
|
+
|
|
344
|
+
@on(Input.Submitted, "#model-filter")
|
|
345
|
+
def _filter_submitted(self) -> None:
|
|
346
|
+
self._confirm()
|
|
347
|
+
|
|
348
|
+
@on(OptionList.OptionSelected, "#model-picker-list")
|
|
349
|
+
def _option_picked(self, event: OptionList.OptionSelected) -> None:
|
|
350
|
+
if 0 <= event.option_index < len(self._filtered):
|
|
351
|
+
self.dismiss(self._filtered[event.option_index])
|
|
352
|
+
|
|
353
|
+
def _confirm(self) -> None:
|
|
354
|
+
box = self.query_one("#model-picker-list", OptionList)
|
|
355
|
+
typed = self.query_one("#model-filter", Input).value.strip()
|
|
356
|
+
if self._filtered and box.highlighted is not None and 0 <= box.highlighted < len(self._filtered):
|
|
357
|
+
self.dismiss(self._filtered[box.highlighted])
|
|
358
|
+
elif typed:
|
|
359
|
+
self.dismiss(typed)
|
|
360
|
+
|
|
361
|
+
def on_key(self, event) -> None:
|
|
362
|
+
if event.key in ("down", "up") and self._filtered:
|
|
363
|
+
box = self.query_one("#model-picker-list", OptionList)
|
|
364
|
+
if event.key == "down":
|
|
365
|
+
box.action_cursor_down()
|
|
366
|
+
else:
|
|
367
|
+
box.action_cursor_up()
|
|
368
|
+
event.stop()
|
|
369
|
+
event.prevent_default()
|
|
370
|
+
|
|
371
|
+
@on(Button.Pressed, "#mp-pick")
|
|
372
|
+
def _pick_pressed(self) -> None:
|
|
373
|
+
self._confirm()
|
|
374
|
+
|
|
375
|
+
@on(Button.Pressed, "#mp-connect")
|
|
376
|
+
def _connect_pressed(self) -> None:
|
|
377
|
+
self.dismiss("__connect__")
|
|
378
|
+
|
|
379
|
+
@on(Button.Pressed, "#mp-cancel")
|
|
380
|
+
def action_cancel(self) -> None:
|
|
381
|
+
self.dismiss(None)
|
|
382
|
+
|
|
383
|
+
|
|
273
384
|
class ThemeScreen(ModalScreen[str | None]):
|
|
274
385
|
"""Theme picker with live preview."""
|
|
275
386
|
|
|
@@ -305,9 +305,16 @@ def test_project_mcp_skills_global_rules_and_wal(tmp_path):
|
|
|
305
305
|
|
|
306
306
|
def test_tui_boots_with_browser_pane_and_todo_bar(tmp_path):
|
|
307
307
|
from anixcode.tui.app import AnixApp
|
|
308
|
-
from anixcode.tui.screens import SetupScreen
|
|
308
|
+
from anixcode.tui.screens import ModelPickerScreen, SetupScreen
|
|
309
309
|
from anixcode.tui.widgets import BrowserPane, TodoBar
|
|
310
310
|
|
|
311
|
+
class FakeModelClient:
|
|
312
|
+
async def list_models(self):
|
|
313
|
+
return ["deepseek-chat", "deepseek-reasoner", "qwen-coder"]
|
|
314
|
+
|
|
315
|
+
async def aclose(self):
|
|
316
|
+
pass
|
|
317
|
+
|
|
311
318
|
async def go():
|
|
312
319
|
store = Store(tmp_path / "tui.db")
|
|
313
320
|
app = AnixApp(tmp_path, Settings(provider="deepseek", model="deepseek-chat", animations=False),
|
|
@@ -326,6 +333,21 @@ def test_tui_boots_with_browser_pane_and_todo_bar(tmp_path):
|
|
|
326
333
|
app.action_reasoning("medium")
|
|
327
334
|
await pilot.pause()
|
|
328
335
|
assert app.settings.reasoning_effort == "medium"
|
|
336
|
+
|
|
337
|
+
# Direct /model <name> switches immediately
|
|
338
|
+
app._llm_client = FakeModelClient()
|
|
339
|
+
app.action_model("qwen-coder")
|
|
340
|
+
assert app.settings.model == "qwen-coder" and app.agent.model == "qwen-coder"
|
|
341
|
+
|
|
342
|
+
# Clicking model / calling /model opens ModelPickerScreen with live list & filter
|
|
343
|
+
app.action_model()
|
|
344
|
+
await pilot.pause(0.1)
|
|
345
|
+
assert isinstance(app.screen, ModelPickerScreen)
|
|
346
|
+
app.screen._render_list("reasoner")
|
|
347
|
+
app.screen._confirm()
|
|
348
|
+
await pilot.pause()
|
|
349
|
+
assert app.settings.model == "deepseek-reasoner" and app.agent.model == "deepseek-reasoner"
|
|
350
|
+
|
|
329
351
|
app.action_connect()
|
|
330
352
|
await pilot.pause()
|
|
331
353
|
assert isinstance(app.screen, SetupScreen)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|