fix: /model selection for shared-handle tiers (#859)

This commit is contained in:
paulbettner
2026-02-08 21:27:27 -06:00
committed by GitHub
parent c397a463cd
commit 7efa6f60b5
3 changed files with 108 additions and 5 deletions

View File

@@ -2412,7 +2412,14 @@ export default function App({
agent.llm_config.model_endpoint_type && agent.llm_config.model
? `${agent.llm_config.model_endpoint_type}/${agent.llm_config.model}`
: agent.llm_config.model;
const modelInfo = getModelInfo(agentModelHandle || "");
const { getModelInfoForLlmConfig } = await import("../agent/model");
const modelInfo = getModelInfoForLlmConfig(
agentModelHandle || "",
agent.llm_config as unknown as {
reasoning_effort?: string | null;
enable_reasoner?: boolean | null;
},
);
if (modelInfo) {
setCurrentModelId(modelInfo.id);
} else {
@@ -3303,28 +3310,53 @@ export default function App({
const client = await getClient();
const agent = await client.agents.retrieve(agentIdRef.current);
// Check if the model has changed by comparing llm_config
// Keep model UI in sync with the agent configuration.
// Note: many tiers share the same handle (e.g. gpt-5.2-none/high), so we
// must also treat reasoning settings as model-affecting.
const currentModel = llmConfigRef.current?.model;
const currentEndpoint = llmConfigRef.current?.model_endpoint_type;
const currentEffort = llmConfigRef.current?.reasoning_effort;
const currentEnableReasoner = (
llmConfigRef.current as unknown as {
enable_reasoner?: boolean | null;
}
)?.enable_reasoner;
const agentModel = agent.llm_config.model;
const agentEndpoint = agent.llm_config.model_endpoint_type;
const agentEffort = agent.llm_config.reasoning_effort;
const agentEnableReasoner = (
agent.llm_config as unknown as {
enable_reasoner?: boolean | null;
}
)?.enable_reasoner;
if (
currentModel !== agentModel ||
currentEndpoint !== agentEndpoint
currentEndpoint !== agentEndpoint ||
currentEffort !== agentEffort ||
currentEnableReasoner !== agentEnableReasoner
) {
// Model has changed - update local state
setLlmConfig(agent.llm_config);
// Derive model ID from llm_config for ModelSelector
// Try to find matching model by handle in models.json
const { getModelInfo } = await import("../agent/model");
const { getModelInfoForLlmConfig } = await import(
"../agent/model"
);
const agentModelHandle =
agent.llm_config.model_endpoint_type && agent.llm_config.model
? `${agent.llm_config.model_endpoint_type}/${agent.llm_config.model}`
: agent.llm_config.model;
const modelInfo = getModelInfo(agentModelHandle || "");
const modelInfo = getModelInfoForLlmConfig(
agentModelHandle || "",
agent.llm_config as unknown as {
reasoning_effort?: string | null;
enable_reasoner?: boolean | null;
},
);
if (modelInfo) {
setCurrentModelId(modelInfo.id);
} else {