fix: add MiniMax highspeed variants and deduplicate model list
- Add MiniMax-M2.7/M2.5/M2.1/M2 -highspeed variants for both international and China providers (#17) - Deduplicate models in /available-models response to fix repeated entries when using Copilot or other providers (#18) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -86,13 +86,13 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
label: 'MiniMax',
|
||||
value: 'minimax',
|
||||
base_url: 'https://api.minimax.io/anthropic/v1',
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.5', 'MiniMax-M2.1', 'MiniMax-M2'],
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.7-highspeed', 'MiniMax-M2.5', 'MiniMax-M2.5-highspeed', 'MiniMax-M2.1', 'MiniMax-M2.1-highspeed', 'MiniMax-M2', 'MiniMax-M2-highspeed'],
|
||||
},
|
||||
{
|
||||
label: 'MiniMax (China)',
|
||||
value: 'minimax-cn',
|
||||
base_url: 'https://api.minimaxi.com/v1',
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.5', 'MiniMax-M2.1', 'MiniMax-M2'],
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.7-highspeed', 'MiniMax-M2.5', 'MiniMax-M2.5-highspeed', 'MiniMax-M2.1', 'MiniMax-M2.1-highspeed', 'MiniMax-M2', 'MiniMax-M2-highspeed'],
|
||||
},
|
||||
{
|
||||
label: 'Alibaba Cloud',
|
||||
|
||||
@@ -513,21 +513,40 @@ fsRoutes.get('/api/hermes/available-models', async (ctx) => {
|
||||
for (const result of results) {
|
||||
if (result.status === 'fulfilled' && result.value.models.length > 0) {
|
||||
const { key, label, base_url, models } = result.value
|
||||
groups.push({ provider: key, label, base_url, models })
|
||||
groups.push({ provider: key, label, base_url, models: [...new Set(models)] })
|
||||
} else if (result.status === 'rejected') {
|
||||
console.error(`[available-models] Failed: ${result.reason?.message || result.reason}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Deduplicate models within each group and merge groups with the same provider key
|
||||
const dedupedGroups: typeof groups = []
|
||||
const seenProviders = new Map<string, number>()
|
||||
for (const g of groups) {
|
||||
g.models = [...new Set(g.models)]
|
||||
const existingIdx = seenProviders.get(g.provider)
|
||||
if (existingIdx !== undefined) {
|
||||
// Merge models into existing group
|
||||
const existing = dedupedGroups[existingIdx]
|
||||
const existingSet = new Set(existing.models)
|
||||
for (const m of g.models) {
|
||||
if (!existingSet.has(m)) existing.models.push(m)
|
||||
}
|
||||
} else {
|
||||
seenProviders.set(g.provider, dedupedGroups.length)
|
||||
dedupedGroups.push(g)
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: if no providers returned models, fall back to config.yaml parsing
|
||||
if (groups.length === 0) {
|
||||
if (dedupedGroups.length === 0) {
|
||||
const fallback = buildModelGroups(config)
|
||||
ctx.body = fallback
|
||||
return
|
||||
}
|
||||
|
||||
ctx.body = { default: currentDefault, groups }
|
||||
ctx.body = { default: currentDefault, groups: dedupedGroups }
|
||||
} catch (err: any) {
|
||||
ctx.status = 500
|
||||
ctx.body = { error: err.message }
|
||||
|
||||
@@ -86,13 +86,13 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
label: 'MiniMax',
|
||||
value: 'minimax',
|
||||
base_url: 'https://api.minimax.io/anthropic/v1',
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.5', 'MiniMax-M2.1', 'MiniMax-M2'],
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.7-highspeed', 'MiniMax-M2.5', 'MiniMax-M2.5-highspeed', 'MiniMax-M2.1', 'MiniMax-M2.1-highspeed', 'MiniMax-M2', 'MiniMax-M2-highspeed'],
|
||||
},
|
||||
{
|
||||
label: 'MiniMax (China)',
|
||||
value: 'minimax-cn',
|
||||
base_url: 'https://api.minimaxi.com/v1',
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.5', 'MiniMax-M2.1', 'MiniMax-M2'],
|
||||
models: ['MiniMax-M2.7', 'MiniMax-M2.7-highspeed', 'MiniMax-M2.5', 'MiniMax-M2.5-highspeed', 'MiniMax-M2.1', 'MiniMax-M2.1-highspeed', 'MiniMax-M2', 'MiniMax-M2-highspeed'],
|
||||
},
|
||||
{
|
||||
label: 'Alibaba Cloud',
|
||||
|
||||
Reference in New Issue
Block a user