@@ -9,19 +9,19 @@ import {
99 apiModeToModelName ,
1010} from '../../utils/index.mjs'
1111import {
12- isUsingOpenAiApiKey ,
13- isUsingAzureOpenAi ,
14- isUsingChatGLMApi ,
15- isUsingClaudeApi ,
12+ isUsingOpenAiApiModel ,
13+ isUsingAzureOpenAiApiModel ,
14+ isUsingChatGLMApiModel ,
15+ isUsingClaudeApiModel ,
1616 isUsingCustomModel ,
1717 isUsingCustomNameOnlyModel ,
18- isUsingOllamaModel ,
19- isUsingGithubThirdPartyApi ,
18+ isUsingOllamaApiModel ,
19+ isUsingGithubThirdPartyApiModel ,
2020 isUsingMultiModeModel ,
2121 ModelMode ,
2222 ThemeMode ,
2323 TriggerMode ,
24- isUsingMoonshotApi ,
24+ isUsingMoonshotApiModel ,
2525 Models ,
2626} from '../../config/index.mjs'
2727import Browser from 'webextension-polyfill'
@@ -172,20 +172,20 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
172172 < span style = "display: flex; gap: 15px;" >
173173 < select
174174 style = {
175- isUsingOpenAiApiKey ( config ) ||
175+ isUsingOpenAiApiModel ( config ) ||
176176 isUsingMultiModeModel ( config ) ||
177177 isUsingCustomModel ( config ) ||
178- isUsingOllamaModel ( config ) ||
179- isUsingAzureOpenAi ( config ) ||
180- isUsingClaudeApi ( config ) ||
178+ isUsingOllamaApiModel ( config ) ||
179+ isUsingAzureOpenAiApiModel ( config ) ||
180+ isUsingClaudeApiModel ( config ) ||
181181 isUsingCustomNameOnlyModel ( config ) ||
182- isUsingMoonshotApi ( config )
182+ isUsingMoonshotApiModel ( config )
183183 ? 'width: 50%;'
184184 : undefined
185185 }
186186 required
187187 onChange = { ( e ) => {
188- if ( e . target . value === - 1 ) {
188+ if ( e . target . value === '-1' ) {
189189 updateConfig ( { modelName : 'customModel' , apiMode : null } )
190190 return
191191 }
@@ -197,11 +197,8 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
197197 const modelName = apiModeToModelName ( apiMode )
198198 const desc = modelNameToDesc ( modelName , t )
199199 if ( desc ) {
200- let selected
201- if ( isApiModeSelected ( apiMode , config ) ) selected = true
202- else selected = config . modelName === modelName
203200 return (
204- < option value = { index } key = { index } selected = { selected } >
201+ < option value = { index } key = { index } selected = { isApiModeSelected ( apiMode , config ) } >
205202 { desc }
206203 </ option >
207204 )
@@ -229,7 +226,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
229226 } ) }
230227 </ select >
231228 ) }
232- { isUsingOpenAiApiKey ( config ) && (
229+ { isUsingOpenAiApiModel ( config ) && (
233230 < span style = "width: 50%; display: flex; gap: 5px;" >
234231 < input
235232 type = "password"
@@ -285,7 +282,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
285282 } }
286283 />
287284 ) }
288- { isUsingOllamaModel ( config ) && (
285+ { isUsingOllamaApiModel ( config ) && (
289286 < input
290287 style = "width: 50%;"
291288 type = "text"
@@ -297,7 +294,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
297294 } }
298295 />
299296 ) }
300- { isUsingAzureOpenAi ( config ) && (
297+ { isUsingAzureOpenAiApiModel ( config ) && (
301298 < input
302299 type = "password"
303300 style = "width: 50%;"
@@ -309,7 +306,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
309306 } }
310307 />
311308 ) }
312- { isUsingClaudeApi ( config ) && (
309+ { isUsingClaudeApiModel ( config ) && (
313310 < input
314311 type = "password"
315312 style = "width: 50%;"
@@ -321,7 +318,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
321318 } }
322319 />
323320 ) }
324- { isUsingChatGLMApi ( config ) && (
321+ { isUsingChatGLMApiModel ( config ) && (
325322 < input
326323 type = "password"
327324 style = "width: 50%;"
@@ -333,7 +330,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
333330 } }
334331 />
335332 ) }
336- { isUsingMoonshotApi ( config ) && (
333+ { isUsingMoonshotApiModel ( config ) && (
337334 < span style = "width: 50%; display: flex; gap: 5px;" >
338335 < input
339336 type = "password"
@@ -380,7 +377,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
380377 } }
381378 />
382379 ) }
383- { isUsingOllamaModel ( config ) && (
380+ { isUsingOllamaApiModel ( config ) && (
384381 < div style = { { display : 'flex' , gap : '10px' } } >
385382 { t ( 'Keep-Alive Time' ) + ':' }
386383 < label >
@@ -421,7 +418,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
421418 </ label >
422419 </ div >
423420 ) }
424- { isUsingOllamaModel ( config ) && (
421+ { isUsingOllamaApiModel ( config ) && (
425422 < input
426423 type = "text"
427424 value = { config . ollamaEndpoint }
@@ -432,7 +429,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
432429 } }
433430 />
434431 ) }
435- { isUsingOllamaModel ( config ) && (
432+ { isUsingOllamaApiModel ( config ) && (
436433 < input
437434 type = "password"
438435 value = { config . ollamaApiKey }
@@ -443,7 +440,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
443440 } }
444441 />
445442 ) }
446- { isUsingAzureOpenAi ( config ) && (
443+ { isUsingAzureOpenAiApiModel ( config ) && (
447444 < input
448445 type = "password"
449446 value = { config . azureEndpoint }
@@ -454,7 +451,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
454451 } }
455452 />
456453 ) }
457- { isUsingAzureOpenAi ( config ) && (
454+ { isUsingAzureOpenAiApiModel ( config ) && (
458455 < input
459456 type = "text"
460457 value = { config . azureDeploymentName }
@@ -465,7 +462,7 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) {
465462 } }
466463 />
467464 ) }
468- { isUsingGithubThirdPartyApi ( config ) && (
465+ { isUsingGithubThirdPartyApiModel ( config ) && (
469466 < input
470467 type = "text"
471468 value = { config . githubThirdPartyUrl }
0 commit comments