Skip to content

Commit fb016a0

Browse files
committed
refactor: remove legacy 1m context checkbox
Change-Id: Iead205d3947c3e0bf53f2e44bb75fdfb4ac9a65e Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 579cf2a commit fb016a0

File tree

9 files changed

+10
-72
lines changed

9 files changed

+10
-72
lines changed

src/browser/components/ChatInput/useCreationWorkspace.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ function createDraftSettingsHarness(
301301
model: "gpt-4",
302302
thinkingLevel: "medium",
303303
mode: "exec",
304-
use1M: false,
305304
runtimeMode: state.runtimeMode,
306305
sshHost: state.sshHost,
307306
trunkBranch: state.trunkBranch,

src/browser/components/ChatMetaSidebar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import { cn } from "@/common/lib/utils";
33
import { usePersistedState } from "@/browser/hooks/usePersistedState";
44
import { useWorkspaceUsage } from "@/browser/stores/WorkspaceStore";
5-
import { use1MContext } from "@/browser/hooks/use1MContext";
5+
import { useProviderOptions } from "@/browser/hooks/useProviderOptions";
66
import { useResizeObserver } from "@/browser/hooks/useResizeObserver";
77
import { CostsTab } from "./RightSidebar/CostsTab";
88
import { VerticalTokenMeter } from "./RightSidebar/VerticalTokenMeter";
@@ -15,7 +15,8 @@ interface ChatMetaSidebarProps {
1515

1616
const ChatMetaSidebarComponent: React.FC<ChatMetaSidebarProps> = ({ workspaceId, chatAreaRef }) => {
1717
const usage = useWorkspaceUsage(workspaceId);
18-
const [use1M] = use1MContext();
18+
const { options } = useProviderOptions();
19+
const use1M = options.anthropic?.use1MContext ?? false;
1920
const chatAreaSize = useResizeObserver(chatAreaRef);
2021

2122
const lastUsage = usage?.usageHistory[usage.usageHistory.length - 1];

src/browser/components/Context1MCheckbox.tsx

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/browser/components/RightSidebar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { usePersistedState } from "@/browser/hooks/usePersistedState";
33
import { useWorkspaceUsage } from "@/browser/stores/WorkspaceStore";
4-
import { use1MContext } from "@/browser/hooks/use1MContext";
4+
import { useProviderOptions } from "@/browser/hooks/useProviderOptions";
55
import { useResizeObserver } from "@/browser/hooks/useResizeObserver";
66
import { CostsTab } from "./RightSidebar/CostsTab";
77
import { VerticalTokenMeter } from "./RightSidebar/VerticalTokenMeter";
@@ -124,7 +124,8 @@ const RightSidebarComponent: React.FC<RightSidebarProps> = ({
124124
}, [setSelectedTab, selectedTab]);
125125

126126
const usage = useWorkspaceUsage(workspaceId);
127-
const [use1M] = use1MContext();
127+
const { options } = useProviderOptions();
128+
const use1M = options.anthropic?.use1MContext ?? false;
128129
const chatAreaSize = useResizeObserver(chatAreaRef);
129130

130131
const baseId = `right-sidebar-${workspaceId}`;

src/browser/components/RightSidebar/CostsTab.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getModelStats } from "@/common/utils/tokens/modelStats";
44
import { sumUsageHistory } from "@/common/utils/tokens/usageAggregator";
55
import { usePersistedState } from "@/browser/hooks/usePersistedState";
66
import { ToggleGroup, type ToggleOption } from "../ToggleGroup";
7-
import { use1MContext } from "@/browser/hooks/use1MContext";
7+
import { useProviderOptions } from "@/browser/hooks/useProviderOptions";
88
import { supports1MContext } from "@/common/utils/ai/models";
99
import { TOKEN_COMPONENT_COLORS } from "@/common/utils/tokens/tokenMeterUtils";
1010
import { ConsumerBreakdown } from "./ConsumerBreakdown";
@@ -59,7 +59,8 @@ const CostsTabComponent: React.FC<CostsTabProps> = ({ workspaceId }) => {
5959
const usage = useWorkspaceUsage(workspaceId);
6060
const consumers = useWorkspaceConsumers(workspaceId);
6161
const [viewMode, setViewMode] = usePersistedState<ViewMode>("costsTab:viewMode", "session");
62-
const [use1M] = use1MContext();
62+
const { options } = useProviderOptions();
63+
const use1M = options.anthropic?.use1MContext ?? false;
6364

6465
// Check if we have any data to display
6566
const hasUsageData = usage && usage.usageHistory.length > 0;

src/browser/hooks/use1MContext.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/browser/hooks/useDraftWorkspaceSettings.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useEffect } from "react";
22
import { usePersistedState } from "./usePersistedState";
3-
import { use1MContext } from "./use1MContext";
43
import { useThinkingLevel } from "./useThinkingLevel";
54
import { useMode } from "@/browser/contexts/ModeContext";
65
import { useModelLRU } from "./useModelLRU";
@@ -27,7 +26,6 @@ export interface DraftWorkspaceSettings {
2726
model: string;
2827
thinkingLevel: ThinkingLevel;
2928
mode: UIMode;
30-
use1M: boolean;
3129

3230
// Workspace creation settings (project-specific)
3331
runtimeMode: RuntimeMode;
@@ -55,7 +53,6 @@ export function useDraftWorkspaceSettings(
5553
getRuntimeString: () => string | undefined;
5654
} {
5755
// Global AI settings (read-only from global state)
58-
const [use1M] = use1MContext();
5956
const [thinkingLevel] = useThinkingLevel();
6057
const [mode] = useMode();
6158
const { recentModels } = useModelLRU();
@@ -108,7 +105,6 @@ export function useDraftWorkspaceSettings(
108105
model,
109106
thinkingLevel,
110107
mode,
111-
use1M,
112108
runtimeMode,
113109
sshHost,
114110
trunkBranch,

src/browser/hooks/useSendMessageOptions.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { use1MContext } from "./use1MContext";
21
import { useThinkingLevel } from "./useThinkingLevel";
32
import { useMode } from "@/browser/contexts/ModeContext";
43
import { usePersistedState } from "./usePersistedState";
@@ -21,7 +20,6 @@ function constructSendMessageOptions(
2120
mode: UIMode,
2221
thinkingLevel: ThinkingLevel,
2322
preferredModel: string | null | undefined,
24-
use1M: boolean,
2523
providerOptions: MuxProviderOptions,
2624
fallbackModel: string
2725
): SendMessageOptions {
@@ -40,13 +38,7 @@ function constructSendMessageOptions(
4038
mode: mode === "exec" || mode === "plan" ? mode : "exec", // Only pass exec/plan to backend
4139
toolPolicy: modeToToolPolicy(mode),
4240
additionalSystemInstructions,
43-
providerOptions: {
44-
...providerOptions,
45-
anthropic: {
46-
...providerOptions.anthropic,
47-
use1MContext: use1M,
48-
},
49-
},
41+
providerOptions,
5042
};
5143
}
5244

@@ -61,7 +53,6 @@ function constructSendMessageOptions(
6153
* propagate automatically to all components using this hook.
6254
*/
6355
export function useSendMessageOptions(workspaceId: string): SendMessageOptions {
64-
const [use1M] = use1MContext();
6556
const [thinkingLevel] = useThinkingLevel();
6657
const [mode] = useMode();
6758
const { options: providerOptions } = useProviderOptions();
@@ -76,7 +67,6 @@ export function useSendMessageOptions(workspaceId: string): SendMessageOptions {
7667
mode,
7768
thinkingLevel,
7869
preferredModel,
79-
use1M,
8070
providerOptions,
8171
recentModels[0]
8272
);

src/common/constants/storage.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,6 @@ export function getTrunkBranchKey(projectPath: string): string {
108108
return `trunkBranch:${projectPath}`;
109109
}
110110

111-
/**
112-
* Get the localStorage key for the 1M context preference (global)
113-
* Format: "use1MContext"
114-
*/
115-
export const USE_1M_CONTEXT_KEY = "use1MContext";
116-
117111
/**
118112
* Get the localStorage key for the preferred compaction model (global)
119113
* Format: "preferredCompactionModel"

0 commit comments

Comments
 (0)