/** * 提示词侧边栏 - 简洁风格 */ import type { RoleType, SharedModuleType } from '../types/api'; import type { SelectionType } from '../hooks/usePrompts'; import { useI18n } from '../i18n'; // ============================================================================ // 配置 // ============================================================================ interface Props { selection: SelectionType; onSelect: (sel: SelectionType) => void; } export function PromptSidebar({ selection, onSelect }: Props) { const { t } = useI18n(); const roleLabels: Record = { problemFraming: t('prompts.role.problemFraming'), conceptDesigner: t('prompts.role.conceptDesigner'), codeGeneration: t('prompts.role.codeGeneration'), codeRetry: t('prompts.role.codeRetry'), codeEdit: t('prompts.role.codeEdit') }; const sharedLabels: Record = { apiIndex: t('prompts.shared.apiIndex'), specification: t('prompts.shared.specification') }; const isRoleSelected = (role: RoleType, promptType: 'system' | 'user') => selection.kind === 'role' && selection.role === role && selection.promptType === promptType; const isSharedSelected = (module: SharedModuleType) => selection.kind === 'shared' && selection.module === module; return (
{/* 角色提示词 */}

{t('prompts.roleSection')}

{(Object.keys(roleLabels) as RoleType[]).map(role => (
{/* 角色名 */}
{roleLabels[role]}
{/* System / User 按钮 */}
))}
{/* 分隔线 */}
{/* 共享模块 */}

{t('prompts.sharedSection')}

{(Object.keys(sharedLabels) as SharedModuleType[]).map(module => ( ))}
); }