Skip to content

Commit 05ce4b6

Browse files
authored
🤖 fix: only show 1M context checkbox for supported models (#739)
The 1M context window checkbox was appearing for all Anthropic models (including Opus) but it's only supported for Claude Sonnet 4 and 4.5. - Changed `ModelSettings` prop from `provider` to full `model` string - Now uses `supports1MContext()` to determine checkbox visibility _Generated with `mux`_
1 parent 3e8ffb8 commit 05ce4b6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/browser/components/ChatInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
871871
</div>
872872

873873
<div className="ml-4 flex items-center" data-component="ModelSettingsGroup">
874-
<ModelSettings provider={(preferredModel || "").split(":")[0]} />
874+
<ModelSettings model={preferredModel || ""} />
875875
</div>
876876

877877
{preferredModel && (

src/browser/components/ModelSettings.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from "react";
22
import { useProviderOptions } from "@/browser/hooks/useProviderOptions";
3+
import { supports1MContext } from "@/common/utils/ai/models";
34
import { TooltipWrapper, Tooltip } from "./Tooltip";
45

56
interface ModelSettingsProps {
6-
provider: string;
7+
model: string;
78
}
89

9-
export const ModelSettings: React.FC<ModelSettingsProps> = ({ provider }) => {
10+
export const ModelSettings: React.FC<ModelSettingsProps> = (props) => {
1011
const { options, setAnthropicOptions, setOpenAIOptions } = useProviderOptions();
1112

1213
const renderOption = (
@@ -35,7 +36,8 @@ export const ModelSettings: React.FC<ModelSettingsProps> = ({ provider }) => {
3536
</div>
3637
);
3738

38-
if (provider === "anthropic") {
39+
// 1M context is only available for specific Anthropic models (Sonnet 4/4.5)
40+
if (supports1MContext(props.model)) {
3941
return renderOption(
4042
"anthropic-1m",
4143
"1M",
@@ -45,6 +47,7 @@ export const ModelSettings: React.FC<ModelSettingsProps> = ({ provider }) => {
4547
);
4648
}
4749

50+
const provider = props.model.split(":")[0];
4851
if (provider === "openai") {
4952
if (import.meta.env.DEV) {
5053
return renderOption(

0 commit comments

Comments
 (0)