378
this._logService.warn('[AgentHostSessionTitleController] Failed to generate session title', err);
379
return undefined;
381
>
cancellationListener.dispose();
382
>
}
383
}
384
385
private _buildTitlePrompt(promptContent: string, isConversation: boolean): ICopilotUtilityChatMessage[] {
387
? `Please write a brief title for the following conversation:\n\n${promptContent}`
388
: `Please write a brief title for the following request:\n\n${promptContent}`;
390
>
{
391
>
role: 'system',
392
>
content: [
393
>
'You are an expert in crafting ultra-compact titles for chatbot conversations.',
394
>
'You are presented with a chat request or conversation, and you reply with only a brief title that captures the main topic.',
395
>
'Write the title in sentence case, not title case.',
396
>
'Preserve product names, abbreviations, code symbols, and proper nouns.',
397
>
'Aim for 3-6 words. Prefer the shortest accurate title.',
398
>
'Drop articles like "a", "an", and "the" unless needed for clarity.',
399
>
'Drop filler and generic framing like "help with", "question about", "request for", or "issue with".',
400
>
'Never describe the chat itself as forked, branched, or continued — title only the underlying topic.',
401
>
'Prefer short, concrete synonyms and omit unnecessary words.',
402
>
'Do not wrap the title in quotes or add trailing punctuation.',
403
>
].join(' '),
404
>
},
405
>
{
406
>
role: 'user',
407
>
content: userInstruction,
408
>
},
409
>
];
410
>
}
411
412
private _cleanTitle(rawTitle: string): string | undefined {