mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 22:03:45 +00:00
Fix arrow key in model selector prior to model loading (#398)
This commit is contained in:
parent
e76ad7aebe
commit
209d95870e
1 changed files with 3 additions and 0 deletions
|
|
@ -152,6 +152,7 @@ export class ModelSelectorComponent extends Container {
|
|||
|
||||
this.allModels = models;
|
||||
this.filteredModels = models;
|
||||
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, models.length - 1));
|
||||
}
|
||||
|
||||
private filterModels(query: string): void {
|
||||
|
|
@ -216,11 +217,13 @@ export class ModelSelectorComponent extends Container {
|
|||
handleInput(keyData: string): void {
|
||||
// Up arrow - wrap to bottom when at top
|
||||
if (isArrowUp(keyData)) {
|
||||
if (this.filteredModels.length === 0) return;
|
||||
this.selectedIndex = this.selectedIndex === 0 ? this.filteredModels.length - 1 : this.selectedIndex - 1;
|
||||
this.updateList();
|
||||
}
|
||||
// Down arrow - wrap to top when at bottom
|
||||
else if (isArrowDown(keyData)) {
|
||||
if (this.filteredModels.length === 0) return;
|
||||
this.selectedIndex = this.selectedIndex === this.filteredModels.length - 1 ? 0 : this.selectedIndex + 1;
|
||||
this.updateList();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue