2026-02-05 00:07:24 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
import { useConfigStore } from '@/stores/useConfigStore';
|
|
|
|
|
import { getModelDisplayName } from './mobileControlsUtils';
|
2026-06-09 00:01:38 +03:00
|
|
|
import { useI18n } from '@/lib/i18n';
|
2026-02-05 00:07:24 +08:00
|
|
|
|
|
|
|
|
interface MobileModelButtonProps {
|
|
|
|
|
onOpenModel: () => void;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const MobileModelButton: React.FC<MobileModelButtonProps> = ({ onOpenModel, className }) => {
|
2026-06-09 00:01:38 +03:00
|
|
|
const { t } = useI18n();
|
2026-04-04 02:19:55 +03:00
|
|
|
const currentModelId = useConfigStore((state) => state.currentModelId);
|
|
|
|
|
const getCurrentProvider = useConfigStore((state) => state.getCurrentProvider);
|
2026-02-05 00:07:24 +08:00
|
|
|
const currentProvider = getCurrentProvider();
|
2026-06-09 00:01:38 +03:00
|
|
|
const modelLabel = getModelDisplayName(currentProvider, currentModelId, t('chat.modelControls.selectModel'));
|
2026-02-05 00:07:24 +08:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={onOpenModel}
|
|
|
|
|
className={cn(
|
|
|
|
|
'inline-flex min-w-0 items-center justify-center',
|
|
|
|
|
'rounded-lg border border-border/50 px-1.5',
|
|
|
|
|
'typography-micro font-medium text-foreground/80',
|
|
|
|
|
'focus:outline-none hover:bg-[var(--interactive-hover)]',
|
|
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
style={{ height: '26px', maxHeight: '26px', minHeight: '26px' }}
|
|
|
|
|
title={modelLabel}
|
|
|
|
|
>
|
2026-02-07 06:30:08 -03:00
|
|
|
<span className="min-w-0 max-w-full overflow-x-auto whitespace-nowrap scrollbar-hidden">
|
|
|
|
|
{modelLabel}
|
|
|
|
|
</span>
|
2026-02-05 00:07:24 +08:00
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
};
|