Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/browser/App.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,18 @@ export const ActiveWorkspaceWithChat: Story = {
projects,
workspaces,
apiOverrides: {
tokenizer: {
countTokens: () => Promise.resolve(42),
countTokensBatch: (_model, texts) => Promise.resolve(texts.map(() => 42)),
calculateStats: () =>
Promise.resolve({
consumers: [],
totalTokens: 0,
model: "mock-model",
tokenizerName: "mock-tokenizer",
usageHistory: [],
}),
},
providers: {
setProviderConfig: () => Promise.resolve({ success: true, data: undefined }),
list: () => Promise.resolve(["anthropic", "openai", "xai"]),
Expand Down Expand Up @@ -1246,6 +1258,13 @@ main
})
);

// Pre-fill input with text so token count is visible
localStorage.setItem(
`input:${workspaceId}`,
"Add OAuth2 support with Google and GitHub providers"
);
localStorage.setItem(`model:${workspaceId}`, "anthropic:claude-sonnet-4-5");

initialized.current = true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/browser/components/ChatInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
<Suspense
fallback={
<div
className="text-muted flex items-center gap-1 text-xs"
className="text-muted flex items-center gap-1 text-[11px]"
data-component="TokenEstimate"
>
<span>Calculating tokens…</span>
Expand Down Expand Up @@ -940,7 +940,7 @@ const TokenCountDisplay: React.FC<{ reader: TokenCountReader }> = ({ reader }) =
return null;
}
return (
<div className="text-muted flex items-center gap-1 text-xs" data-component="TokenEstimate">
<div className="text-muted flex items-center gap-1 text-[11px]" data-component="TokenEstimate">
<span>{tokens.toLocaleString()} tokens</span>
</div>
);
Expand Down