Skip to content

Commit 62cae1f

Browse files
committed
extract title from prompt
1 parent 248ba94 commit 62cae1f

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/github/copilotRemoteAgent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ export class CopilotRemoteAgentManager extends Disposable {
712712
return { error: vscode.l10n.t('Failed to configure base branch \'{0}\' does not exist on the remote repository \'{1}/{2}\'. Please create the remote branch first.', base_ref, owner, repo), state: 'error' };
713713
}
714714

715-
const title = extractTitle(problemContext);
715+
const title = extractTitle(prompt, problemContext);
716716
const { problemStatement, isTruncated } = truncatePrompt(prompt, problemContext);
717717

718718
if (isTruncated) {

src/github/copilotRemoteAgentUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ export function truncatePrompt(prompt: string, context?: string): { problemState
4141
};
4242
}
4343

44-
export function extractTitle(context: string | undefined): string | undefined {
44+
export function extractTitle(prompt: string, context: string | undefined): string | undefined {
4545
if (!context) {
4646
return;
4747
}
4848
const titleMatch = context.match(/TITLE: \s*(.*)/i);
4949
if (titleMatch && titleMatch[1]) {
5050
return titleMatch[1].trim();
5151
}
52+
if (prompt.length <= 20) {
53+
return prompt;
54+
}
55+
return prompt.substring(0, 20) + '...';
5256
}
5357

5458
export function formatBodyPlaceholder(title: string | undefined): string {

0 commit comments

Comments
 (0)