Improve model selection

This commit is contained in:
andrepimenta
2025-06-20 13:54:57 +01:00
parent 47b5de0952
commit c8a3069e45
3 changed files with 1231 additions and 1106 deletions

View File

@@ -128,7 +128,7 @@ class ClaudeChatProvider {
}> = [];
private _treeProvider: ClaudeChatViewProvider | undefined;
private _currentClaudeProcess: cp.ChildProcess | undefined;
private _selectedModel: string = 'opus'; // Default model
private _selectedModel: string = 'default'; // Default model
constructor(
private readonly _extensionUri: vscode.Uri,
@@ -143,7 +143,7 @@ class ClaudeChatProvider {
this._conversationIndex = this._context.workspaceState.get('claude.conversationIndex', []);
// Load saved model preference
this._selectedModel = this._context.workspaceState.get('claude.selectedModel', 'opus');
this._selectedModel = this._context.workspaceState.get('claude.selectedModel', 'default');
// Resume session from latest conversation
const latestConversation = this._getLatestConversation();
@@ -216,6 +216,9 @@ class ClaudeChatProvider {
case 'selectModel':
this._setSelectedModel(message.model);
return;
case 'openModelTerminal':
this._openModelTerminal();
return;
}
},
null,
@@ -1198,6 +1201,34 @@ class ClaudeChatProvider {
}
}
private _openModelTerminal(): void {
const config = vscode.workspace.getConfiguration('claude');
const wslEnabled = config.get<boolean>('wsl.enabled', false);
const wslDistro = config.get<string>('wsl.distro', 'Ubuntu');
const claudePath = config.get<string>('wsl.claudePath', '/usr/local/bin/claude');
// Create terminal with the claude /model command
const terminal = vscode.window.createTerminal('Claude Model Selection');
if (wslEnabled) {
terminal.sendText(`wsl -d ${wslDistro} ${claudePath} /model`);
} else {
terminal.sendText('claude /model');
}
terminal.show();
// Show info message
vscode.window.showInformationMessage(
'Check the terminal to update your default model configuration. Come back to this chat here after making changes.',
'OK'
);
// Send message to UI about terminal
this._panel?.webview.postMessage({
type: 'terminalOpened',
data: 'Check the terminal to update your default model configuration. Come back to this chat here after making changes.'
});
}
public dispose() {
if (this._panel) {
this._panel.dispose();

1165
src/ui-styles.ts Normal file

File diff suppressed because it is too large Load Diff

1137
src/ui.ts

File diff suppressed because it is too large Load Diff