refactor: organize model definitions and flavor capabilities into dedicated modules (#400)

This commit is contained in:
Junmo Kim
2026-04-05 22:49:29 +08:00
committed by GitHub
parent 4ffcb4cfdb
commit ea09663cdc
10 changed files with 263 additions and 60 deletions
@@ -20,7 +20,7 @@ import { useActiveSuggestions } from '@/hooks/useActiveSuggestions'
import { applySuggestion } from '@/utils/applySuggestion'
import { usePlatform } from '@/hooks/usePlatform'
import { usePWAInstall } from '@/hooks/usePWAInstall'
import { isClaudeFlavor, supportsModelChange } from '@/lib/agentFlavorUtils'
import { supportsEffort, supportsModelChange } from '@hapi/protocol'
import { markSkillUsed } from '@/lib/recent-skills'
import { FloatingOverlay } from '@/components/ChatInput/FloatingOverlay'
import { Autocomplete } from '@/components/ChatInput/Autocomplete'
@@ -440,7 +440,7 @@ export function HappyComposer(props: {
const showCollaborationSettings = Boolean(onCollaborationModeChange && collaborationModeOptions.length > 0)
const showPermissionSettings = Boolean(onPermissionModeChange && permissionModeOptions.length > 0)
const showModelSettings = Boolean(onModelChange && supportsModelChange(agentFlavor))
const showEffortSettings = Boolean(onEffortChange && isClaudeFlavor(agentFlavor))
const showEffortSettings = Boolean(onEffortChange && supportsEffort(agentFlavor))
const showSettingsButton = Boolean(showCollaborationSettings || showPermissionSettings || showModelSettings || showEffortSettings)
const showAbortButton = true
const voiceEnabled = Boolean(onVoiceToggle)
+4 -16
View File
@@ -1,19 +1,7 @@
// Re-export from shared package for backwards compatibility
export { isKnownFlavor, supportsModelChange, supportsEffort } from '@hapi/protocol'
// Flavor-family helper not yet in shared — keep here until next migration
export function isCodexFamilyFlavor(flavor?: string | null): boolean {
return flavor === 'codex' || flavor === 'gemini' || flavor === 'opencode'
}
export function isClaudeFlavor(flavor?: string | null): boolean {
return flavor === 'claude'
}
export function isCursorFlavor(flavor?: string | null): boolean {
return flavor === 'cursor'
}
export function isKnownFlavor(flavor?: string | null): boolean {
return isClaudeFlavor(flavor) || isCodexFamilyFlavor(flavor) || isCursorFlavor(flavor)
}
export function supportsModelChange(flavor?: string | null): boolean {
return flavor === 'claude' || flavor === 'gemini'
}