fix picker
This commit is contained in:
1 parent
87668ec2b7
commit
163025b615
7 files changed
+328
-209
No files matched your search
@@ -126,7 +126,7 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
|
||||
{ value: "medium", label: "Medium" },
|
||||
{ value: "high", label: "High", isDefault: true },
|
||||
],
|
||||
supportsFastMode: false,
|
||||
supportsFastMode: true,
|
||||
supportsThinkingToggle: true,
|
||||
contextWindowOptions: [
|
||||
{ value: "200k", label: "200k", isDefault: true },
|
||||
|
||||
@@ -628,48 +628,84 @@ describe("TraitsPicker (Codex)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── OpenCode TraitsPicker tests ───────────────────────────────────────
|
||||
// ── Cursor TraitsPicker tests ─────────────────────────────────────────
|
||||
|
||||
async function mountOpenCodePicker(props: { model?: string; options?: OpenCodeModelOptions }) {
|
||||
const threadId = ThreadId.make("thread-opencode-traits");
|
||||
const threadRef = scopeThreadRef(LOCAL_ENVIRONMENT_ID, threadId);
|
||||
const threadKey = scopedThreadKey(threadRef);
|
||||
const model = props.model ?? DEFAULT_MODEL_BY_PROVIDER.opencode;
|
||||
const draftsByThreadKey: Record<string, ComposerThreadDraftState> = {
|
||||
[threadKey]: {
|
||||
async function mountCursorPicker(props?: {
|
||||
model?: string;
|
||||
options?: CursorModelOptions;
|
||||
models?: ServerProvider["models"];
|
||||
}) {
|
||||
const threadId = ThreadId.makeUnsafe("thread-cursor-traits");
|
||||
const model = props?.model ?? "gpt-5.4";
|
||||
const cursorProvider = {
|
||||
provider: "cursor",
|
||||
enabled: true,
|
||||
installed: true,
|
||||
version: "0.1.0",
|
||||
status: "ready",
|
||||
authStatus: "authenticated",
|
||||
checkedAt: "2026-01-01T00:00:00.000Z",
|
||||
models: props?.models ?? [
|
||||
{
|
||||
slug: "gpt-5.4",
|
||||
name: "GPT-5.4",
|
||||
isCustom: false,
|
||||
capabilities: {
|
||||
reasoningEffortLevels: [
|
||||
{ value: "low", label: "Low" },
|
||||
{ value: "medium", label: "Medium", isDefault: true },
|
||||
{ value: "high", label: "High" },
|
||||
{ value: "xhigh", label: "Extra High" },
|
||||
],
|
||||
supportsFastMode: true,
|
||||
supportsThinkingToggle: false,
|
||||
contextWindowOptions: [
|
||||
{ value: "272k", label: "272k", isDefault: true },
|
||||
{ value: "1m", label: "1M" },
|
||||
],
|
||||
promptInjectedEffortLevels: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
} satisfies ServerProvider;
|
||||
|
||||
const draftsByThreadId: Record<ThreadId, ComposerThreadDraftState> = {
|
||||
[threadId]: {
|
||||
prompt: "",
|
||||
images: [],
|
||||
nonPersistedImageIds: [],
|
||||
persistedAttachments: [],
|
||||
terminalContexts: [],
|
||||
modelSelectionByProvider: {
|
||||
opencode: {
|
||||
provider: "opencode",
|
||||
cursor: {
|
||||
provider: "cursor",
|
||||
model,
|
||||
...(props.options ? { options: props.options } : {}),
|
||||
...(props?.options ? { options: props.options } : {}),
|
||||
},
|
||||
},
|
||||
activeProvider: "opencode",
|
||||
activeProvider: "cursor",
|
||||
runtimeMode: null,
|
||||
interactionMode: null,
|
||||
},
|
||||
};
|
||||
|
||||
useComposerDraftStore.setState({
|
||||
draftsByThreadKey,
|
||||
draftThreadsByThreadKey: {},
|
||||
logicalProjectDraftThreadKeyByLogicalProjectKey: {},
|
||||
draftsByThreadId,
|
||||
draftThreadsByThreadId: {},
|
||||
projectDraftThreadIdByProjectId: {
|
||||
[ProjectId.makeUnsafe("project-cursor-traits")]: threadId,
|
||||
},
|
||||
});
|
||||
const host = document.createElement("div");
|
||||
document.body.append(host);
|
||||
const screen = await render(
|
||||
<TraitsPicker
|
||||
provider="opencode"
|
||||
models={findTestProvider("opencode").models}
|
||||
threadRef={threadRef}
|
||||
provider="cursor"
|
||||
models={cursorProvider.models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
prompt=""
|
||||
modelOptions={props.options}
|
||||
modelOptions={props?.options}
|
||||
onPromptChange={() => {}}
|
||||
/>,
|
||||
{ container: host },
|
||||
@@ -686,97 +722,117 @@ async function mountOpenCodePicker(props: { model?: string; options?: OpenCodeMo
|
||||
};
|
||||
}
|
||||
|
||||
describe("TraitsPicker (OpenCode)", () => {
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
localStorage.removeItem(COMPOSER_DRAFT_STORAGE_KEY);
|
||||
useComposerDraftStore.setState({
|
||||
draftsByThreadKey: {},
|
||||
draftThreadsByThreadKey: {},
|
||||
logicalProjectDraftThreadKeyByLogicalProjectKey: {},
|
||||
stickyModelSelectionByProvider: {},
|
||||
});
|
||||
});
|
||||
|
||||
it("shows the selected agent label with capitalization in the trigger", async () => {
|
||||
await using _ = await mountOpenCodePicker({
|
||||
options: {
|
||||
variant: "medium",
|
||||
agent: "plan",
|
||||
},
|
||||
});
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Medium · Plan");
|
||||
expect(text).not.toContain("Medium · plan");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("TraitsPicker (Cursor)", () => {
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
localStorage.removeItem(COMPOSER_DRAFT_STORAGE_KEY);
|
||||
useComposerDraftStore.setState({
|
||||
draftsByThreadKey: {},
|
||||
draftThreadsByThreadKey: {},
|
||||
logicalProjectDraftThreadKeyByLogicalProjectKey: {},
|
||||
draftsByThreadId: {},
|
||||
draftThreadsByThreadId: {},
|
||||
projectDraftThreadIdByProjectId: {},
|
||||
stickyModelSelectionByProvider: {},
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the selected fast mode menu label for the trigger in fast-only state", async () => {
|
||||
it("shows the selected Cursor context window in the trigger label", async () => {
|
||||
await using _ = await mountCursorPicker({
|
||||
options: { contextWindow: "1m" },
|
||||
});
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(document.body.textContent ?? "").toContain("Medium · 1M");
|
||||
});
|
||||
});
|
||||
|
||||
it("persists Cursor context window changes", async () => {
|
||||
await using _ = await mountCursorPicker();
|
||||
|
||||
await page.getByRole("button").click();
|
||||
await page.getByRole("menuitemradio", { name: "1M" }).click();
|
||||
|
||||
expect(useComposerDraftStore.getState().stickyModelSelectionByProvider.cursor).toMatchObject({
|
||||
provider: "cursor",
|
||||
model: "gpt-5.4",
|
||||
options: {
|
||||
contextWindow: "1m",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("does not render for models with no trait capabilities", async () => {
|
||||
await using _ = await mountCursorPicker({
|
||||
model: "default",
|
||||
models: [
|
||||
{
|
||||
slug: "default",
|
||||
name: "Auto",
|
||||
isCustom: false,
|
||||
capabilities: {
|
||||
reasoningEffortLevels: [],
|
||||
supportsFastMode: false,
|
||||
supportsThinkingToggle: false,
|
||||
contextWindowOptions: [],
|
||||
promptInjectedEffortLevels: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(document.querySelector("button")).toBeNull();
|
||||
});
|
||||
|
||||
it("renders for fast-only Cursor models with a usable label", async () => {
|
||||
await using _ = await mountCursorPicker({
|
||||
model: "composer-2",
|
||||
options: { fastMode: false },
|
||||
models: [
|
||||
{
|
||||
slug: "composer-2",
|
||||
name: "Composer 2",
|
||||
isCustom: false,
|
||||
capabilities: {
|
||||
reasoningEffortLevels: [],
|
||||
supportsFastMode: true,
|
||||
supportsThinkingToggle: false,
|
||||
contextWindowOptions: [],
|
||||
promptInjectedEffortLevels: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Normal");
|
||||
});
|
||||
|
||||
await page.getByRole("button").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Fast Mode");
|
||||
expect(text).toContain("off");
|
||||
expect(text).toContain("on");
|
||||
expect(document.body.textContent ?? "").toContain("Normal");
|
||||
});
|
||||
});
|
||||
|
||||
it("shows Normal for Cursor Opus 4.6 when fast mode and context window are both at defaults", async () => {
|
||||
it("persists fast-mode changes for fast-only Cursor models", async () => {
|
||||
await using _ = await mountCursorPicker({
|
||||
model: "claude-opus-4-6",
|
||||
options: { fastMode: false },
|
||||
});
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Normal");
|
||||
model: "composer-2",
|
||||
models: [
|
||||
{
|
||||
slug: "composer-2",
|
||||
name: "Composer 2",
|
||||
isCustom: false,
|
||||
capabilities: {
|
||||
reasoningEffortLevels: [],
|
||||
supportsFastMode: true,
|
||||
supportsThinkingToggle: false,
|
||||
contextWindowOptions: [],
|
||||
promptInjectedEffortLevels: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await page.getByRole("button").click();
|
||||
await page.getByRole("menuitemradio", { name: "on" }).click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Fast Mode");
|
||||
expect(text).toContain("Context Window");
|
||||
expect(text).toContain("200K (default)");
|
||||
expect(text).toContain("1M");
|
||||
});
|
||||
});
|
||||
|
||||
it("shows Normal · 1M for Cursor Opus 4.6 when fast mode is off and context window is overridden", async () => {
|
||||
await using _ = await mountCursorPicker({
|
||||
model: "claude-opus-4-6",
|
||||
options: { fastMode: false, contextWindow: "1m" },
|
||||
});
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(document.body.textContent ?? "").toContain("Normal · 1M");
|
||||
expect(useComposerDraftStore.getState().stickyModelSelectionByProvider.cursor).toMatchObject({
|
||||
provider: "cursor",
|
||||
model: "composer-2",
|
||||
options: {
|
||||
fastMode: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -72,6 +72,16 @@ function getEffortKey(provider: ProviderKind): string {
|
||||
return "effort";
|
||||
}
|
||||
|
||||
function getRawContextWindow(
|
||||
provider: ProviderKind,
|
||||
modelOptions: ProviderOptions | null | undefined,
|
||||
): string | null {
|
||||
if (modelOptions && "contextWindow" in modelOptions) {
|
||||
return trimOrNull(modelOptions.contextWindow);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function buildNextOptions(
|
||||
provider: ProviderKind,
|
||||
modelOptions: ProviderOptions | null | undefined,
|
||||
@@ -178,7 +188,6 @@ function getTraitsSectionVisibility(input: {
|
||||
const showThinking = selected.thinkingEnabled !== null;
|
||||
const showFastMode = selected.caps.supportsFastMode;
|
||||
const showContextWindow = selected.contextWindowOptions.length > 1;
|
||||
const showAgent = selected.agentOptions.length > 0;
|
||||
|
||||
return {
|
||||
...selected,
|
||||
@@ -186,8 +195,7 @@ function getTraitsSectionVisibility(input: {
|
||||
showThinking,
|
||||
showFastMode,
|
||||
showContextWindow,
|
||||
showAgent,
|
||||
hasAnyControls: showEffort || showThinking || showFastMode || showContextWindow || showAgent,
|
||||
hasAnyControls: showEffort || showThinking || showFastMode || showContextWindow,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -256,9 +264,6 @@ export const TraitsMenuContent = memo(function TraitsMenuContentImpl({
|
||||
showThinking,
|
||||
showFastMode,
|
||||
showContextWindow,
|
||||
ultrathinkInBodyText,
|
||||
agentOptions,
|
||||
selectedAgent,
|
||||
hasAnyControls,
|
||||
} = getTraitsSectionVisibility({
|
||||
provider,
|
||||
@@ -462,14 +467,6 @@ export const TraitsPicker = memo(function TraitsPicker({
|
||||
modelOptions,
|
||||
allowPromptInjectedEffort,
|
||||
});
|
||||
const { selectedAgentLabel } = getSelectedTraits(
|
||||
provider,
|
||||
models,
|
||||
model,
|
||||
prompt,
|
||||
modelOptions,
|
||||
allowPromptInjectedEffort,
|
||||
);
|
||||
|
||||
const effortLabel = effort
|
||||
? (effortLevels.find((l) => l.value === effort)?.label ?? effort)
|
||||
@@ -500,27 +497,23 @@ export const TraitsPicker = memo(function TraitsPicker({
|
||||
return null;
|
||||
}
|
||||
|
||||
const selectedTriggerTraits = [
|
||||
primaryTraitLabel,
|
||||
...(caps.supportsFastMode &&
|
||||
(fastModeEnabled || (primaryTraitLabel === null && contextWindowLabel !== null))
|
||||
? [fastModeEnabled ? "Fast" : "Normal"]
|
||||
: []),
|
||||
...(contextWindowLabel ? [contextWindowLabel] : []),
|
||||
...(selectedAgentLabel ? [selectedAgentLabel] : []),
|
||||
].filter(Boolean);
|
||||
const triggerLabel = fastOnlyControl
|
||||
? fastModeEnabled
|
||||
? "Fast"
|
||||
: "Normal"
|
||||
: selectedTriggerTraits.length > 0
|
||||
? selectedTriggerTraits.join(" · ")
|
||||
: caps.supportsFastMode
|
||||
? "Normal"
|
||||
: defaultContextWindow
|
||||
? (contextWindowOptions.find((option) => option.value === defaultContextWindow)?.label ??
|
||||
defaultContextWindow)
|
||||
: (selectedAgentLabel ?? "");
|
||||
: [
|
||||
ultrathinkPromptControlled
|
||||
? "Ultrathink"
|
||||
: effortLabel
|
||||
? effortLabel
|
||||
: thinkingEnabled === null
|
||||
? null
|
||||
: `Thinking ${thinkingEnabled ? "On" : "Off"}`,
|
||||
...(caps.supportsFastMode && fastModeEnabled ? ["Fast"] : []),
|
||||
...(contextWindowLabel ? [contextWindowLabel] : []),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
|
||||
const isCodexStyle = provider === "codex";
|
||||
|
||||
|
||||
@@ -66,6 +66,26 @@ const CURSOR_MODELS: ReadonlyArray<ServerProviderModel> = [
|
||||
promptInjectedEffortLevels: [],
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: "gpt-5.4",
|
||||
name: "GPT-5.4",
|
||||
isCustom: false,
|
||||
capabilities: {
|
||||
reasoningEffortLevels: [
|
||||
{ value: "low", label: "Low" },
|
||||
{ value: "medium", label: "Medium", isDefault: true },
|
||||
{ value: "high", label: "High" },
|
||||
{ value: "xhigh", label: "Extra high" },
|
||||
],
|
||||
supportsFastMode: true,
|
||||
supportsThinkingToggle: false,
|
||||
contextWindowOptions: [
|
||||
{ value: "272k", label: "272k", isDefault: true },
|
||||
{ value: "1m", label: "1M" },
|
||||
],
|
||||
promptInjectedEffortLevels: [],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const CLAUDE_MODELS: ReadonlyArray<ServerProviderModel> = [
|
||||
@@ -424,7 +444,29 @@ describe("getComposerProviderState", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("drops explicit Claude default/off overrides from dispatch while keeping the selected effort label", () => {
|
||||
it("preserves Cursor context window in dispatch options", () => {
|
||||
const state = getComposerProviderState({
|
||||
provider: "cursor",
|
||||
model: "gpt-5.4",
|
||||
models: CURSOR_MODELS,
|
||||
prompt: "",
|
||||
modelOptions: {
|
||||
cursor: {
|
||||
contextWindow: "1m",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(state).toEqual({
|
||||
provider: "cursor",
|
||||
promptEffort: "medium",
|
||||
modelOptionsForDispatch: {
|
||||
contextWindow: "1m",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves Claude default effort explicitly in dispatch options", () => {
|
||||
const state = getComposerProviderState({
|
||||
provider: "claudeAgent",
|
||||
model: "claude-opus-4-6",
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
normalizeCodexModelOptionsWithCapabilities,
|
||||
normalizeCursorModelOptionsWithCapabilities,
|
||||
} from "../../providerModels";
|
||||
import { TraitsMenuContent, TraitsPicker } from "./TraitsPicker";
|
||||
import { shouldRenderTraitsControls, TraitsMenuContent, TraitsPicker } from "./TraitsPicker";
|
||||
|
||||
export type ComposerProviderStateInput = {
|
||||
provider: ProviderKind;
|
||||
@@ -168,99 +168,120 @@ function createProviderRegistryEntry(
|
||||
const composerProviderRegistry: Record<ProviderKind, ProviderRegistryEntry> = {
|
||||
codex: {
|
||||
getState: (input) => getProviderStateFromCapabilities(input),
|
||||
renderTraitsMenuContent: ({
|
||||
threadId,
|
||||
model,
|
||||
models,
|
||||
modelOptions,
|
||||
prompt,
|
||||
onPromptChange,
|
||||
}) => (
|
||||
<TraitsMenuContent
|
||||
provider="codex"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
),
|
||||
renderTraitsPicker: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) => (
|
||||
<TraitsPicker
|
||||
provider="codex"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
),
|
||||
renderTraitsMenuContent: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) =>
|
||||
shouldRenderTraitsControls({
|
||||
provider: "codex",
|
||||
models,
|
||||
model,
|
||||
modelOptions,
|
||||
prompt,
|
||||
}) ? (
|
||||
<TraitsMenuContent
|
||||
provider="codex"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
) : null,
|
||||
renderTraitsPicker: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) =>
|
||||
shouldRenderTraitsControls({
|
||||
provider: "codex",
|
||||
models,
|
||||
model,
|
||||
modelOptions,
|
||||
prompt,
|
||||
}) ? (
|
||||
<TraitsPicker
|
||||
provider="codex"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
) : null,
|
||||
},
|
||||
claudeAgent: {
|
||||
getState: (input) => getProviderStateFromCapabilities(input),
|
||||
renderTraitsMenuContent: ({
|
||||
threadId,
|
||||
model,
|
||||
models,
|
||||
modelOptions,
|
||||
prompt,
|
||||
onPromptChange,
|
||||
}) => (
|
||||
<TraitsMenuContent
|
||||
provider="claudeAgent"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
),
|
||||
renderTraitsPicker: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) => (
|
||||
<TraitsPicker
|
||||
provider="claudeAgent"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
),
|
||||
renderTraitsMenuContent: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) =>
|
||||
shouldRenderTraitsControls({
|
||||
provider: "claudeAgent",
|
||||
models,
|
||||
model,
|
||||
modelOptions,
|
||||
prompt,
|
||||
}) ? (
|
||||
<TraitsMenuContent
|
||||
provider="claudeAgent"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
) : null,
|
||||
renderTraitsPicker: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) =>
|
||||
shouldRenderTraitsControls({
|
||||
provider: "claudeAgent",
|
||||
models,
|
||||
model,
|
||||
modelOptions,
|
||||
prompt,
|
||||
}) ? (
|
||||
<TraitsPicker
|
||||
provider="claudeAgent"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
) : null,
|
||||
},
|
||||
cursor: {
|
||||
getState: (input) => getProviderStateFromCapabilities(input),
|
||||
renderTraitsMenuContent: ({
|
||||
threadId,
|
||||
model,
|
||||
models,
|
||||
modelOptions,
|
||||
prompt,
|
||||
onPromptChange,
|
||||
}) => (
|
||||
<TraitsMenuContent
|
||||
provider="cursor"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
),
|
||||
renderTraitsPicker: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) => (
|
||||
<TraitsPicker
|
||||
provider="cursor"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
),
|
||||
renderTraitsMenuContent: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) =>
|
||||
shouldRenderTraitsControls({
|
||||
provider: "cursor",
|
||||
models,
|
||||
model,
|
||||
modelOptions,
|
||||
prompt,
|
||||
}) ? (
|
||||
<TraitsMenuContent
|
||||
provider="cursor"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
) : null,
|
||||
renderTraitsPicker: ({ threadId, model, models, modelOptions, prompt, onPromptChange }) =>
|
||||
shouldRenderTraitsControls({
|
||||
provider: "cursor",
|
||||
models,
|
||||
model,
|
||||
modelOptions,
|
||||
prompt,
|
||||
}) ? (
|
||||
<TraitsPicker
|
||||
provider="cursor"
|
||||
models={models}
|
||||
threadId={threadId}
|
||||
model={model}
|
||||
modelOptions={modelOptions}
|
||||
prompt={prompt}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
) : null,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -622,6 +622,10 @@ function normalizeProviderModelOptions(
|
||||
: undefined;
|
||||
const cursorFastMode = cursorCandidate?.fastMode === true;
|
||||
const cursorThinkingFalse = cursorCandidate?.thinking === false;
|
||||
const cursorContextWindow =
|
||||
typeof cursorCandidate?.contextWindow === "string" && cursorCandidate.contextWindow.length > 0
|
||||
? cursorCandidate.contextWindow
|
||||
: undefined;
|
||||
|
||||
const cursor: CursorModelOptions | undefined =
|
||||
cursorCandidate !== null
|
||||
@@ -629,6 +633,7 @@ function normalizeProviderModelOptions(
|
||||
...(cursorReasoning ? { reasoning: cursorReasoning } : {}),
|
||||
...(cursorFastMode ? { fastMode: true } : {}),
|
||||
...(cursorThinkingFalse ? { thinking: false } : {}),
|
||||
...(cursorContextWindow !== undefined ? { contextWindow: cursorContextWindow } : {}),
|
||||
}
|
||||
: undefined;
|
||||
|
||||
|
||||
@@ -108,10 +108,12 @@ export function normalizeCursorModelOptionsWithCapabilities(
|
||||
const fastMode = caps.supportsFastMode && modelOptions?.fastMode === true ? true : undefined;
|
||||
const thinking =
|
||||
caps.supportsThinkingToggle && modelOptions?.thinking === false ? false : undefined;
|
||||
const contextWindow = resolveContextWindow(caps, modelOptions?.contextWindow);
|
||||
const nextOptions: CursorModelOptions = {
|
||||
...(reasoningValue ? { reasoning: reasoningValue } : {}),
|
||||
...(fastMode ? { fastMode: true } : {}),
|
||||
...(thinking === false ? { thinking: false } : {}),
|
||||
...(contextWindow ? { contextWindow } : {}),
|
||||
};
|
||||
return Object.keys(nextOptions).length > 0 ? nextOptions : undefined;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user