Skip to content

Commit e025fec

Browse files
authored
πŸ› fix: provider settings button unable to redirect (#10319)
* πŸ”§ refactor: replace Next.js router with React Router for navigation in ModelSwitchPanel * πŸ”§ feat: ζ·»εŠ ζ–°ε€šζ¨‘ζ€ζ¨‘εž‹ Grok 4.1 Fast ε’Œ Grok 4.1 Fast (Non-Reasoning) 到 xai.ts
1 parent 4d64d9d commit e025fec

File tree

2 files changed

+100
-19
lines changed
  • packages/model-bank/src/aiModels
  • src/features/ModelSwitchPanel

2 files changed

+100
-19
lines changed

β€Žpackages/model-bank/src/aiModels/xai.tsβ€Ž

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,94 @@ const xaiChatModels: AIChatModelCard[] = [
66
abilities: {
77
functionCall: true,
88
search: true,
9+
structuredOutput: true,
910
vision: true,
1011
},
1112
contextWindowTokens: 2_000_000,
12-
description:
13-
'ζˆ‘δ»¬εΎˆι«˜ε…΄ε‘εΈƒ Grok 4 FastοΌŒθΏ™ζ˜―ζˆ‘δ»¬εœ¨ζˆζœ¬ζ•ˆη›ŠζŽ¨η†ζ¨‘εž‹ζ–Ήι’ηš„ζœ€ζ–°θΏ›ε±•γ€‚',
14-
displayName: 'Grok 4 Fast (Non-Reasoning)',
13+
description: 'ε‰ζ²Ώε€šζ¨‘ζ€ζ¨‘εž‹οΌŒδΈ“ι—¨ι’ˆε―Ήι«˜ζ€§θƒ½δ»£η†ε·₯ε…·θ°ƒη”¨θΏ›θ‘ŒδΌ˜εŒ–γ€‚',
14+
displayName: 'Grok 4.1 Fast (Non-Reasoning)',
15+
enabled: true,
16+
id: 'grok-4-1-fast-non-reasoning',
17+
pricing: {
18+
units: [
19+
{ name: 'textInput_cacheRead', rate: 0.05, strategy: 'fixed', unit: 'millionTokens' },
20+
{
21+
name: 'textInput',
22+
strategy: 'tiered',
23+
tiers: [
24+
{ rate: 0.2, upTo: 0.128 },
25+
{ rate: 0.4, upTo: 'infinity' },
26+
],
27+
unit: 'millionTokens',
28+
},
29+
{
30+
name: 'textOutput',
31+
strategy: 'tiered',
32+
tiers: [
33+
{ rate: 0.5, upTo: 0.128 },
34+
{ rate: 1, upTo: 'infinity' },
35+
],
36+
unit: 'millionTokens',
37+
},
38+
],
39+
},
40+
releasedAt: '2025-11-20',
41+
settings: {
42+
searchImpl: 'params',
43+
},
44+
type: 'chat',
45+
},
46+
{
47+
abilities: {
48+
functionCall: true,
49+
reasoning: true,
50+
search: true,
51+
structuredOutput: true,
52+
vision: true,
53+
},
54+
contextWindowTokens: 2_000_000,
55+
description: 'ε‰ζ²Ώε€šζ¨‘ζ€ζ¨‘εž‹οΌŒδΈ“ι—¨ι’ˆε―Ήι«˜ζ€§θƒ½δ»£η†ε·₯ε…·θ°ƒη”¨θΏ›θ‘ŒδΌ˜εŒ–γ€‚',
56+
displayName: 'Grok 4.1 Fast',
1557
enabled: true,
58+
id: 'grok-4-1-fast-reasoning',
59+
pricing: {
60+
units: [
61+
{ name: 'textInput_cacheRead', rate: 0.05, strategy: 'fixed', unit: 'millionTokens' },
62+
{
63+
name: 'textInput',
64+
strategy: 'tiered',
65+
tiers: [
66+
{ rate: 0.2, upTo: 0.128 },
67+
{ rate: 0.4, upTo: 'infinity' },
68+
],
69+
unit: 'millionTokens',
70+
},
71+
{
72+
name: 'textOutput',
73+
strategy: 'tiered',
74+
tiers: [
75+
{ rate: 0.5, upTo: 0.128 },
76+
{ rate: 1, upTo: 'infinity' },
77+
],
78+
unit: 'millionTokens',
79+
},
80+
],
81+
},
82+
releasedAt: '2025-11-20',
83+
settings: {
84+
searchImpl: 'params',
85+
},
86+
type: 'chat',
87+
},
88+
{
89+
abilities: {
90+
functionCall: true,
91+
search: true,
92+
vision: true,
93+
},
94+
contextWindowTokens: 2_000_000,
95+
description: 'ζˆ‘δ»¬εΎˆι«˜ε…΄ε‘εΈƒ Grok 4 FastοΌŒθΏ™ζ˜―ζˆ‘δ»¬εœ¨ζˆζœ¬ζ•ˆη›ŠζŽ¨η†ζ¨‘εž‹ζ–Ήι’ηš„ζœ€ζ–°θΏ›ε±•γ€‚',
96+
displayName: 'Grok 4 Fast (Non-Reasoning)',
1697
id: 'grok-4-fast-non-reasoning',
1798
pricing: {
1899
units: [
@@ -51,10 +132,8 @@ const xaiChatModels: AIChatModelCard[] = [
51132
vision: true,
52133
},
53134
contextWindowTokens: 2_000_000,
54-
description:
55-
'ζˆ‘δ»¬εΎˆι«˜ε…΄ε‘εΈƒ Grok 4 FastοΌŒθΏ™ζ˜―ζˆ‘δ»¬εœ¨ζˆζœ¬ζ•ˆη›ŠζŽ¨η†ζ¨‘εž‹ζ–Ήι’ηš„ζœ€ζ–°θΏ›ε±•γ€‚',
135+
description: 'ζˆ‘δ»¬εΎˆι«˜ε…΄ε‘εΈƒ Grok 4 FastοΌŒθΏ™ζ˜―ζˆ‘δ»¬εœ¨ζˆζœ¬ζ•ˆη›ŠζŽ¨η†ζ¨‘εž‹ζ–Ήι’ηš„ζœ€ζ–°θΏ›ε±•γ€‚',
56136
displayName: 'Grok 4 Fast',
57-
enabled: true,
58137
id: 'grok-4-fast-reasoning',
59138
pricing: {
60139
units: [

β€Žsrc/features/ModelSwitchPanel/index.tsxβ€Ž

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { ActionIcon, Icon } from '@lobehub/ui';
22
import { createStyles } from 'antd-style';
33
import type { ItemType } from 'antd/es/menu/interface';
44
import { LucideArrowRight, LucideBolt } from 'lucide-react';
5-
import Link from 'next/link';
6-
import { useRouter } from 'next/navigation';
75
import { type ReactNode, memo, useMemo } from 'react';
86
import { useTranslation } from 'react-i18next';
97
import { Flexbox } from 'react-layout-kit';
8+
import { useNavigate } from 'react-router-dom';
109

1110
import { ModelItemRender, ProviderItemRender } from '@/components/ModelSelect';
1211
import ActionDropdown from '@/features/ChatInput/ActionBar/components/ActionDropdown';
@@ -53,7 +52,7 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
5352
agentSelectors.currentAgentModelProvider(s),
5453
s.updateAgentConfig,
5554
]);
56-
const router = useRouter();
55+
const navigate = useNavigate();
5756
const enabledList = useEnabledChatModels();
5857

5958
const items = useMemo<ItemType[]>(() => {
@@ -78,7 +77,7 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
7877
</Flexbox>
7978
),
8079
onClick: () => {
81-
router.push(`/settings?active=provider&provider=${provider.id}`);
80+
navigate(`/settings?active=provider&provider=${provider.id}`);
8281
},
8382
},
8483
];
@@ -97,7 +96,7 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
9796
</Flexbox>
9897
),
9998
onClick: () => {
100-
router.push('/settings?active=provider');
99+
navigate('/settings?active=provider');
101100
},
102101
},
103102
];
@@ -114,18 +113,21 @@ const ModelSwitchPanel = memo<IProps>(({ children, onOpenChange, open }) => {
114113
provider={provider.id}
115114
source={provider.source}
116115
/>
117-
<Link href={`/settings?active=provider&provider=${provider.id}`}>
118-
<ActionIcon
119-
icon={LucideBolt}
120-
size={'small'}
121-
title={t('ModelSwitchPanel.goToSettings')}
122-
/>
123-
</Link>
116+
<ActionIcon
117+
icon={LucideBolt}
118+
onClick={(e) => {
119+
e.preventDefault();
120+
e.stopPropagation();
121+
navigate(`/settings?active=provider&provider=${provider.id}`);
122+
}}
123+
size={'small'}
124+
title={t('ModelSwitchPanel.goToSettings')}
125+
/>
124126
</Flexbox>
125127
),
126128
type: 'group',
127129
}));
128-
}, [enabledList]);
130+
}, [enabledList, navigate, t, theme.colorTextTertiary]);
129131

130132
const icon = <div className={styles.tag}>{children}</div>;
131133

0 commit comments

Comments
Β (0)