Skip to content

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

Merge remote-tracking branch 'origin/main'

nash_subfa44979d229
diff --cc src/lib/__tests__/llm-providers.test.ts
index 32ad1db7,6a4a5cf8..02dc32e8
--- a/src/lib/__tests__/llm-providers.test.ts
+++ b/src/lib/__tests__/llm-providers.test.ts
@@@ -2,10 -2,52 +2,10 @@@ import { describe, it, expect } from "v
import { buildAnthropicUrl, parseGoogleLine, getProviderConfig } from "../llm-providers"
import type { LlmConfig as RealLlmConfig } from "@/stores/wiki-store"
-// Inline minimal types to avoid store/zustand dependencies in unit tests
-type Provider = "openai" | "anthropic" | "google" | "azure" | "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. Keep this in sync with
-// the `case "minimax":` branch in src/lib/llm-providers.ts.
-function buildMiniMaxProviderConfig(config: LlmConfig) {
- const { apiKey, model, customEndpoint } = config
- const base = (customEndpoint || "https://api.minimax.io/anthropic").replace(/\/+$/, "")
- // MiniMax's /anthropic endpoint requires Authorization: Bearer, NOT
- // x-api-key. Its CORS preflight rejects x-api-key entirely. See the
- // requiresBearerAuth() helper in src/lib/llm-providers.ts.
- return {
- url: `${base}/v1/messages`,
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${apiKey}`,
- },
- buildBody: (messages: Array<{ role: string; content: string }>) => {
- const systemMessages = messages.filter((m) => m.role === "system")
- const conversationMessages = messages.filter((m) => m.role !== "system")
- const system = systemMessages.map((m) => m.content).join("\n") || undefined
- return {
- messages: conversationMessages,
- ...(system !== undefined ? { system } : {}),
- stream: true,
- max_tokens: 4096,
- model,
- }
- },
- }
-}
-
-const makeConfig = (overrides: Partial<LlmConfig> = {}): LlmConfig => ({
+const makeConfig = (overrides: Partial<RealLlmConfig> = {}): RealLlmConfig => ({
provider: "minimax",
apiKey: "test-key",
- model: "MiniMax-M2.7",
+ model: "MiniMax-M3",
ollamaUrl: "http://localhost:11434",
customEndpoint: "",
maxContextSize: 204800,
@@@ -49,13 -91,13 +49,13 @@@ describe("MiniMax Provider", () =>
})
it("carries the model in the body", () => {
- const cfg = getProviderConfig(makeConfig({ model: "MiniMax-M2.7" }))
- const cfg = buildMiniMaxProviderConfig(makeConfig({ model: "MiniMax-M3" }))
++ const cfg = getProviderConfig(makeConfig({ model: "MiniMax-M3" }))
const body = cfg.buildBody([]) as Record<string, unknown>
- expect(body.model).toBe("MiniMax-M2.7")
+ expect(body.model).toBe("MiniMax-M3")
})
- it("separates system messages from conversation (Anthropic convention)", () => {
- const cfg = buildMiniMaxProviderConfig(makeConfig())
+ it("separates system messages from conversation and marks the system prompt cacheable", () => {
+ const cfg = getProviderConfig(makeConfig())
const body = cfg.buildBody([
{ role: "system", content: "You are helpful" },
{ role: "user", content: "Hello" },