@@ -52,13 +52,15 @@ import { DropdownItem, Model, UpgradeInfo } from '../types/Chat.ts';
52
52
import packageJson from '../../package.json' ;
53
53
import { isMac } from '../App.tsx' ;
54
54
import CustomDropdown from './DropdownComponent.tsx' ;
55
- import { getTotalCost } from './ModelPrice.ts' ;
55
+ import {
56
+ addBedrockPrefixToDeepseekModels ,
57
+ getTotalCost ,
58
+ } from './ModelPrice.ts' ;
56
59
import {
57
60
BedrockThinkingModels ,
58
- DeepSeekModels ,
61
+ DefaultTextModel ,
59
62
getAllRegions ,
60
- getDefaultTextModels ,
61
- GPTModels ,
63
+ getDefaultApiKeyModels ,
62
64
} from '../storage/Constants.ts' ;
63
65
import CustomTextInput from './CustomTextInput.tsx' ;
64
66
import { requestAllOllamaModels } from '../api/ollama-api.ts' ;
@@ -138,23 +140,30 @@ function SettingsScreen(): React.JSX.Element {
138
140
return ;
139
141
}
140
142
saveOllamaApiURL ( ollamaApiUrl ) ;
141
- if ( ollamaApiUrl . length > 0 ) {
142
- fetchAndSetModelNames ( ) . then ( ) ;
143
- }
143
+ fetchAndSetModelNames ( ) . then ( ) ;
144
144
} , [ ollamaApiUrl ] ) ;
145
145
146
146
useEffect ( ( ) => {
147
+ if ( deepSeekApiKey === getDeepSeekApiKey ( ) ) {
148
+ return ;
149
+ }
147
150
saveDeepSeekApiKey ( deepSeekApiKey ) ;
151
+ fetchAndSetModelNames ( ) . then ( ) ;
148
152
} , [ deepSeekApiKey ] ) ;
149
153
150
154
useEffect ( ( ) => {
155
+ if ( openAIApiKey === getOpenAIApiKey ( ) ) {
156
+ return ;
157
+ }
151
158
saveOpenAIApiKey ( openAIApiKey ) ;
159
+ fetchAndSetModelNames ( ) . then ( ) ;
152
160
} , [ openAIApiKey ] ) ;
153
161
154
162
const fetchAndSetModelNames = async ( ) => {
155
163
controllerRef . current = new AbortController ( ) ;
156
164
const ollamaModels = await requestAllOllamaModels ( ) ;
157
165
const response = await requestAllModels ( ) ;
166
+ addBedrockPrefixToDeepseekModels ( response . textModel ) ;
158
167
if ( response . imageModel . length > 0 ) {
159
168
setImageModels ( response . imageModel ) ;
160
169
const imageModel = getImageModel ( ) ;
@@ -170,13 +179,16 @@ function SettingsScreen(): React.JSX.Element {
170
179
}
171
180
}
172
181
if ( response . textModel . length === 0 ) {
173
- response . textModel = [ ...getDefaultTextModels ( ) , ...ollamaModels ] ;
182
+ response . textModel = [
183
+ ...DefaultTextModel ,
184
+ ...ollamaModels ,
185
+ ...getDefaultApiKeyModels ( ) ,
186
+ ] ;
174
187
} else {
175
188
response . textModel = [
176
189
...response . textModel ,
177
190
...ollamaModels ,
178
- ...DeepSeekModels ,
179
- ...GPTModels ,
191
+ ...getDefaultApiKeyModels ( ) ,
180
192
] ;
181
193
}
182
194
setTextModels ( response . textModel ) ;
0 commit comments