统一gork使用模板中的名称风格

This commit is contained in:
feeeei
2026-07-15 10:51:08 +08:00
parent cf6aa1a5c3
commit 1acbb12c65
5 changed files with 15 additions and 17 deletions
+5 -6
View File
@@ -663,14 +663,13 @@ function generateGrokFiles(baseUrl: string, apiKey: string): FileConfig[] {
const isWindows = activeTab.value === 'windows'
const configDir = isWindows ? '%userprofile%\\.grok' : '~/.grok'
const configContent = `[models]
default = "sub2api-grok"
web_search = "sub2api-grok"
default = "grok"
web_search = "grok"
[model."sub2api-grok"]
[model."grok"]
model = "grok-4.5"
base_url = "${baseUrl}"
name = "Grok 4.5 via Sub2API"
description = "Grok 4.5 through a Sub2API Grok group"
name = "Grok 4.5"
api_key = "${apiKey}"
api_backend = "responses"
context_window = 1000000
@@ -1223,7 +1222,7 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
provider[platform].models = openaiModels
} else if (platform === 'grok') {
provider[platform].npm = '@ai-sdk/openai'
provider[platform].name = 'Grok via Sub2API'
provider[platform].name = 'Grok'
provider[platform].models = grokModels
}
@@ -44,7 +44,7 @@ describe('UseKeyModal', () => {
const grokConfig = wrapper.findAll('pre code')
.map((code) => code.text())
.find((content) => content.includes('[model."sub2api-grok"]'))
.find((content) => content.includes('[model."grok"]'))
expect(grokConfig).toBeDefined()
expect(grokConfig).toContain('model = "grok-4.5"')
expect(grokConfig).toContain('base_url = "https://example.com/v1"')
+2 -2
View File
@@ -168,8 +168,8 @@ export default {
grok: {
description: 'Configure Grok Build or OpenCode to send Responses API traffic through your Sub2API Grok group.',
configTomlHint: 'Back up an existing config.toml before merging this model entry. Run grok inspect after saving to verify the effective configuration.',
note: 'Save the file as ~/.grok/config.toml, then run grok inspect and select sub2api-grok from /model.',
noteWindows: 'Save the file as %USERPROFILE%\\.grok\\config.toml, then run grok inspect and select sub2api-grok from /model.',
note: 'Save the file as ~/.grok/config.toml, then run grok inspect and select grok from /model.',
noteWindows: 'Save the file as %USERPROFILE%\\.grok\\config.toml, then run grok inspect and select grok from /model.',
},
opencode: {
title: 'OpenCode Example',
+2 -2
View File
@@ -172,8 +172,8 @@ export default {
grok: {
description: '配置 Grok Build 或 OpenCode,让 Responses API 请求通过当前 Sub2API Grok 分组发送。',
configTomlHint: '如已有 config.toml,请先备份再合并此模型配置。保存后运行 grok inspect 验证生效配置。',
note: '保存为 ~/.grok/config.toml,然后运行 grok inspect,并在 /model 中选择 sub2api-grok。',
noteWindows: '保存为 %USERPROFILE%\\.grok\\config.toml,然后运行 grok inspect,并在 /model 中选择 sub2api-grok。'
note: '保存为 ~/.grok/config.toml,然后运行 grok inspect,并在 /model 中选择 grok。',
noteWindows: '保存为 %USERPROFILE%\\.grok\\config.toml,然后运行 grok inspect,并在 /model 中选择 grok。'
},
opencode: {
title: 'OpenCode 配置示例',