mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-12 12:47:42 +02:00
[eric] free-trial: hide model picker + thinking selector only during trial (return on connect)
This commit is contained in:
@@ -8,6 +8,8 @@ import { ModelPickerMenu } from '../model-picker/ModelPickerMenu';
|
||||
import { ThinkingLevelControl } from './ThinkingLevelControl';
|
||||
import { ToolbarActions } from './ToolbarActions';
|
||||
import { ModelPickerState } from '../hooks/useModelPicker';
|
||||
import { useAppSelector } from '@/shared/hooks';
|
||||
import { hasFreeTrialActive, hasModelConnected } from '@/app/components/Onboarding/steps/skipPredicates';
|
||||
|
||||
type ThinkingLevel = 'off' | 'low' | 'medium' | 'high' | 'auto';
|
||||
|
||||
@@ -79,6 +81,11 @@ export const ChatInputToolbar: React.FC<Props> = (p) => {
|
||||
},
|
||||
};
|
||||
|
||||
// On the free trial the run is fixed (model + thinking forced server-side), so hide both
|
||||
// the model picker and the thinking selector, there's nothing to choose. Returns the moment
|
||||
// a real model is connected.
|
||||
const hideForTrial = useAppSelector((s) => hasFreeTrialActive(s) && !hasModelConnected(s));
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -138,16 +145,18 @@ export const ChatInputToolbar: React.FC<Props> = (p) => {
|
||||
pendingPayloadEstimate={pendingPayloadEstimate}
|
||||
/>
|
||||
|
||||
<ThinkingLevelControl
|
||||
c={c}
|
||||
model={model}
|
||||
allModelFlat={allModelFlat}
|
||||
thinkingLevel={thinkingLevel}
|
||||
onThinkingLevelChange={onThinkingLevelChange}
|
||||
thinkingAnchor={thinkingAnchor}
|
||||
setThinkingAnchor={setThinkingAnchor}
|
||||
menuPaperProps={menuPaperProps}
|
||||
/>
|
||||
{!hideForTrial && (
|
||||
<ThinkingLevelControl
|
||||
c={c}
|
||||
model={model}
|
||||
allModelFlat={allModelFlat}
|
||||
thinkingLevel={thinkingLevel}
|
||||
onThinkingLevelChange={onThinkingLevelChange}
|
||||
thinkingAnchor={thinkingAnchor}
|
||||
setThinkingAnchor={setThinkingAnchor}
|
||||
menuPaperProps={menuPaperProps}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Box sx={{ flex: 1 }} />
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import Typography from '@mui/material/Typography';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import { ClaudeTokens } from '@/shared/styles/claudeTokens';
|
||||
import { useAppSelector } from '@/shared/hooks';
|
||||
import { hasFreeTrialActive } from '@/app/components/Onboarding/steps/skipPredicates';
|
||||
import { hasFreeTrialActive, hasModelConnected } from '@/app/components/Onboarding/steps/skipPredicates';
|
||||
|
||||
interface ModeConf { label: string; icon: React.ReactNode; color: string }
|
||||
|
||||
@@ -31,8 +31,9 @@ export const ModeControl: React.FC<Props> = ({
|
||||
c, menuPaperProps, modeConf, modesArr, mode, onModeChange, iconMap, modeAnchor, setModeAnchor, setModelAnchor, allModelFlat, model,
|
||||
}) => {
|
||||
// On the free trial the model is fixed server-side, so there's nothing to pick: hide the
|
||||
// whole model control (no picker, no model name) until the user connects their own model.
|
||||
const freeTrialActive = useAppSelector(hasFreeTrialActive);
|
||||
// model control. The moment a real model is connected we show it again, even if trial state
|
||||
// lingers (gate on !hasModelConnected, not just the trial flag).
|
||||
const hideModelPicker = useAppSelector((s) => hasFreeTrialActive(s) && !hasModelConnected(s));
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@@ -92,7 +93,7 @@ export const ModeControl: React.FC<Props> = ({
|
||||
})}
|
||||
</Menu>
|
||||
|
||||
{!freeTrialActive && (
|
||||
{!hideModelPicker && (
|
||||
<Box
|
||||
onClick={(e) => setModelAnchor(e.currentTarget)}
|
||||
sx={{
|
||||
|
||||
Reference in New Issue
Block a user