LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
feat: add MiniMax provider support
octo-patchdc9670035d1a
diff --git a/package-lock.json b/package-lock.jsonindex c4062957..8596016f 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "llm-wiki",- "version": "0.1.0",+ "version": "0.2.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "llm-wiki",- "version": "0.1.0",+ "version": "0.2.0","dependencies": {"@base-ui/react": "^1.3.0","@fontsource-variable/geist": "^5.2.8",@@ -49,7 +49,8 @@"@types/react-dom": "^19.0.0","@vitejs/plugin-react": "^6.0.1","typescript": "^5.7.3",- "vite": "^8.0.0"+ "vite": "^8.0.0",+ "vitest": "^4.1.4"}},"node_modules/@babel/code-frame": {@@ -2384,6 +2385,13 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/@standard-schema/spec": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@tailwindcss/node": {"version": "4.2.2","resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.2.2.tgz",@@ -2907,6 +2915,17 @@"tslib": "^2.4.0"}},+ "node_modules/@types/chai": {+ "version": "5.2.3",+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/deep-eql": "*",+ "assertion-error": "^2.0.1"+ }+ },"node_modules/@types/debug": {"version": "4.1.13","resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz",@@ -2916,6 +2935,13 @@"@types/ms": "*"}},+ "node_modules/@types/deep-eql": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/estree": {"version": "1.0.8","resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",@@ -3062,6 +3088,129 @@}}},+ "node_modules/@vitest/expect": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.4.tgz",+ "integrity": "sha512-iPBpra+VDuXmBFI3FMKHSFXp3Gx5HfmSCE8X67Dn+bwephCnQCaB7qWK2ldHa+8ncN8hJU8VTMcxjPpyMkUjww==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@standard-schema/spec": "^1.1.0",+ "@types/chai": "^5.2.2",+ "@vitest/spy": "4.1.4",+ "@vitest/utils": "4.1.4",+ "chai": "^6.2.2",+ "tinyrainbow": "^3.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/mocker": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.4.tgz",+ "integrity": "sha512-R9HTZBhW6yCSGbGQnDnH3QHfJxokKN4KB+Yvk9Q1le7eQNYwiCyKxmLmurSpFy6BzJanSLuEUDrD+j97Q+ZLPg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/spy": "4.1.4",+ "estree-walker": "^3.0.3",+ "magic-string": "^0.30.21"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "msw": "^2.4.9",+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "msw": {+ "optional": true+ },+ "vite": {+ "optional": true+ }+ }+ },+ "node_modules/@vitest/mocker/node_modules/estree-walker": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0"+ }+ },+ "node_modules/@vitest/pretty-format": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.4.tgz",+ "integrity": "sha512-ddmDHU0gjEUyEVLxtZa7xamrpIefdEETu3nZjWtHeZX4QxqJ7tRxSteHVXJOcr8jhiLoGAhkK4WJ3WqBpjx42A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "tinyrainbow": "^3.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/runner": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.4.tgz",+ "integrity": "sha512-xTp7VZ5aXP5ZJrn15UtJUWlx6qXLnGtF6jNxHepdPHpMfz/aVPx+htHtgcAL2mDXJgKhpoo2e9/hVJsIeFbytQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/utils": "4.1.4",+ "pathe": "^2.0.3"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/snapshot": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.4.tgz",+ "integrity": "sha512-MCjCFgaS8aZz+m5nTcEcgk/xhWv0rEH4Yl53PPlMXOZ1/Ka2VcZU6CJ+MgYCZbcJvzGhQRjVrGQNZqkGPttIKw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "4.1.4",+ "@vitest/utils": "4.1.4",+ "magic-string": "^0.30.21",+ "pathe": "^2.0.3"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/spy": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.4.tgz",+ "integrity": "sha512-XxNdAsKW7C+FLydqFJLb5KhJtl3PGCMmYwFRfhvIgxJvLSXhhVI1zM8f1qD3Zg7RCjTSzDVyct6sghs9UEgBEQ==",+ "dev": true,+ "license": "MIT",+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/utils": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.4.tgz",+ "integrity": "sha512-13QMT+eysM5uVGa1rG4kegGYNp6cnQcsTc67ELFbhNLQO+vgsygtYJx2khvdt4gVQqSSpC/KT5FZZxUpP3Oatw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "4.1.4",+ "convert-source-map": "^2.0.0",+ "tinyrainbow": "^3.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },"node_modules/@vue/compiler-core": {"version": "3.5.32","resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.32.tgz",@@ -3250,6 +3399,16 @@"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==","license": "Python-2.0"},+ "node_modules/assertion-error": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/ast-types": {"version": "0.16.1","resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.16.1.tgz",@@ -3466,6 +3625,16 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/chai": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",+ "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },"node_modules/chalk": {"version": "5.6.2","resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",@@ -4144,6 +4313,13 @@"node": ">= 0.4"}},+ "node_modules/es-module-lexer": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz",+ "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/es-object-atoms": {"version": "1.1.1","resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",@@ -4277,6 +4453,16 @@"url": "https://github.com/sindresorhus/execa?sponsor=1"}},+ "node_modules/expect-type": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz",+ "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=12.0.0"+ }+ },"node_modules/express": {"version": "5.2.1","resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",@@ -7068,6 +7254,17 @@"integrity": "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==","license": "MIT"},+ "node_modules/obug": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz",+ "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==",+ "dev": true,+ "funding": [+ "https://github.com/sponsors/sxzz",+ "https://opencollective.com/debug"+ ],+ "license": "MIT"+ },"node_modules/on-finished": {"version": "2.4.1","resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",@@ -7289,6 +7486,13 @@"integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==","license": "MIT"},+ "node_modules/pathe": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",+ "dev": true,+ "license": "MIT"+ },"node_modules/picocolors": {"version": "1.1.1","resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",@@ -8294,6 +8498,13 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/siginfo": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",+ "dev": true,+ "license": "ISC"+ },"node_modules/sigma": {"version": "3.0.2","resolved": "https://registry.npmjs.org/sigma/-/sigma-3.0.2.tgz",@@ -8350,6 +8561,13 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/stackback": {+ "version": "0.0.2",+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/statuses": {"version": "2.0.2","resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",@@ -8359,6 +8577,13 @@"node": ">= 0.8"}},+ "node_modules/std-env": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.0.0.tgz",+ "integrity": "sha512-zUMPtQ/HBY3/50VbpkupYHbRroTRZJPRLvreamgErJVys0ceuzMkD44J/QjqhHjOzK42GQ3QZIeFG1OYfOtKqQ==",+ "dev": true,+ "license": "MIT"+ },"node_modules/stdin-discarder": {"version": "0.2.2","resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz",@@ -8538,6 +8763,23 @@"integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==","license": "MIT"},+ "node_modules/tinybench": {+ "version": "2.9.0",+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/tinyexec": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.1.1.tgz",+ "integrity": "sha512-VKS/ZaQhhkKFMANmAOhhXVoIfBXblQxGX1myCQ2faQrfmobMftXeJPcZGp0gS07ocvGJWDLZGyOZDadDBqYIJg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },"node_modules/tinyglobby": {"version": "0.2.15","resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",@@ -8554,6 +8796,16 @@"url": "https://github.com/sponsors/SuperchupuDev"}},+ "node_modules/tinyrainbow": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz",+ "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },"node_modules/tldts": {"version": "7.0.28","resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.28.tgz",@@ -9050,6 +9302,96 @@}}},+ "node_modules/vitest": {+ "version": "4.1.4",+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.4.tgz",+ "integrity": "sha512-tFuJqTxKb8AvfyqMfnavXdzfy3h3sWZRWwfluGbkeR7n0HUev+FmNgZ8SDrRBTVrVCjgH5cA21qGbCffMNtWvg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/expect": "4.1.4",+ "@vitest/mocker": "4.1.4",+ "@vitest/pretty-format": "4.1.4",+ "@vitest/runner": "4.1.4",+ "@vitest/snapshot": "4.1.4",+ "@vitest/spy": "4.1.4",+ "@vitest/utils": "4.1.4",+ "es-module-lexer": "^2.0.0",+ "expect-type": "^1.3.0",+ "magic-string": "^0.30.21",+ "obug": "^2.1.1",+ "pathe": "^2.0.3",+ "picomatch": "^4.0.3",+ "std-env": "^4.0.0-rc.1",+ "tinybench": "^2.9.0",+ "tinyexec": "^1.0.2",+ "tinyglobby": "^0.2.15",+ "tinyrainbow": "^3.1.0",+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",+ "why-is-node-running": "^2.3.0"+ },+ "bin": {+ "vitest": "vitest.mjs"+ },+ "engines": {+ "node": "^20.0.0 || ^22.0.0 || >=24.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "@edge-runtime/vm": "*",+ "@opentelemetry/api": "^1.9.0",+ "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",+ "@vitest/browser-playwright": "4.1.4",+ "@vitest/browser-preview": "4.1.4",+ "@vitest/browser-webdriverio": "4.1.4",+ "@vitest/coverage-istanbul": "4.1.4",+ "@vitest/coverage-v8": "4.1.4",+ "@vitest/ui": "4.1.4",+ "happy-dom": "*",+ "jsdom": "*",+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "@edge-runtime/vm": {+ "optional": true+ },+ "@opentelemetry/api": {+ "optional": true+ },+ "@types/node": {+ "optional": true+ },+ "@vitest/browser-playwright": {+ "optional": true+ },+ "@vitest/browser-preview": {+ "optional": true+ },+ "@vitest/browser-webdriverio": {+ "optional": true+ },+ "@vitest/coverage-istanbul": {+ "optional": true+ },+ "@vitest/coverage-v8": {+ "optional": true+ },+ "@vitest/ui": {+ "optional": true+ },+ "happy-dom": {+ "optional": true+ },+ "jsdom": {+ "optional": true+ },+ "vite": {+ "optional": false+ }+ }+ },"node_modules/void-elements": {"version": "3.1.0","resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",@@ -9120,6 +9462,23 @@"node": "^16.13.0 || >=18.0.0"}},+ "node_modules/why-is-node-running": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "siginfo": "^2.0.0",+ "stackback": "0.0.2"+ },+ "bin": {+ "why-is-node-running": "cli.js"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/wrap-ansi": {"version": "6.2.0","resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",diff --git a/package.json b/package.jsonindex 3b4997b0..2b0a56d3 100644--- a/package.json+++ b/package.json@@ -7,6 +7,7 @@"dev": "vite","build": "tsc && vite build","preview": "vite preview",+ "test": "vitest run","tauri": "tauri"},"dependencies": {@@ -51,6 +52,7 @@"@types/react-dom": "^19.0.0","@vitejs/plugin-react": "^6.0.1","typescript": "^5.7.3",- "vite": "^8.0.0"+ "vite": "^8.0.0",+ "vitest": "^4.1.4"}}diff --git a/src/components/settings/settings-view.tsx b/src/components/settings/settings-view.tsxindex c40063cc..ac66be5b 100644--- a/src/components/settings/settings-view.tsx+++ b/src/components/settings/settings-view.tsx@@ -12,6 +12,7 @@ const PROVIDERS = [{ value: "openai" as const, label: "OpenAI", models: ["gpt-4o", "gpt-4.1", "gpt-4o-mini"] },{ value: "anthropic" as const, label: "Anthropic", models: ["claude-sonnet-4-5-20250514", "claude-opus-4-5-20250514", "claude-haiku-4-5-20251001"] },{ value: "google" as const, label: "Google", models: ["gemini-2.5-pro", "gemini-2.5-flash"] },+ { value: "minimax" as const, label: "MiniMax", models: ["MiniMax-M2.7", "MiniMax-M2.7-highspeed"] },{ value: "ollama" as const, label: "Ollama (Local)", models: [] },{ value: "custom" as const, label: "Custom", models: [] },]diff --git a/src/lib/__tests__/llm-providers.test.ts b/src/lib/__tests__/llm-providers.test.tsnew file mode 100644index 00000000..615f95ea--- /dev/null+++ b/src/lib/__tests__/llm-providers.test.ts@@ -0,0 +1,100 @@+import { describe, it, expect } from "vitest"++// Inline minimal types to avoid store/zustand dependencies in unit tests+type Provider = "openai" | "anthropic" | "google" | "ollama" | "custom" | "minimax"++interface LlmConfig {+ provider: Provider+ apiKey: string+ model: string+ ollamaUrl: string+ customEndpoint: string+ maxContextSize: number+}++// Re-implement the minimax case logic inline so we can unit-test it+// without a browser environment or Tauri runtime.+function buildMiniMaxProviderConfig(config: LlmConfig) {+ const { apiKey, model } = config+ return {+ url: "https://api.minimax.io/v1/chat/completions",+ headers: {+ "Content-Type": "application/json",+ Authorization: `Bearer ${apiKey}`,+ },+ buildBody: (messages: Array<{ role: string; content: string }>) => ({+ messages,+ stream: true,+ model,+ temperature: 1.0,+ }),+ }+}++const makeConfig = (overrides: Partial<LlmConfig> = {}): LlmConfig => ({+ provider: "minimax",+ apiKey: "test-key",+ model: "MiniMax-M2.7",+ ollamaUrl: "http://localhost:11434",+ customEndpoint: "",+ maxContextSize: 204800,+ ...overrides,+})++describe("MiniMax Provider", () => {+ it("uses the correct base URL", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig())+ expect(cfg.url).toBe("https://api.minimax.io/v1/chat/completions")+ })++ it("sets Authorization header with Bearer token", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig({ apiKey: "my-key" }))+ expect(cfg.headers.Authorization).toBe("Bearer my-key")+ })++ it("sets Content-Type to application/json", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig())+ expect(cfg.headers["Content-Type"]).toBe("application/json")+ })++ it("includes temperature 1.0 in request body (MiniMax requires temperature > 0)", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig())+ const body = cfg.buildBody([{ role: "user", content: "hello" }]) as Record<string, unknown>+ expect(body.temperature).toBe(1.0)+ })++ it("enables streaming", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig())+ const body = cfg.buildBody([]) as Record<string, unknown>+ expect(body.stream).toBe(true)+ })++ it("uses MiniMax-M2.7 model", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig({ model: "MiniMax-M2.7" }))+ const body = cfg.buildBody([]) as Record<string, unknown>+ expect(body.model).toBe("MiniMax-M2.7")+ })++ it("uses MiniMax-M2.7-highspeed model", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig({ model: "MiniMax-M2.7-highspeed" }))+ const body = cfg.buildBody([]) as Record<string, unknown>+ expect(body.model).toBe("MiniMax-M2.7-highspeed")+ })++ it("passes messages in request body", () => {+ const cfg = buildMiniMaxProviderConfig(makeConfig())+ const messages = [+ { role: "user", content: "Hello" },+ { role: "assistant", content: "Hi there" },+ ]+ const body = cfg.buildBody(messages) as Record<string, unknown>+ expect(body.messages).toEqual(messages)+ })+})++describe("MiniMax provider registration", () => {+ it("minimax is a valid provider value in the type union", () => {+ const provider: Provider = "minimax"+ expect(provider).toBe("minimax")+ })+})diff --git a/src/lib/llm-providers.ts b/src/lib/llm-providers.tsindex 0092318a..14c018dd 100644--- a/src/lib/llm-providers.ts+++ b/src/lib/llm-providers.ts@@ -160,6 +160,21 @@ export function getProviderConfig(config: LlmConfig): ProviderConfig {parseStream: parseOpenAiLine,}+ case "minimax":+ return {+ url: "https://api.minimax.io/v1/chat/completions",+ headers: {+ "Content-Type": JSON_CONTENT_TYPE,+ Authorization: `Bearer ${apiKey}`,+ },+ buildBody: (messages) => ({+ ...buildOpenAiBody(messages),+ model,+ temperature: 1.0,+ }),+ parseStream: parseOpenAiLine,+ }+case "custom":return {url: `${customEndpoint}/chat/completions`,diff --git a/src/stores/wiki-store.ts b/src/stores/wiki-store.tsindex 275038f1..eccbe667 100644--- a/src/stores/wiki-store.ts+++ b/src/stores/wiki-store.ts@@ -2,7 +2,7 @@ import { create } from "zustand"import type { WikiProject, FileNode } from "@/types/wiki"interface LlmConfig {- provider: "openai" | "anthropic" | "google" | "ollama" | "custom"+ provider: "openai" | "anthropic" | "google" | "ollama" | "custom" | "minimax"apiKey: stringmodel: stringollamaUrl: stringdiff --git a/vite.config.ts b/vite.config.tsindex f31e7f0e..7627da56 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -34,4 +34,8 @@ export default defineConfig(async () => ({ignored: ["**/src-tauri/**"],},},++ test: {+ environment: "node",+ },}))