mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 23:01:30 +00:00
cheers
This commit is contained in:
parent
73734a23a1
commit
09d1b099b7
3 changed files with 30 additions and 2 deletions
|
|
@ -42,6 +42,7 @@ export class FooterDataProvider {
|
|||
private cachedBranch: string | null | undefined = undefined;
|
||||
private gitWatcher: FSWatcher | null = null;
|
||||
private branchChangeCallbacks = new Set<() => void>();
|
||||
private availableProviderCount = 0;
|
||||
|
||||
constructor() {
|
||||
this.setupGitWatcher();
|
||||
|
|
@ -90,6 +91,16 @@ export class FooterDataProvider {
|
|||
this.extensionStatuses.clear();
|
||||
}
|
||||
|
||||
/** Number of unique providers with available models (for footer display) */
|
||||
getAvailableProviderCount(): number {
|
||||
return this.availableProviderCount;
|
||||
}
|
||||
|
||||
/** Internal: update available provider count */
|
||||
setAvailableProviderCount(count: number): void {
|
||||
this.availableProviderCount = count;
|
||||
}
|
||||
|
||||
/** Internal: cleanup */
|
||||
dispose(): void {
|
||||
if (this.gitWatcher) {
|
||||
|
|
@ -126,8 +137,8 @@ export class FooterDataProvider {
|
|||
}
|
||||
}
|
||||
|
||||
/** Read-only view for extensions - excludes setExtensionStatus and dispose */
|
||||
/** Read-only view for extensions - excludes setExtensionStatus, setAvailableProviderCount and dispose */
|
||||
export type ReadonlyFooterDataProvider = Pick<
|
||||
FooterDataProvider,
|
||||
"getGitBranch" | "getExtensionStatuses" | "onBranchChange"
|
||||
"getGitBranch" | "getExtensionStatuses" | "getAvailableProviderCount" | "onBranchChange"
|
||||
>;
|
||||
|
|
|
|||
|
|
@ -168,6 +168,11 @@ export class FooterComponent implements Component {
|
|||
}
|
||||
}
|
||||
|
||||
// Prepend the provider in parenthesis to the right side if there's multiple providers
|
||||
if (this.footerData.getAvailableProviderCount() > 1 && state.model) {
|
||||
rightSide = `(${state.model.provider}) ${rightSide}`;
|
||||
}
|
||||
|
||||
let statsLeftWidth = visibleWidth(statsLeft);
|
||||
const rightSideWidth = visibleWidth(rightSide);
|
||||
|
||||
|
|
|
|||
|
|
@ -476,6 +476,9 @@ export class InteractiveMode {
|
|||
this.footerDataProvider.onBranchChange(() => {
|
||||
this.ui.requestRender();
|
||||
});
|
||||
|
||||
// Initialize available provider count for footer display
|
||||
await this.updateAvailableProviderCount();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2781,6 +2784,13 @@ export class InteractiveMode {
|
|||
}
|
||||
}
|
||||
|
||||
/** Update the footer's available provider count from current model candidates */
|
||||
private async updateAvailableProviderCount(): Promise<void> {
|
||||
const models = await this.getModelCandidates();
|
||||
const uniqueProviders = new Set(models.map((m) => m.provider));
|
||||
this.footerDataProvider.setAvailableProviderCount(uniqueProviders.size);
|
||||
}
|
||||
|
||||
private showModelSelector(initialSearchInput?: string): void {
|
||||
this.showSelector((done) => {
|
||||
const selector = new ModelSelectorComponent(
|
||||
|
|
@ -3173,6 +3183,7 @@ export class InteractiveMode {
|
|||
try {
|
||||
this.session.modelRegistry.authStorage.logout(providerId);
|
||||
this.session.modelRegistry.refresh();
|
||||
await this.updateAvailableProviderCount();
|
||||
this.showStatus(`Logged out of ${providerName}`);
|
||||
} catch (error: unknown) {
|
||||
this.showError(`Logout failed: ${error instanceof Error ? error.message : String(error)}`);
|
||||
|
|
@ -3267,6 +3278,7 @@ export class InteractiveMode {
|
|||
// Success
|
||||
restoreEditor();
|
||||
this.session.modelRegistry.refresh();
|
||||
await this.updateAvailableProviderCount();
|
||||
this.showStatus(`Logged in to ${providerName}. Credentials saved to ${getAuthPath()}`);
|
||||
} catch (error: unknown) {
|
||||
restoreEditor();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue