mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 10:02:23 +00:00
fix: change thinking level cycling from Tab to Ctrl+T
Tab key was preventing file path autocomplete from working. Changed to Ctrl+T to avoid conflict with Tab completion. - Tab now works normally for file/path autocomplete - Ctrl+T cycles through thinking levels - Shows message if model doesn't support thinking
This commit is contained in:
parent
b367f5bec6
commit
5336843de8
2 changed files with 13 additions and 14 deletions
|
|
@ -6,15 +6,13 @@ import { Editor } from "@mariozechner/pi-tui";
|
||||||
export class CustomEditor extends Editor {
|
export class CustomEditor extends Editor {
|
||||||
public onEscape?: () => void;
|
public onEscape?: () => void;
|
||||||
public onCtrlC?: () => void;
|
public onCtrlC?: () => void;
|
||||||
public onTab?: () => boolean;
|
public onCtrlT?: () => void;
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
// Intercept Tab key when autocomplete is not showing
|
// Intercept Ctrl+T for thinking level cycling
|
||||||
if (data === "\t" && !this.isShowingAutocomplete() && this.onTab) {
|
if (data === "\x14" && this.onCtrlT) {
|
||||||
const handled = this.onTab();
|
this.onCtrlT();
|
||||||
if (handled) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intercept Escape key - but only if autocomplete is NOT active
|
// Intercept Escape key - but only if autocomplete is NOT active
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ export class TuiRenderer {
|
||||||
chalk.dim("ctrl+k") +
|
chalk.dim("ctrl+k") +
|
||||||
chalk.gray(" to delete line") +
|
chalk.gray(" to delete line") +
|
||||||
"\n" +
|
"\n" +
|
||||||
chalk.dim("tab") +
|
chalk.dim("ctrl+t") +
|
||||||
chalk.gray(" to cycle thinking") +
|
chalk.gray(" to cycle thinking") +
|
||||||
"\n" +
|
"\n" +
|
||||||
chalk.dim("/") +
|
chalk.dim("/") +
|
||||||
|
|
@ -213,8 +213,8 @@ export class TuiRenderer {
|
||||||
this.handleCtrlC();
|
this.handleCtrlC();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.editor.onTab = () => {
|
this.editor.onCtrlT = () => {
|
||||||
return this.cycleThinkingLevel();
|
this.cycleThinkingLevel();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle editor submission
|
// Handle editor submission
|
||||||
|
|
@ -607,10 +607,13 @@ export class TuiRenderer {
|
||||||
this.ui.requestRender();
|
this.ui.requestRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
private cycleThinkingLevel(): boolean {
|
private cycleThinkingLevel(): void {
|
||||||
// Only cycle if model supports thinking
|
// Only cycle if model supports thinking
|
||||||
if (!this.agent.state.model?.reasoning) {
|
if (!this.agent.state.model?.reasoning) {
|
||||||
return false; // Not handled, let default Tab behavior continue
|
this.chatContainer.addChild(new Spacer(1));
|
||||||
|
this.chatContainer.addChild(new Text(chalk.dim("Current model does not support thinking"), 1, 0));
|
||||||
|
this.ui.requestRender();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const levels: ThinkingLevel[] = ["off", "minimal", "low", "medium", "high"];
|
const levels: ThinkingLevel[] = ["off", "minimal", "low", "medium", "high"];
|
||||||
|
|
@ -632,8 +635,6 @@ export class TuiRenderer {
|
||||||
this.chatContainer.addChild(new Spacer(1));
|
this.chatContainer.addChild(new Spacer(1));
|
||||||
this.chatContainer.addChild(new Text(chalk.dim(`Thinking level: ${nextLevel}`), 1, 0));
|
this.chatContainer.addChild(new Text(chalk.dim(`Thinking level: ${nextLevel}`), 1, 0));
|
||||||
this.ui.requestRender();
|
this.ui.requestRender();
|
||||||
|
|
||||||
return true; // Handled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearEditor(): void {
|
clearEditor(): void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue