fix: address self-review findings

This commit is contained in:
Matt Van Horn
2026-07-12 01:26:59 -07:00
parent f3a85558d8
commit d6bdb25f58
5 changed files with 54 additions and 3 deletions
+13 -2
View File
@@ -16,6 +16,7 @@ import {
getAIModel,
SINGLE_SYSTEM_PROVIDERS,
supportsPromptCaching,
supportsTemperature,
} from "@/lib/ai-providers"
import { findCachedResponse } from "@/lib/cached-responses"
import {
@@ -254,6 +255,16 @@ async function handleChatRequest(req: Request): Promise<Response> {
`[Prompt Caching] ${shouldCache ? "ENABLED" : "DISABLED"} for model: ${modelId}`,
)
const configuredTemperature = process.env.TEMPERATURE
const temperature = supportsTemperature(modelId)
? configuredTemperature
: undefined
if (configuredTemperature !== undefined && temperature === undefined) {
console.log(
`[Temperature] SKIPPED for model: ${modelId} (parameter is not supported)`,
)
}
// Get the appropriate system prompt based on model (extended for Opus/Haiku 4.5)
const systemMessage = getSystemPrompt(modelId, minimalStyle)
const finalSystemMessage = customSystemMessage
@@ -762,8 +773,8 @@ Call this tool to get shape names and usage syntax for a specific library.`,
},
},
},
...(process.env.TEMPERATURE !== undefined && {
temperature: parseFloat(process.env.TEMPERATURE),
...(temperature !== undefined && {
temperature: parseFloat(temperature),
}),
})