mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:57:40 +00:00
feat: Provider/Mistral full support for Mistral on OpenClaw 🇫🇷 (#23845)
* Onboard: add Mistral auth choice and CLI flags * Onboard/Auth: add Mistral provider config defaults * Auth choice: wire Mistral API-key flow * Onboard non-interactive: support --mistral-api-key * Media understanding: add Mistral Voxtral audio provider * Changelog: note Mistral onboarding and media support * Docs: add Mistral provider and onboarding/media references * Tests: cover Mistral media registry/defaults and auth mapping * Memory: add Mistral embeddings provider support * Onboarding: refresh Mistral model metadata * Docs: document Mistral embeddings and endpoints * Memory: persist Mistral embedding client state in managers * Memory: add regressions for mistral provider wiring * Gateway: add live tool probe retry helper * Gateway: cover live tool probe retry helper * Gateway: retry malformed live tool-read probe responses * Memory: support plain-text batch error bodies * Tests: add Mistral Voxtral live transcription smoke * Docs: add Mistral live audio test command * Revert: remove Mistral live voice test and docs entry * Onboard: re-export Mistral default model ref from models * Changelog: credit joeVenner for Mistral work * fix: include Mistral in auto audio key fallback * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Shakker <shakkerdroid@gmail.com>
This commit is contained in:
@@ -7,6 +7,8 @@ import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
applyAuthProfileConfig,
|
||||
applyLitellmProviderConfig,
|
||||
applyMistralConfig,
|
||||
applyMistralProviderConfig,
|
||||
applyMinimaxApiConfig,
|
||||
applyMinimaxApiProviderConfig,
|
||||
applyOpencodeZenConfig,
|
||||
@@ -22,6 +24,7 @@ import {
|
||||
applyZaiConfig,
|
||||
applyZaiProviderConfig,
|
||||
OPENROUTER_DEFAULT_MODEL_REF,
|
||||
MISTRAL_DEFAULT_MODEL_REF,
|
||||
SYNTHETIC_DEFAULT_MODEL_ID,
|
||||
SYNTHETIC_DEFAULT_MODEL_REF,
|
||||
XAI_DEFAULT_MODEL_REF,
|
||||
@@ -540,9 +543,46 @@ describe("applyXaiProviderConfig", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyMistralConfig", () => {
|
||||
it("adds Mistral provider with correct settings", () => {
|
||||
const cfg = applyMistralConfig({});
|
||||
expect(cfg.models?.providers?.mistral).toMatchObject({
|
||||
baseUrl: "https://api.mistral.ai/v1",
|
||||
api: "openai-completions",
|
||||
});
|
||||
expect(cfg.agents?.defaults?.model?.primary).toBe(MISTRAL_DEFAULT_MODEL_REF);
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyMistralProviderConfig", () => {
|
||||
it("merges Mistral models and keeps existing provider overrides", () => {
|
||||
const cfg = applyMistralProviderConfig(
|
||||
createLegacyProviderConfig({
|
||||
providerId: "mistral",
|
||||
api: "anthropic-messages",
|
||||
modelId: "custom-model",
|
||||
modelName: "Custom",
|
||||
}),
|
||||
);
|
||||
|
||||
expect(cfg.models?.providers?.mistral?.baseUrl).toBe("https://api.mistral.ai/v1");
|
||||
expect(cfg.models?.providers?.mistral?.api).toBe("openai-completions");
|
||||
expect(cfg.models?.providers?.mistral?.apiKey).toBe("old-key");
|
||||
expect(cfg.models?.providers?.mistral?.models.map((m) => m.id)).toEqual([
|
||||
"custom-model",
|
||||
"mistral-large-latest",
|
||||
]);
|
||||
const mistralDefault = cfg.models?.providers?.mistral?.models.find(
|
||||
(model) => model.id === "mistral-large-latest",
|
||||
);
|
||||
expect(mistralDefault?.contextWindow).toBe(262144);
|
||||
expect(mistralDefault?.maxTokens).toBe(262144);
|
||||
});
|
||||
});
|
||||
|
||||
describe("fallback preservation helpers", () => {
|
||||
it("preserves existing model fallbacks", () => {
|
||||
const fallbackCases = [applyMinimaxApiConfig, applyXaiConfig] as const;
|
||||
const fallbackCases = [applyMinimaxApiConfig, applyXaiConfig, applyMistralConfig] as const;
|
||||
for (const applyConfig of fallbackCases) {
|
||||
const cfg = applyConfig(createConfigWithFallbacks());
|
||||
expectFallbacksPreserved(cfg);
|
||||
@@ -563,6 +603,11 @@ describe("provider alias defaults", () => {
|
||||
modelRef: XAI_DEFAULT_MODEL_REF,
|
||||
alias: "Grok",
|
||||
},
|
||||
{
|
||||
applyConfig: () => applyMistralProviderConfig({}),
|
||||
modelRef: MISTRAL_DEFAULT_MODEL_REF,
|
||||
alias: "Mistral",
|
||||
},
|
||||
] as const;
|
||||
for (const testCase of aliasCases) {
|
||||
const cfg = testCase.applyConfig();
|
||||
|
||||
Reference in New Issue
Block a user