Show token bar at bottom of chat input (#33)

This commit is contained in:
Will Chen
2025-04-28 14:45:54 -07:00
committed by GitHub
parent aec5882c8d
commit 0d441b15ca
10 changed files with 369 additions and 8 deletions

View File

@@ -19,6 +19,8 @@ import type {
SystemDebugInfo,
LocalModel,
LocalModelListResponse,
TokenCountParams,
TokenCountResult,
} from "./ipc_types";
import type { CodeProposal, ProposalResult } from "@/lib/schemas";
import { showError } from "@/lib/toast";
@@ -747,4 +749,17 @@ export class IpcClient {
this.ipcRenderer.removeListener("deep-link-received", listener);
};
}
// Count tokens for a chat and input
public async countTokens(
params: TokenCountParams
): Promise<TokenCountResult> {
try {
const result = await this.ipcRenderer.invoke("chat:count-tokens", params);
return result as TokenCountResult;
} catch (error) {
showError(error);
throw error;
}
}
}