Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/wait_pr_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ while true; do
exit 0
fi

# Check if PR is closed without merging
if [ "$PR_STATE" = "CLOSED" ]; then
echo "❌ PR #$PR_NUMBER is closed (not merged)!"
exit 1
fi

MERGEABLE=$(echo "$STATUS" | jq -r '.mergeable')
MERGE_STATE=$(echo "$STATUS" | jq -r '.mergeStateStatus')

Expand Down
7 changes: 1 addition & 6 deletions src/components/AIView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,7 @@ const AIViewInner: React.FC<AIViewProps> = ({
}

return (
<ChatProvider
messages={messages}
cmuxMessages={cmuxMessages}
model={currentModel}
workspaceId={workspaceId}
>
<ChatProvider messages={messages} cmuxMessages={cmuxMessages} model={currentModel}>
<ViewContainer className={className}>
<ChatArea>
<ViewHeader>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export const ChatInput: React.FC<ChatInputProps> = ({
const modelSelectorRef = useRef<ModelSelectorRef>(null);
const [thinkingLevel] = useThinkingLevel();
const [mode, setMode] = useMode();
const [use1M] = use1MContext(workspaceId);
const [use1M] = use1MContext();
const { recentModels } = useModelLRU();

const focusMessageInput = useCallback(() => {
Expand Down Expand Up @@ -763,7 +763,7 @@ export const ChatInput: React.FC<ChatInputProps> = ({
</EditingIndicator>
)}
<ModeTogglesRow>
<ChatToggles workspaceId={workspaceId} modelString={preferredModel}>
<ChatToggles modelString={preferredModel}>
<ModelDisplayWrapper>
<ModelSelector
ref={modelSelectorRef}
Expand Down
4 changes: 2 additions & 2 deletions src/components/ChatMetaSidebar/CostsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ const VIEW_MODE_OPTIONS: Array<ToggleOption<ViewMode>> = [
];

export const CostsTab: React.FC = () => {
const { stats, isCalculating, workspaceId } = useChatContext();
const { stats, isCalculating } = useChatContext();
const [viewMode, setViewMode] = usePersistedState<ViewMode>("costsTab:viewMode", "last-request");
const [use1M] = use1MContext(workspaceId);
const [use1M] = use1MContext();

// Only show loading if we don't have any stats yet
if (isCalculating && !stats) {
Expand Down
5 changes: 2 additions & 3 deletions src/components/ChatToggles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ export const TogglesContainer = styled.div`
`;

interface ChatTogglesProps {
workspaceId: string;
modelString: string;
children: React.ReactNode;
}

export const ChatToggles: React.FC<ChatTogglesProps> = ({ workspaceId, modelString, children }) => {
export const ChatToggles: React.FC<ChatTogglesProps> = ({ modelString, children }) => {
return (
<TogglesContainer>
{children}
<ThinkingSliderComponent />
<Context1MCheckbox workspaceId={workspaceId} modelString={modelString} />
<Context1MCheckbox modelString={modelString} />
</TogglesContainer>
);
};
8 changes: 2 additions & 6 deletions src/components/Context1MCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,11 @@ const Checkbox = styled.input`
`;

interface Context1MCheckboxProps {
workspaceId: string;
modelString: string;
}

export const Context1MCheckbox: React.FC<Context1MCheckboxProps> = ({
workspaceId,
modelString,
}) => {
const [use1M, setUse1M] = use1MContext(workspaceId);
export const Context1MCheckbox: React.FC<Context1MCheckboxProps> = ({ modelString }) => {
const [use1M, setUse1M] = use1MContext();
const isSupported = supports1MContext(modelString);

if (!isSupported) {
Expand Down
5 changes: 1 addition & 4 deletions src/contexts/ChatContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ interface ChatContextType {
messages: DisplayedMessage[];
stats: ChatStats | null;
isCalculating: boolean;
workspaceId: string;
}

const ChatContext = createContext<ChatContextType | undefined>(undefined);
Expand All @@ -18,15 +17,13 @@ interface ChatProviderProps {
messages: DisplayedMessage[];
cmuxMessages: CmuxMessage[];
model: string;
workspaceId: string;
}

export const ChatProvider: React.FC<ChatProviderProps> = ({
children,
messages,
cmuxMessages,
model,
workspaceId,
}) => {
const [stats, setStats] = useState<ChatStats | null>(null);
const [isCalculating, setIsCalculating] = useState(false);
Expand Down Expand Up @@ -91,7 +88,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
}, [cmuxMessages, model]);

return (
<ChatContext.Provider value={{ messages, stats, isCalculating, workspaceId }}>
<ChatContext.Provider value={{ messages, stats, isCalculating }}>
{children}
</ChatContext.Provider>
);
Expand Down
7 changes: 3 additions & 4 deletions src/hooks/use1MContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { usePersistedState } from "@/hooks/usePersistedState";

/**
* Custom hook for 1M context state.
* Persists state per workspace in localStorage.
* Persists state globally in localStorage (applies to all workspaces).
*
* @param workspaceId - Unique identifier for the workspace
* @returns [use1MContext, setUse1MContext] tuple
*/
export function use1MContext(workspaceId: string): [boolean, (value: boolean) => void] {
return usePersistedState<boolean>(`use1MContext:${workspaceId}`, false);
export function use1MContext(): [boolean, (value: boolean) => void] {
return usePersistedState<boolean>("use1MContext", false);
}