MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / TokenLimitNote

Function TokenLimitNote

graph-ui/src/browser-ai/BrowserChatDock.tsx:130–145  ·  view source on GitHub ↗
({ limit, automatic, chat, model, onChangeOutput }: LimitNote)

Source from the content-addressed store, hash-verified

128 * maximum a larger model stops at the same limit (W6). */
129interface LimitNote { limit: TokenLimits; automatic?: boolean; chat: TokenLimits; model: BrowserModel; onChangeOutput: () => void }
130function TokenLimitNote({ limit, automatic, chat, model, onChangeOutput }: LimitNote): JSX.Element {
131 const larger = BROWSER_MODELS.filter(candidate => candidate.availability === 'available' && candidate.bytes > model.bytes);
132 const sameLimit = larger.every(candidate => candidate.maxOutputTokens <= model.maxOutputTokens);
133 const atMaximum = chat.outputTokens >= model.maxOutputTokens;
134 const raise = automatic ? chat.outputTokens < AUTO_OUTPUT_TOKENS : !atMaximum;
135 return <details className="cbm-chat-limit-note">
136 <summary>{browserChatText.shortened}</summary>
137 <p>{automatic ? browserChatText.limitAutomatic(limit.inputTokens, limit.outputTokens, chat.inputTokens, chat.outputTokens, AUTO_OUTPUT_TOKENS) : browserChatText.limitReached(limit.inputTokens, limit.outputTokens)}</p>
138 {automatic ? raise && <p>{browserChatText.automaticRoom(AUTO_OUTPUT_TOKENS)}</p> : <p>{browserChatText.outputRoom(chat.outputTokens, model.maxOutputTokens)}</p>}
139 {!automatic && atMaximum && sameLimit && <p>{browserChatText.narrower(larger.length > 0)}</p>}
140 {/* At its maximum the limit cannot be raised, so there is nothing to change (C8). */}
141 {raise && <button type="button" onClick={onChangeOutput}>{browserChatText.changeOutputLimit}</button>}
142 {!automatic && larger.length > 0 && (!atMaximum || !sameLimit) && <><p>{browserChatText.largerModels(sameLimit)}</p>
143 <ul>{larger.map(candidate => <li key={candidate.id}>{browserChatText.modelDownload(candidate.displayName, sizeLabel(candidate.bytes))}</li>)}</ul></>}
144 </details>;
145}
146
147/** How an answer was bounded: cut at the output limit, scope too large, history left out,
148 * and which of its names the model was not given. */

Callers

nothing calls this directly

Calls 1

sizeLabelFunction · 0.85

Tested by

no test coverage detected