* feat: add dialog for "Start new session from this answer" Replace the one-click fork action on assistant messages with a dialog (ForkSessionDialog) that lets the user pick model, thinking level, and agent, plus edit the instructions sent to the new session. The instructions field is prefilled with the previous fixed fork prompt and is mandatory. The composed message is now fully visible (no synthetic preface): the user's instructions sit above a short fixed connective that opens the assistant content. createSessionFromAssistantMessage takes the chosen execution params instead of reading from config. Also fix TodoSendDialog visuals: narrower vertical layout, model trigger no longer stretches with centered text, and the agent/thinking dropdowns portal to body so opening them no longer nudges the dialog height. Extract the shared ThinkingPill into its own component. * fix: address review feedback on fork session dialog - Fix "bellow" -> "below" typo in the fork content preface (now user-visible since the message is no longer synthetic) - Reset ForkSessionDialog state only on open transition, reading the config store snapshot via getState() so background store refreshes can't discard in-progress instruction edits
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from '@/components/ui/dropdown-menu';
|
|
import { Icon } from '@/components/icon/Icon';
|
|
import { cn } from '@/lib/utils';
|
|
import { useI18n } from '@/lib/i18n';
|
|
|
|
export type ThinkingPillProps = {
|
|
value: string;
|
|
options: string[];
|
|
disabled?: boolean;
|
|
onChange: (value: string) => void;
|
|
};
|
|
|
|
export const ThinkingPill = ({ value, options, disabled, onChange }: ThinkingPillProps) => {
|
|
const { t } = useI18n();
|
|
const label = value || t('rightSidebar.contextNotesTodo.sendDialog.variant.default');
|
|
|
|
const trigger = (
|
|
<div
|
|
className={cn(
|
|
'flex h-6 w-fit items-center gap-1.5 rounded-lg border border-border/20 bg-interactive-selection/20 px-2',
|
|
disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer hover:bg-interactive-hover/30',
|
|
)}
|
|
>
|
|
<span className="typography-micro whitespace-nowrap font-medium capitalize">{label}</span>
|
|
<Icon name="arrow-down-s" className="h-3 w-3 flex-shrink-0 text-muted-foreground" />
|
|
</div>
|
|
);
|
|
|
|
if (disabled) return trigger;
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="start" className="max-w-[220px]" portalToBody>
|
|
<DropdownMenuItem className="typography-meta" onSelect={() => onChange('')}>
|
|
<span className={cn('font-medium', !value && 'text-primary')}>
|
|
{t('rightSidebar.contextNotesTodo.sendDialog.variant.default')}
|
|
</span>
|
|
</DropdownMenuItem>
|
|
{options.map((option) => (
|
|
<DropdownMenuItem
|
|
key={option}
|
|
className="typography-meta"
|
|
onSelect={() => onChange(option)}
|
|
>
|
|
<span className={cn('font-medium capitalize', value === option && 'text-primary')}>
|
|
{option}
|
|
</span>
|
|
</DropdownMenuItem>
|
|
))}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
);
|
|
};
|