mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Virtualized chat rendering keeps inactive long-running sessions cheap without disconnecting their CLI process, while DeepSeek now relies on the shared Thinking setting instead of a provider-specific disabled-thinking override. Existing legacy DeepSeek managed env is normalized so old local settings do not keep suppressing reasoning output after upgrade. Constraint: Multiple desktop tabs must keep live sessions running and remain quick to switch without reconnecting. Rejected: Pause or disconnect hidden sessions | would delay tab switching and interrupt streaming/tool state visibility. Rejected: Keep DeepSeek disabled-thinking preset | conflicts with the General Settings Thinking control. Confidence: high Scope-risk: moderate Directive: Do not reintroduce provider-specific disabled-thinking defaults for DeepSeek without testing both General Settings toggle states. Tested: bun test src/server/__tests__/conversations.test.ts -t "global Thinking setting control DeepSeek" Tested: bun test src/server/__tests__/persistence-upgrade.test.ts src/server/__tests__/provider-presets.test.ts src/server/__tests__/providers.test.ts src/server/__tests__/title-service.test.ts src/utils/__tests__/thinking.test.ts src/utils/__tests__/providerManagedEnvCompat.test.ts Tested: cd desktop && bun run test -- MessageList.test.tsx ContextUsageIndicator.test.tsx Tested: bun run check:server
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
const DEEPSEEK_THINKING_CAPABILITIES = 'thinking,effort,adaptive_thinking,max_effort'
|
|
|
|
const DEEPSEEK_CAPABILITY_ENV_KEYS = [
|
|
'ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES',
|
|
'ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES',
|
|
'ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES',
|
|
] as const
|
|
|
|
function looksLikeDeepSeekManagedEnv(env: Record<string, string>): boolean {
|
|
const baseUrl = env.ANTHROPIC_BASE_URL ?? ''
|
|
const modelIds = [
|
|
env.ANTHROPIC_MODEL,
|
|
env.ANTHROPIC_DEFAULT_HAIKU_MODEL,
|
|
env.ANTHROPIC_DEFAULT_SONNET_MODEL,
|
|
env.ANTHROPIC_DEFAULT_OPUS_MODEL,
|
|
].filter(Boolean)
|
|
|
|
return (
|
|
baseUrl.includes('api.deepseek.com') ||
|
|
modelIds.some((model) => /^deepseek[-_]/i.test(model ?? ''))
|
|
)
|
|
}
|
|
|
|
export function normalizeLegacyDeepSeekManagedEnv(
|
|
env: Record<string, string>,
|
|
): { env: Record<string, string>; changed: boolean } {
|
|
if (!env.CC_HAHA_SEND_DISABLED_THINKING || !looksLikeDeepSeekManagedEnv(env)) {
|
|
return { env, changed: false }
|
|
}
|
|
|
|
const next = { ...env }
|
|
delete next.CC_HAHA_SEND_DISABLED_THINKING
|
|
|
|
for (const key of DEEPSEEK_CAPABILITY_ENV_KEYS) {
|
|
next[key] = DEEPSEEK_THINKING_CAPABILITIES
|
|
}
|
|
|
|
return { env: next, changed: true }
|
|
}
|