Skip to content

Commit 827fd6c

Browse files
connor4312Copilot
andauthored
agent-host: route long question text through detailedMessage (#317650)
* agent-host: route long question text through detailedMessage Long elicitation prompts from the agent host were being placed into the question title/description, causing the question carousel header to grow tall and squeeze out the scrollable input area. Route the long body through detailedMessage (rendered inside the scrollable container) and keep the title short by splitting on the first newline when no explicit title is provided. Fixes #316544 (Commit message generated by Copilot) * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 86bd3e9 commit 827fd6c

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,13 +1790,22 @@ export class AgentHostSessionHandler extends Disposable implements IChatSessionC
17901790
}
17911791

17921792
const questions: IChatQuestion[] = (inputReq.questions ?? []).map((q): IChatQuestion => {
1793+
let title = q.title;
1794+
let message = q.message;
1795+
if (!title) {
1796+
const EOL = q.message.indexOf('\n');
1797+
title = EOL === -1 ? q.message : q.message.substring(0, EOL).trim();
1798+
message = EOL === -1 ? '' : q.message.substring(EOL + 1).trim();
1799+
}
1800+
const detailedMessage = new MarkdownString(message, { isTrusted: false });
1801+
17931802
switch (q.kind) {
17941803
case SessionInputQuestionKind.SingleSelect:
17951804
return {
17961805
id: q.id,
17971806
type: 'singleSelect',
1798-
title: q.title ?? q.message,
1799-
description: q.title !== undefined ? q.message : undefined,
1807+
title,
1808+
detailedMessage,
18001809
required: q.required,
18011810
allowFreeformInput: q.allowFreeformInput ?? true,
18021811
options: q.options.map(o => ({ id: o.id, label: o.label, value: o.id })),
@@ -1805,8 +1814,8 @@ export class AgentHostSessionHandler extends Disposable implements IChatSessionC
18051814
return {
18061815
id: q.id,
18071816
type: 'multiSelect',
1808-
title: q.title ?? q.message,
1809-
description: q.title !== undefined ? q.message : undefined,
1817+
title,
1818+
detailedMessage,
18101819
required: q.required,
18111820
allowFreeformInput: q.allowFreeformInput ?? true,
18121821
options: q.options.map(o => ({ id: o.id, label: o.label, value: o.id })),
@@ -1815,17 +1824,17 @@ export class AgentHostSessionHandler extends Disposable implements IChatSessionC
18151824
return {
18161825
id: q.id,
18171826
type: 'text',
1818-
title: q.title ?? q.message,
1819-
description: q.title !== undefined ? q.message : undefined,
1827+
title,
1828+
detailedMessage,
18201829
required: q.required,
18211830
defaultValue: q.defaultValue,
18221831
};
18231832
default:
18241833
return {
18251834
id: q.id,
18261835
type: 'text',
1827-
title: q.title ?? q.message,
1828-
description: q.title !== undefined ? q.message : undefined,
1836+
title,
1837+
detailedMessage,
18291838
required: q.required,
18301839
};
18311840
}
@@ -1932,6 +1941,7 @@ export class AgentHostSessionHandler extends Disposable implements IChatSessionC
19321941
}));
19331942
}
19341943

1944+
19351945
/**
19361946
* Handle a URL-style {@link SessionInputRequest} by rendering a
19371947
* {@link ChatElicitationRequestPart} that prompts the user to open the

0 commit comments

Comments
 (0)