From d7a9c917fe4d252862d81beef74c54230b8937f8 Mon Sep 17 00:00:00 2001 From: 1837669410 <1837669410@qq.com> Date: Mon, 11 May 2026 16:58:50 +0800 Subject: [PATCH] Add Xiaomi MiMo model provider --- README.md | 7 ++- README.zh-CN.md | 7 ++- package.json | 2 +- src/main/backend/deepseekClient.ts | 70 +++++++++++++++++++++-- src/main/backend/settingsStore.ts | 4 ++ src/renderer/components/SettingsPanel.tsx | 9 +++ 6 files changed, 88 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7e02e0c..dd21116 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ It is designed for researchers, engineers, and students who want to quickly unde ## What It Does ✨ - 📄 Analyze academic paper PDFs. -- 🧠 Generate structured paper summaries with DeepSeek / Jiekou / MiniMax / GLM. +- 🧠 Generate structured paper summaries with DeepSeek / Jiekou / MiniMax / GLM / Xiaomi MiMo. - 🧮 Render Markdown, tables, and LaTeX formulas clearly. - 💻 Decide whether the paper needs core code. - 🧭 Plan a minimal core-code blueprint before writing files. @@ -19,7 +19,7 @@ It is designed for researchers, engineers, and students who want to quickly unde ## Core Workflow 🚀 -1. Select a provider (DeepSeek / Jiekou / MiniMax / GLM) and enter your API key in the sidebar. +1. Select a provider (DeepSeek / Jiekou / MiniMax / GLM / Xiaomi MiMo) and enter your API key in the sidebar. 2. Choose a model. 3. Select a paper PDF. 4. Start analysis. @@ -50,6 +50,7 @@ Paper2CoreCode supports multiple OpenAI-compatible model providers: - Jiekou: Claude, Gemini 3.1 preview, and GPT 5.5 models that work with the current chat completions endpoint. - MiniMax: `MiniMax-M2.7`, `MiniMax-M2.7-highspeed`, `MiniMax-M2.5`, `MiniMax-M2.5-highspeed`. - GLM: `glm-5.1`, `glm-5`, `glm-5-turbo`. +- Xiaomi MiMo: `mimo-v2.5-pro`, `mimo-v2-pro`, `mimo-v2.5`. API keys and model choices are stored separately for each provider in the local app user data directory. Switching providers reloads that provider's own saved key and model. @@ -65,7 +66,7 @@ Version tags like `v0.1.3` trigger the release workflow, which builds platform p - Electron + TypeScript - React + Vite -- DeepSeek / Jiekou / MiniMax / GLM APIs (OpenAI-compatible) +- DeepSeek / Jiekou / MiniMax / GLM / Xiaomi MiMo APIs (OpenAI-compatible) - `pdf-parse` - `react-markdown` + KaTeX - `electron-builder` diff --git a/README.zh-CN.md b/README.zh-CN.md index d7c2153..1d2fade 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -9,7 +9,7 @@ Paper2CoreCode 是一款桌面端论文阅读与最小核心代码生成工具 ## 它能做什么 ✨ - 📄 分析学术论文 PDF。 -- 🧠 使用 DeepSeek / Jiekou / MiniMax / GLM 生成结构化论文总结。 +- 🧠 使用 DeepSeek / Jiekou / MiniMax / GLM / Xiaomi MiMo 生成结构化论文总结。 - 🧮 清晰渲染 Markdown、表格和 LaTeX 公式。 - 💻 判断论文是否需要生成核心代码。 - 🧭 在写入文件前规划最小核心代码蓝图。 @@ -19,7 +19,7 @@ Paper2CoreCode 是一款桌面端论文阅读与最小核心代码生成工具 ## 核心流程 🚀 -1. 在侧边栏选择模型供应商(DeepSeek / Jiekou / MiniMax / GLM)并配置 API Key。 +1. 在侧边栏选择模型供应商(DeepSeek / Jiekou / MiniMax / GLM / Xiaomi MiMo)并配置 API Key。 2. 选择模型。 3. 选择论文 PDF。 4. 开始分析。 @@ -50,6 +50,7 @@ Paper2CoreCode 支持多个 OpenAI-compatible 模型供应商: - Jiekou:当前 chat completions 流程可用的 Claude、Gemini 3.1 preview 和 GPT 5.5 模型。 - MiniMax:`MiniMax-M2.7`、`MiniMax-M2.7-highspeed`、`MiniMax-M2.5`、`MiniMax-M2.5-highspeed`。 - GLM:`glm-5.1`、`glm-5`、`glm-5-turbo`。 +- Xiaomi MiMo:`mimo-v2.5-pro`、`mimo-v2-pro`、`mimo-v2.5`。 API Key 和模型选择会按供应商分别保存在本机应用用户数据目录中。切换供应商时,应用会重新加载该供应商自己的 API Key 和模型。 @@ -65,7 +66,7 @@ Pull Request 会通过 GitHub Actions 在 Windows、macOS 和 Linux 上运行 `n - Electron + TypeScript - React + Vite -- DeepSeek / Jiekou / MiniMax / GLM APIs(OpenAI-compatible) +- DeepSeek / Jiekou / MiniMax / GLM / Xiaomi MiMo APIs(OpenAI-compatible) - `pdf-parse` - `react-markdown` + KaTeX - `electron-builder` diff --git a/package.json b/package.json index 84372a4..8ab61c2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "paper2corecode", "version": "0.1.3", - "description": "Desktop app to analyze papers and extract core code with DeepSeek / Jiekou / MiniMax / GLM", + "description": "Desktop app to analyze papers and extract core code with DeepSeek / Jiekou / MiniMax / GLM / Xiaomi MiMo", "author": { "name": "lemonmindyes", "email": "lemonmindyes@users.noreply.github.com" diff --git a/src/main/backend/deepseekClient.ts b/src/main/backend/deepseekClient.ts index e865343..41c2d9e 100644 --- a/src/main/backend/deepseekClient.ts +++ b/src/main/backend/deepseekClient.ts @@ -18,11 +18,22 @@ interface GlmModelConfig { thinking?: { type: 'enabled' } } +interface MimoModelConfig { + maxTokens?: number + tokenParam?: 'max_tokens' | 'max_completion_tokens' + temperature?: number + topP?: number + frequencyPenalty?: number + presencePenalty?: number + stop?: null +} + const PROVIDER_CONFIGS: Record = { deepseek: { baseURL: 'https://api.deepseek.com/v1' }, jiekou: { baseURL: 'https://api.jiekou.ai/openai' }, minimax: { baseURL: 'https://api.minimaxi.com/v1' }, glm: { baseURL: 'https://open.bigmodel.cn/api/paas/v4' }, + mimo: { baseURL: 'https://api.xiaomimimo.com/v1' }, } const JIEKOU_MODEL_CONFIGS: Record = { @@ -48,6 +59,36 @@ const GLM_MODEL_CONFIGS: Record = { 'glm-5-turbo': { maxTokens: 65536, temperature: 1.0, thinking: { type: 'enabled' } }, } +const MIMO_MODEL_CONFIGS: Record = { + 'mimo-v2.5-pro': { + maxTokens: 131072, + tokenParam: 'max_completion_tokens', + temperature: 1.0, + topP: 0.95, + frequencyPenalty: 0, + presencePenalty: 0, + stop: null, + }, + 'mimo-v2-pro': { + maxTokens: 131072, + tokenParam: 'max_completion_tokens', + temperature: 1.0, + topP: 0.95, + frequencyPenalty: 0, + presencePenalty: 0, + stop: null, + }, + 'mimo-v2.5': { + maxTokens: 32768, + tokenParam: 'max_completion_tokens', + temperature: 1.0, + topP: 0.95, + frequencyPenalty: 0, + presencePenalty: 0, + stop: null, + }, +} + export function loadConfig() { const config = getActiveSettings() if (!config.apiKey || config.apiKey.trim() === '') { @@ -75,7 +116,9 @@ export async function callDeepSeek( ? JIEKOU_MODEL_CONFIGS[config.model] : config.provider === 'glm' ? GLM_MODEL_CONFIGS[config.model] - : undefined + : config.provider === 'mimo' + ? MIMO_MODEL_CONFIGS[config.model] + : undefined if (modelCfg && 'unsupportedReason' in modelCfg && modelCfg.unsupportedReason) { throw new AppError( @@ -92,6 +135,10 @@ export async function callDeepSeek( max_tokens?: number max_completion_tokens?: number temperature?: number + top_p?: number + frequency_penalty?: number + presence_penalty?: number + stop?: null thinking?: { type: string } } = { model: config.model, @@ -99,11 +146,10 @@ export async function callDeepSeek( stream: true, } - if (modelCfg?.maxTokens) { - requestBody.max_tokens = modelCfg.maxTokens - } if (modelCfg && 'tokenParam' in modelCfg && modelCfg.tokenParam && modelCfg.maxTokens) { requestBody[modelCfg.tokenParam] = modelCfg.maxTokens + } else if (modelCfg?.maxTokens) { + requestBody.max_tokens = modelCfg.maxTokens } if (modelCfg && 'temperature' in modelCfg && modelCfg.temperature !== undefined) { @@ -114,6 +160,22 @@ export async function callDeepSeek( requestBody.thinking = modelCfg.thinking } + if (modelCfg && 'topP' in modelCfg && modelCfg.topP !== undefined) { + requestBody.top_p = modelCfg.topP + } + + if (modelCfg && 'frequencyPenalty' in modelCfg && modelCfg.frequencyPenalty !== undefined) { + requestBody.frequency_penalty = modelCfg.frequencyPenalty + } + + if (modelCfg && 'presencePenalty' in modelCfg && modelCfg.presencePenalty !== undefined) { + requestBody.presence_penalty = modelCfg.presencePenalty + } + + if (modelCfg && 'stop' in modelCfg && modelCfg.stop === null) { + requestBody.stop = null + } + const response = await fetch(`${providerCfg.baseURL}/chat/completions`, { method: 'POST', headers: { diff --git a/src/main/backend/settingsStore.ts b/src/main/backend/settingsStore.ts index b586d81..1557e4d 100644 --- a/src/main/backend/settingsStore.ts +++ b/src/main/backend/settingsStore.ts @@ -34,6 +34,10 @@ export const PROVIDER_SETTINGS: Record