fix: add grok2 llm model tab and add-provider dialog option
Some checks failed
Build & Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build & Push Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -111,6 +111,7 @@
|
||||
"apiType": "API Type",
|
||||
"apiTypeGeminiCompatible": "Gemini Compatible",
|
||||
"apiTypeOpenAICompatible": "OpenAI Compatible",
|
||||
"apiTypeGrok2": "Grok2 API",
|
||||
"apiTypeGeminiHint": "Uses Google SDK",
|
||||
"otherProviders": "Other Settings",
|
||||
"audioCategory": "Audio",
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
"apiType": "API 类型",
|
||||
"apiTypeGeminiCompatible": "Gemini 兼容",
|
||||
"apiTypeOpenAICompatible": "OpenAI 兼容",
|
||||
"apiTypeGrok2": "Grok2 API",
|
||||
"apiTypeGeminiHint": "使用 Google SDK",
|
||||
"otherProviders": "其他配置",
|
||||
"audioCategory": "音频",
|
||||
|
||||
@@ -28,7 +28,7 @@ interface TestStep {
|
||||
}
|
||||
type TestStatus = 'idle' | 'testing' | 'passed' | 'failed'
|
||||
|
||||
type CustomProviderType = 'gemini-compatible' | 'openai-compatible'
|
||||
type CustomProviderType = 'gemini-compatible' | 'openai-compatible' | 'grok2'
|
||||
|
||||
const Icons = {
|
||||
settings: () => (
|
||||
@@ -168,7 +168,7 @@ export function ApiConfigTabContainer() {
|
||||
name,
|
||||
baseUrl,
|
||||
apiKey,
|
||||
apiMode: newGeminiProvider.apiType === 'openai-compatible' ? 'openai-official' : 'gemini-sdk',
|
||||
apiMode: newGeminiProvider.apiType === 'gemini-compatible' ? 'gemini-sdk' : 'openai-official',
|
||||
})
|
||||
|
||||
setNewGeminiProvider({ name: '', baseUrl: '', apiKey: '', apiType: 'gemini-compatible' })
|
||||
@@ -372,6 +372,7 @@ export function ApiConfigTabContainer() {
|
||||
>
|
||||
<option value="gemini-compatible">{t('apiTypeGeminiCompatible')}</option>
|
||||
<option value="openai-compatible">{t('apiTypeOpenAICompatible')}</option>
|
||||
<option value="grok2">{t('apiTypeGrok2')}</option>
|
||||
</select>
|
||||
<div className="pointer-events-none absolute right-3 top-3 text-[var(--glass-text-tertiary)]">
|
||||
<Icons.chevronDown />
|
||||
|
||||
@@ -13,7 +13,7 @@ interface EnabledModelOption extends CustomModel {
|
||||
providerName: string
|
||||
}
|
||||
|
||||
const DYNAMIC_PROVIDER_PREFIXES = ['gemini-compatible', 'openai-compatible']
|
||||
const DYNAMIC_PROVIDER_PREFIXES = ['gemini-compatible', 'openai-compatible', 'grok2']
|
||||
const ALWAYS_SHOW_PROVIDERS: string[] = []
|
||||
/** 完全不在 UI 中展示的 provider(既不在主列表,也不在折叠区) */
|
||||
const HIDDEN_PROVIDER_KEYS = new Set(['siliconflow'])
|
||||
@@ -31,6 +31,7 @@ const MODEL_PROVIDER_KEYS = [
|
||||
'fal',
|
||||
'gemini-compatible',
|
||||
'openai-compatible',
|
||||
'grok2',
|
||||
]
|
||||
|
||||
function isProviderModelType(type: CustomModel['type']): type is 'llm' | 'image' | 'video' | 'audio' | 'lipsync' {
|
||||
|
||||
@@ -64,7 +64,8 @@ const MODEL_TYPES: readonly ProviderCardModelType[] = ['llm', 'image', 'video',
|
||||
|
||||
export function getAddableModelTypesForProvider(providerId: string): ProviderCardModelType[] {
|
||||
const providerKey = getProviderKey(providerId)
|
||||
if (providerKey === 'openai-compatible' || providerKey === 'grok2') return ['image', 'video']
|
||||
if (providerKey === 'openai-compatible') return ['image', 'video']
|
||||
if (providerKey === 'grok2') return ['llm', 'image', 'video']
|
||||
return ['llm', 'image', 'video', 'audio']
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user