chahinebrini 355166c194 feat(sos): tier-based LLM-Default — Free/Pro=Groq, Legend=Haiku
Backend (sos-stream.get.ts): wenn sessionData.llmProvider === 'auto'
oder undefined, resolved zu plan-based default via profile.plan:
- legend → openrouter-haiku (Anthropic warm + sort:latency)
- pro/free → groq-llama (sachlich + schnell, ~157ms TTFB)

Frontend (llmProvider.ts): DEFAULT_PROVIDER = 'auto', neue Pill 'Auto'
in LlmProviderToggle. Explicit-Toggles (Sonnet/Haiku/Groq) sind
debug-overrides die plan-logic bypassen.
2026-05-07 04:15:31 +02:00

61 lines
1.6 KiB
TypeScript

import { Pressable, Text, View } from 'react-native';
import { LLM_PROVIDER_LABEL, type LlmProvider, useLlmProvider } from '../../lib/llmProvider';
const PROVIDERS: LlmProvider[] = ['auto', 'openrouter-sonnet', 'openrouter-haiku', 'groq-llama'];
export function LlmProviderToggle() {
const [current, set] = useLlmProvider();
return (
<View
style={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
gap: 6,
paddingHorizontal: 12,
paddingVertical: 6,
}}
>
<Text
style={{
fontSize: 9,
color: '#9ca3af',
textTransform: 'uppercase',
letterSpacing: 0.5,
marginRight: 4,
}}
>
LLM
</Text>
{PROVIDERS.map((p) => {
const active = p === current;
return (
<Pressable
key={p}
onPress={() => { void set(p); }}
hitSlop={6}
style={{
paddingHorizontal: 10,
paddingVertical: 4,
borderRadius: 999,
backgroundColor: active ? '#1f2937' : '#e5e7eb',
borderWidth: 1.5,
borderColor: active ? '#1f2937' : '#9ca3af',
}}
>
<Text
style={{
fontSize: 10,
fontFamily: 'Nunito_700Bold',
color: active ? '#ffffff' : '#374151',
}}
>
{LLM_PROVIDER_LABEL[p]}
</Text>
</Pressable>
);
})}
</View>
);
}