Skip to content

fix(model): add missing MiniMax models#1637

Merged
kaizhou-lab merged 1 commit intoiOfficeAI:mainfrom
FencyJay:fix/minimax-add-optional-models
Mar 26, 2026
Merged

fix(model): add missing MiniMax models#1637
kaizhou-lab merged 1 commit intoiOfficeAI:mainfrom
FencyJay:fix/minimax-add-optional-models

Conversation

@FencyJay
Copy link
Copy Markdown
Contributor

@FencyJay FencyJay commented Mar 23, 2026

Pull Request

Description

  • Add the missing MiniMax model entries so AionUi can map and call the available MiniMax reasoning models correctly.
  • Fix the ACP/model bridge path so MiniMax requests no longer fail with reasoning_content type mismatch errors.
  • Add regression coverage for the model bridge and ACP connector logic to prevent the issue from coming back.

Related Issues

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • Tested on macOS
  • Tested on Windows
  • Tested on Linux
  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • My changes generate no new warnings or errors

Thank you for contributing to AionUi! 🎉

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

kaizhou-lab commented Mar 24, 2026

Hi! 看了一下这个 PR,发现几个需要处理的问题:


🔴 测试在非 Windows CI 上会失败

文件tests/unit/acpConnectors.test.ts,第 223–228 行

it('splits npx package into command and args and keeps Windows-safe command normalization', () => {
    const config = createGenericSpawnConfig('npx @pkg/cli', '/cwd', ['--acp'], undefined, { PATH: '/usr/bin' });

    expect(config.command).toBe('chcp 65001 >/dev/null && npx');

这个测试没有调用 setWindowsPlatform(),在 macOS/Linux CI 上 isWindowsfalse,npx 分支走的是 spawnCommand = resolvedNpx(即 'npx'),不会加 chcp 65001 前缀,所以断言 toBe('chcp 65001 >/dev/null && npx') 会直接失败。

Unit Tests (ubuntu-latest)Unit Tests (macos-14) 都会挂在这里。

建议:拆成两个 case,一个 setLinuxPlatform() 断言 'npx',一个 setWindowsPlatform() 断言 'chcp 65001 >/dev/null && npx'


🟠 getNpxPackageBinaryName 回退逻辑对 scoped package 生成错误的 binary name

文件src/process/agent/acp/acpConnectors.ts,第 72–80 行

const packageName = npxPackage.split('@')[0] || npxPackage;

对于 scoped package 如 @some-org/[email protected]split('@') 得到 ['', 'some-org/some-tool', '1.0.0'][0] 是空字符串(falsy),|| npxPackage 回退到完整字符串,最终 binary name 会变成 [email protected]——版本号被带进去了。

当前三个已知包有显式 if 覆盖不受影响,但回退路径在未来新增后端时会出问题。建议先 strip 版本号再提取 bare name:

const withoutVersion = npxPackage.replace(/@[\d][^/]*$/, '');
const slashIndex = withoutVersion.lastIndexOf('/');
const bareName = slashIndex >= 0 ? withoutVersion.slice(slashIndex + 1) : withoutVersion.replace(/^@/, '');
return `${bareName}.cmd`;

🟡 getNpmCommandFromNpx 回退可能误匹配路径中的 "npx"

文件src/process/agent/acp/acpConnectors.ts,第 65–70 行

function getNpmCommandFromNpx(npxCommand: string): string {
  const normalized = npxCommand.trim();
  if (/npx\.cmd$/i.test(normalized)) return normalized.replace(/npx\.cmd$/i, 'npm.cmd');
  if (/npx$/i.test(normalized)) return normalized.replace(/npx$/i, 'npm');
  return normalized.replace(/npx/i, 'npm');
}

最后一行 normalized.replace(/npx/i, 'npm') 没有锚点,会替换字符串中第一个 "npx" 出现位置。如果路径类似 C:\Users\npxadmin\bin\something,会把目录名中的 npx 替换成 npm。前两个正则已覆盖常见场景(npx.cmdnpx 结尾),实际触发概率不高,但建议改为替换最后一个出现位置:

// Replace the last occurrence of "npx" (most likely the binary name)
const lastIndex = normalized.toLowerCase().lastIndexOf('npx');
if (lastIndex >= 0) {
  return normalized.slice(0, lastIndex) + 'npm' + normalized.slice(lastIndex + 3);
}
return normalized;

@FencyJay FencyJay force-pushed the fix/minimax-add-optional-models branch from 2e1a2cd to 089a894 Compare March 24, 2026 12:41
@FencyJay
Copy link
Copy Markdown
Contributor Author

FencyJay commented Mar 24, 2026

谢谢你的审核,太详细了。
这次我把分支历史做了清理,当前 PR 只保留 MiniMax 相关修复,不再混入之前的 ACP 提交。

@kaizhou-lab kaizhou-lab merged commit 4ecbed7 into iOfficeAI:main Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 调用 MiniMax 的推理模型有问题

2 participants