mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 18:21:27 +00:00
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
type QaLiveTimeoutProfile = {
|
|
providerMode: "mock-openai" | "live-frontier";
|
|
primaryModel: string;
|
|
alternateModel: string;
|
|
};
|
|
|
|
function isAnthropicModel(modelRef: string) {
|
|
return modelRef.startsWith("anthropic/");
|
|
}
|
|
|
|
function isOpenAiModel(modelRef: string) {
|
|
return modelRef.startsWith("openai/");
|
|
}
|
|
|
|
function isGptFiveModel(modelRef: string) {
|
|
return isOpenAiModel(modelRef) && modelRef.slice("openai/".length).startsWith("gpt-5");
|
|
}
|
|
|
|
function isClaudeOpusModel(modelRef: string) {
|
|
return isAnthropicModel(modelRef) && modelRef.includes("claude-opus");
|
|
}
|
|
|
|
export function resolveQaLiveTurnTimeoutMs(
|
|
profile: QaLiveTimeoutProfile,
|
|
fallbackMs: number,
|
|
modelRef = profile.primaryModel,
|
|
) {
|
|
if (profile.providerMode === "mock-openai") {
|
|
return fallbackMs;
|
|
}
|
|
if (isClaudeOpusModel(modelRef)) {
|
|
return Math.max(fallbackMs, 240_000);
|
|
}
|
|
if (isAnthropicModel(modelRef)) {
|
|
return Math.max(fallbackMs, 180_000);
|
|
}
|
|
if (isGptFiveModel(modelRef)) {
|
|
return Math.max(fallbackMs, 360_000);
|
|
}
|
|
return Math.max(fallbackMs, 120_000);
|
|
}
|