Skip to content

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.

fix(ui): offer the choices under a German suggestion in German

Bernhard Jackiewicz76ad98fdba68
diff --git a/graph-ui/src/browser-ai/BrowserChatDock.test.tsx b/graph-ui/src/browser-ai/BrowserChatDock.test.tsx
index 9ddf32e81..a49a21e18 100644
--- a/graph-ui/src/browser-ai/BrowserChatDock.test.tsx
+++ b/graph-ui/src/browser-ai/BrowserChatDock.test.tsx
@@ -930,15 +930,19 @@ describe('graph answers and answer limits', () => {
await type('wer ruf jsonbagg auf'); await click('Send ↑');
expect(runtime.chat).not.toHaveBeenCalled();
expect(last().querySelector('.cbm-chat-answer-text')?.textContent).toContain('Aufrufer von JSONBAgg im geladenen Graphen');
+ expect([...last().querySelectorAll('button.cbm-chat-retry')].map(item => item.textContent)).toEqual(['Modell fragen']);
await type('jsonbagg aufrufe?'); await click('Send ↑');
expect(runtime.chat).not.toHaveBeenCalled();
expect(last().querySelector('.cbm-chat-answer-text')?.textContent).toContain('Meintest du: Aufrufer von JSONBAgg?');
- await click('Show the list');
+ // A German suggestion offers its choices in German too.
+ expect([...last().querySelectorAll('button.cbm-chat-retry')].map(item => item.textContent)).toEqual(['Liste anzeigen', 'Modell fragen']);
+ await click('Liste anzeigen');
expect(runtime.chat).not.toHaveBeenCalled();
expect(last().querySelector('.cbm-chat-answer-text')?.textContent).toContain('Aufrufer von JSONBAgg im geladenen Graphen');
for (const name of JSONB_AGG_CALLERS) expect(last().textContent).toContain(name);
await type('jsonbagg calls'); await click('Send ↑');
expect(last().querySelector('.cbm-chat-answer-text')?.textContent).toContain('Did you mean: what JSONBAgg calls?');
+ expect([...last().querySelectorAll('button.cbm-chat-retry')].map(item => item.textContent)).toEqual(['Show the list', 'Ask the model']);
await click('Ask the model');
expect(runtime.chat).toHaveBeenCalledOnce();
const request = runtime.chat.mock.calls[0][0];
diff --git a/graph-ui/src/browser-ai/BrowserChatDock.tsx b/graph-ui/src/browser-ai/BrowserChatDock.tsx
index 6c23a9474..8b940d852 100644
--- a/graph-ui/src/browser-ai/BrowserChatDock.tsx
+++ b/graph-ui/src/browser-ai/BrowserChatDock.tsx
@@ -532,7 +532,7 @@ export default function BrowserChatDock({ proactiveSelection, selectionScope = "
const listed = !retry && !source ? relationshipAnswer(prompt, [...currentGraph, ...extra]) : undefined;
if (listed) {
const id = `local-turn-${crypto.randomUUID()}`;
- setTurns(previous => [...previous, { id, prompt, context: extra, topic, listedFrom: listed.context,
+ setTurns(previous => [...previous, { id, prompt, context: extra, topic, listedFrom: listed.context, replyLanguage: listed.language,
evidence: prepareExplanationContext(undefined, listed.context, chatEvidence, knownSource(listed.context)), modelId: model.id, request: [],
answer: listed.markdown, status: 'complete', answeredFrom: 'graph' }]);
consume(); listSource(id, listed.context);
@@ -542,7 +542,7 @@ export default function BrowserChatDock({ proactiveSelection, selectionScope = "
const suggested = !retry && !source ? relationshipSuggestion(prompt, [...currentGraph, ...extra]) : undefined;
if (suggested) {
const id = `local-turn-${crypto.randomUUID()}`;
- setTurns(previous => [...previous, { id, prompt, context: extra, topic,
+ setTurns(previous => [...previous, { id, prompt, context: extra, topic, replyLanguage: suggested.language,
evidence: prepareExplanationContext(undefined, suggested.context, chatEvidence, knownSource(suggested.context)), modelId: model.id, request: [],
answer: suggested.markdown, status: 'complete', answeredFrom: 'suggestion', suggestion: { question: suggested.question, context: suggested.context } }]);
consume(); listSource(id, suggested.context);
@@ -631,7 +631,7 @@ export default function BrowserChatDock({ proactiveSelection, selectionScope = "
const showSuggestedList = (turn: ChatTurn): void => {
const listed = turn.suggestion && relationshipAnswer(turn.suggestion.question, [turn.suggestion.context]);
if (!listed) return;
- setTurns(previous => previous.map(item => item.id === turn.id ? { ...item, answer: listed.markdown, answeredFrom: 'graph', suggestion: undefined, listedFrom: listed.context,
+ setTurns(previous => previous.map(item => item.id === turn.id ? { ...item, answer: listed.markdown, answeredFrom: 'graph', suggestion: undefined, listedFrom: listed.context, replyLanguage: listed.language,
evidence: prepareExplanationContext(undefined, listed.context, chatEvidence, knownSource(listed.context)) } : item));
listSource(turn.id, listed.context);
};
@@ -728,7 +728,7 @@ export default function BrowserChatDock({ proactiveSelection, selectionScope = "
: manualRequest.current ? 'This selection will be explained after your answer.' : 'Preparing explanation…'}</p>}
</section>}
{turns.length === 0 && !(proactive && automatic && selected) && <div className="cbm-chat-empty"><span aria-hidden="true">⌁</span><h3>Ask about the code.</h3><p>{readerContext ? 'The current file is included automatically. Mark code to focus your next message on that exact selection.' : 'Ask a question, or add source and graph context to your next message.'}</p></div>}
- {turns.map((turn, index) => <article className="cbm-chat-turn" key={turn.id}>
+ {turns.map((turn, index) => { const replyWords = relationshipWords[turn.replyLanguage === 'de' ? 'de' : 'en']; return <article className="cbm-chat-turn" key={turn.id}>
{turn.topic && index > 0 && turn.topic.key !== turns.slice(0, index).reverse().find(item => item.topic)?.topic?.key
&& <p className="cbm-chat-topic-break">{browserChatText.topicBreak(turn.topic.label)}</p>}
<div className="cbm-chat-question"><span className="cbm-chat-speaker">You</span><ChatMarkdown text={turn.prompt} /></div>
@@ -746,10 +746,10 @@ export default function BrowserChatDock({ proactiveSelection, selectionScope = "
unsupported={turn.answer ? namesNotIn(turn.answer, turn.request.map(message => message.content).join('\n')) : []} model={BROWSER_MODELS.find(candidate => candidate.id === turn.modelId)?.displayName ?? turn.modelId} historyOmitted={turn.historyOmitted} />}
{turn.status === 'error' && <p className="cbm-chat-turn-error" role="alert">{turn.error}</p>}
{index === turns.length - 1 && turn.answeredFrom === 'suggestion' && turn.suggestion && <button type="button" className="cbm-chat-retry"
- onClick={() => showSuggestedList(turn)}>{relationshipWords.en.showList}</button>}
- {index === turns.length - 1 && turn.status !== 'generating' && turn.answeredFrom !== 'local' && <button type="button" className="cbm-chat-retry" disabled={phase !== 'ready'} onClick={() => { void send(turn); }}>{turn.answeredFrom ? browserChatText.askModel : 'Retry'}</button>}
+ onClick={() => showSuggestedList(turn)}>{replyWords.showList}</button>}
+ {index === turns.length - 1 && turn.status !== 'generating' && turn.answeredFrom !== 'local' && <button type="button" className="cbm-chat-retry" disabled={phase !== 'ready'} onClick={() => { void send(turn); }}>{turn.answeredFrom ? replyWords.askModel : 'Retry'}</button>}
</div>
- </article>)}
+ </article>; })}
</div>}
{newOutput && <button type="button" className="cbm-chat-jump" onClick={() => { followOutput.current = true; setNewOutput(false); if (transcript.current) transcript.current.scrollTop = transcript.current.scrollHeight; }}>Latest answer ↓</button>}
{newExplanation && proactive && automatic && selected && <button type="button" className="cbm-chat-jump" onClick={() => { followExplanation.current = true; setNewExplanation(false); if (transcript.current) transcript.current.scrollTop = 0; }}>Current selection ↑</button>}
diff --git a/graph-ui/src/browser-ai/chat-model.ts b/graph-ui/src/browser-ai/chat-model.ts
index 51df841e9..f1e7224b9 100644
--- a/graph-ui/src/browser-ai/chat-model.ts
+++ b/graph-ui/src/browser-ai/chat-model.ts
@@ -51,6 +51,8 @@ export interface BrowserChatTurn {
/** The graph evidence a listed answer was listed from: asking the model about it reads
* the same selection's source (K14). */
listedFrom?: BrowserChatContext;
+ /** The language of a listed answer or suggestion, which follows the question; its buttons follow it too. */
+ replyLanguage?: 'en' | 'de';
/** Earlier turns left out of this request to fit the input limit. */
historyOmitted?: number;
/** What the question was about; undefined for a question without context. */
diff --git a/graph-ui/src/browser-ai/strings.ts b/graph-ui/src/browser-ai/strings.ts
index 04eadac25..3e9d9db88 100644
--- a/graph-ui/src/browser-ai/strings.ts
+++ b/graph-ui/src/browser-ai/strings.ts
@@ -72,6 +72,8 @@ const englishRelationshipWords = {
didYouMean: (side: 'incoming' | 'outgoing', name: string) => side === 'incoming' ? `Did you mean: callers of ${name}?` : `Did you mean: what ${name} calls?`,
uncertain: 'The question was not recognized for certain. Show the list from the indexed graph, or ask the model instead.',
showList: 'Show the list',
+ /** Offered under a listed answer or a suggestion, which the model did not write. */
+ askModel: 'Ask the model',
};
export type RelationshipWords = typeof englishRelationshipWords;
@@ -116,6 +118,7 @@ export const relationshipWords: { en: RelationshipWords; de: RelationshipWords }
didYouMean: (side: 'incoming' | 'outgoing', name: string) => side === 'incoming' ? `Meintest du: Aufrufer von ${name}?` : `Meintest du: von ${name} aufgerufene Symbole?`,
uncertain: 'Die Frage wurde nicht sicher erkannt. Zeige die Liste aus dem indizierten Graphen oder frage stattdessen das Modell.',
showList: 'Liste anzeigen',
+ askModel: 'Modell fragen',
},
};
@@ -149,8 +152,6 @@ export const browserChatText = {
readingFacts: 'Listing the facts…',
/** Above the first question about another file or selection (K17). */
topicBreak: (label: string) => `New topic: ${label}. Earlier messages are not sent with these questions.`,
- /** Offered under a listed answer, which the model did not write. */
- askModel: 'Ask the model',
capacity: (nodes: number, edges: number, model: string, shown: number) =>
`${nodes} nodes / ${edges} edges: too large for the local ${model} model; showing ${shown}`,
historyTrimmed: (count: number) => `${count} earlier ${count === 1 ? 'message was' : 'messages were'} left out to fit the input limit.`,