mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 06:04:05 +00:00
feat: add search parameter and auto-select to /model command
- /model <search> pre-filters selector or auto-selects on exact match - Support provider/model syntax for disambiguation (e.g., /model openai/gpt-4) - Auto-select logic moved to InteractiveMode to avoid selector UI flicker Closes #587
This commit is contained in:
parent
92eb6665fe
commit
e8eb4c254a
5 changed files with 82 additions and 6 deletions
|
|
@ -43,6 +43,7 @@ export class ModelSelectorComponent extends Container {
|
|||
scopedModels: ReadonlyArray<ScopedModelItem>,
|
||||
onSelect: (model: Model<any>) => void,
|
||||
onCancel: () => void,
|
||||
initialSearchInput?: string,
|
||||
) {
|
||||
super();
|
||||
|
||||
|
|
@ -68,6 +69,9 @@ export class ModelSelectorComponent extends Container {
|
|||
|
||||
// Create search input
|
||||
this.searchInput = new Input();
|
||||
if (initialSearchInput) {
|
||||
this.searchInput.setValue(initialSearchInput);
|
||||
}
|
||||
this.searchInput.onSubmit = () => {
|
||||
// Enter on search input selects the first filtered item
|
||||
if (this.filteredModels[this.selectedIndex]) {
|
||||
|
|
@ -89,7 +93,11 @@ export class ModelSelectorComponent extends Container {
|
|||
|
||||
// Load models and do initial render
|
||||
this.loadModels().then(() => {
|
||||
this.updateList();
|
||||
if (initialSearchInput) {
|
||||
this.filterModels(initialSearchInput);
|
||||
} else {
|
||||
this.updateList();
|
||||
}
|
||||
// Request re-render after models are loaded
|
||||
this.tui.requestRender();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue