Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(ui): name the input limit in the note under a cut automatic explanation (K1)
Bernhard Jackiewicz090cf0d94107
diff --git a/graph-ui/src/browser-ai/BrowserChatDock.test.tsx b/graph-ui/src/browser-ai/BrowserChatDock.test.tsxindex 140e0bb82..b4ec72d5e 100644--- a/graph-ui/src/browser-ai/BrowserChatDock.test.tsx+++ b/graph-ui/src/browser-ai/BrowserChatDock.test.tsx@@ -1101,7 +1101,10 @@ describe('graph answers and answer limits', () => {const note = container.querySelector<HTMLDetailsElement>('.cbm-chat-explanation details.cbm-chat-limit-note');expect(note?.querySelector('summary')?.textContent).toBe('Token limit reached: the answer was cut short');expect(note?.textContent).toContain('Automatic explanations stop after 128 output tokens');+ // Both limits it ran into, as the note of a question names them: the input limit too.+ expect(note?.textContent).toContain('read at most 1,536 input tokens');expect(note?.textContent).toContain('up to 512 output tokens');+ expect(note?.textContent).toContain('2,048 input tokens');} finally { vi.useRealTimers(); }});diff --git a/graph-ui/src/browser-ai/BrowserChatDock.tsx b/graph-ui/src/browser-ai/BrowserChatDock.tsxindex ed8f32a5f..c50081bd6 100644--- a/graph-ui/src/browser-ai/BrowserChatDock.tsx+++ b/graph-ui/src/browser-ai/BrowserChatDock.tsx@@ -88,13 +88,13 @@ function SourceDisclosure({ children, title }: { children?: ReactNode; title?: s/** Where an answer stopped and what can be changed: the limits it ran into, the way to* the output limit and the larger models with their download. */-interface LimitNote { limit: TokenLimits; automatic?: boolean; chatOutput: number; model: BrowserModel; onChangeOutput: () => void }-function TokenLimitNote({ limit, automatic, chatOutput, model, onChangeOutput }: LimitNote): JSX.Element {+interface LimitNote { limit: TokenLimits; automatic?: boolean; chat: TokenLimits; model: BrowserModel; onChangeOutput: () => void }+function TokenLimitNote({ limit, automatic, chat, model, onChangeOutput }: LimitNote): JSX.Element {const larger = BROWSER_MODELS.filter(candidate => candidate.availability === 'available' && candidate.bytes > model.bytes);return <details className="cbm-chat-limit-note"><summary>{browserChatText.shortened}</summary>- <p>{automatic ? browserChatText.limitAutomatic(limit.outputTokens, chatOutput) : browserChatText.limitReached(limit.inputTokens, limit.outputTokens)}</p>- <p>{browserChatText.outputRoom(chatOutput, model.maxOutputTokens)}</p>+ <p>{automatic ? browserChatText.limitAutomatic(limit.inputTokens, limit.outputTokens, chat.inputTokens, chat.outputTokens) : browserChatText.limitReached(limit.inputTokens, limit.outputTokens)}</p>+ <p>{browserChatText.outputRoom(chat.outputTokens, model.maxOutputTokens)}</p><button type="button" onClick={onChangeOutput}>{browserChatText.changeOutputLimit}</button>{larger.length > 0 && <><p>{browserChatText.largerModels}</p><ul>{larger.map(candidate => <li key={candidate.id}>{browserChatText.modelDownload(candidate.displayName, sizeLabel(candidate.bytes))}</li>)}</ul></>}@@ -296,7 +296,7 @@ export default function BrowserChatDock({ proactiveSelection, selectionScope = "}, [settingsOpen]);const openOutputLimit = (): void => { focusOutputLimit.current = true; setSettingsOpen(true); };const limitNote = (shortened: boolean | undefined, limit: TokenLimits | undefined, automatic?: boolean): LimitNote | undefined => shortened- ? { limit: limit ?? (automatic ? { inputTokens: autoInput, outputTokens: autoOutput } : limits), automatic, chatOutput: limits.outputTokens, model, onChangeOutput: openOutputLimit } : undefined;+ ? { limit: limit ?? (automatic ? { inputTokens: autoInput, outputTokens: autoOutput } : limits), automatic, chat: limits, model, onChangeOutput: openOutputLimit } : undefined;useEffect(() => {const run = autoRun.current;if (run && !run.cancelled && (run.key !== selected?.key || !automatic || !proactive)) {diff --git a/graph-ui/src/browser-ai/strings.ts b/graph-ui/src/browser-ai/strings.tsindex 295d3f6a8..35c43b4a0 100644--- a/graph-ui/src/browser-ai/strings.ts+++ b/graph-ui/src/browser-ai/strings.ts@@ -132,7 +132,7 @@ export const browserChatText = {shortened: 'Token limit reached: the answer was cut short',/** What the expanded token-limit note says, with the limits the answer ran into. */limitReached: (input: number, output: number) => `This answer used all ${tokens(output)} output tokens it was allowed. The input limit is ${tokens(input)} tokens for the question, its source and earlier messages.`,- limitAutomatic: (automatic: number, output: number) => `Automatic explanations stop after ${tokens(automatic)} output tokens so they stay short. A question in the chat may answer with up to ${tokens(output)} output tokens.`,+ limitAutomatic: (automaticInput: number, automatic: number, input: number, output: number) => `Automatic explanations stop after ${tokens(automatic)} output tokens so they stay short, and read at most ${tokens(automaticInput)} input tokens of source and facts. A question in the chat may read up to ${tokens(input)} input tokens and answer with up to ${tokens(output)} output tokens.`,outputRoom: (output: number, max: number) => output < max ? `You can raise the output limit up to ${tokens(max)} tokens in the agent configuration.`: `The output limit is at the maximum of ${tokens(max)} tokens for this model.`,changeOutputLimit: 'Change the output limit',