mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Implement ITokenService interface and GeminiTokenService for token counting - Add StatusBarService for managing status bar messages - Extract AIProviderModel enum to centralize model configuration - Remove unused MessageService and AIThoughtMessage classes - Update dependency registration to include new services - Clean up main plugin initialization and status bar handling
33 lines
No EOL
909 B
TypeScript
33 lines
No EOL
909 B
TypeScript
import type AIAgentPlugin from "main";
|
|
import { Resolve } from "./DependencyService";
|
|
import { Services } from "./Services";
|
|
|
|
export class StatusBarService {
|
|
|
|
private readonly plugin: AIAgentPlugin;
|
|
private statusBarItem: HTMLElement | null;
|
|
|
|
public constructor() {
|
|
this.plugin = Resolve<AIAgentPlugin>(Services.AIAgentPlugin);
|
|
}
|
|
|
|
public setStatusBarMessage(message: string) {
|
|
if (this.statusBarItem == null) {
|
|
this.createStatusBarMessage();
|
|
}
|
|
|
|
this.statusBarItem?.empty();
|
|
this.statusBarItem?.createEl("span", { text: message });
|
|
}
|
|
|
|
public removeStatusBarMessage() {
|
|
this.statusBarItem?.remove();
|
|
this.statusBarItem = null;
|
|
}
|
|
|
|
private createStatusBarMessage() {
|
|
this.statusBarItem?.remove();
|
|
this.statusBarItem = this.plugin.addStatusBarItem();
|
|
this.statusBarItem.empty();
|
|
}
|
|
} |