Session-Level Conversation History Management (#1113)

This commit is contained in:
tanzhenxin 2025-12-03 18:04:48 +08:00 committed by GitHub
parent a7abd8d09f
commit 0a75d85ac9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
114 changed files with 9257 additions and 4039 deletions

View file

@ -67,7 +67,7 @@ export const Help: React.FC<Help> = ({ commands }) => (
<Text color={theme.text.primary}>
<Text bold color={theme.text.accent}>
{' '}
/{command.name}
{formatCommandLabel(command, '/')}
</Text>
{command.kind === CommandKind.MCP_PROMPT && (
<Text color={theme.text.secondary}> [MCP]</Text>
@ -81,7 +81,7 @@ export const Help: React.FC<Help> = ({ commands }) => (
<Text key={subCommand.name} color={theme.text.primary}>
<Text bold color={theme.text.accent}>
{' '}
{subCommand.name}
{formatCommandLabel(subCommand)}
</Text>
{subCommand.description && ' - ' + subCommand.description}
</Text>
@ -171,3 +171,17 @@ export const Help: React.FC<Help> = ({ commands }) => (
</Text>
</Box>
);
/**
* Builds a display label for a slash command, including any alternate names.
*/
function formatCommandLabel(command: SlashCommand, prefix = ''): string {
const altNames = command.altNames?.filter(Boolean);
const baseLabel = `${prefix}${command.name}`;
if (!altNames || altNames.length === 0) {
return baseLabel;
}
return `${baseLabel} (${altNames.join(', ')})`;
}