Skip to content

Commit bc3af52

Browse files
authored
Merge pull request #1022 from d-oit/mistral
API Provider: Mistral
2 parents fc6f19f + 9724a80 commit bc3af52

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/api/providers/mistral.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ export class MistralHandler implements ApiHandler {
2525
throw new Error("Mistral API key is required")
2626
}
2727

28-
this.options = options
28+
// Set default model ID if not provided
29+
this.options = {
30+
...options,
31+
apiModelId: options.apiModelId || mistralDefaultModelId,
32+
}
33+
2934
const baseUrl = this.getBaseUrl()
3035
console.debug(`[Roo Code] MistralHandler using baseUrl: ${baseUrl}`)
3136
this.client = new Mistral({
@@ -36,6 +41,7 @@ export class MistralHandler implements ApiHandler {
3641

3742
private getBaseUrl(): string {
3843
const modelId = this.options.apiModelId ?? mistralDefaultModelId
44+
console.debug(`[Roo Code] MistralHandler using modelId: ${modelId}`)
3945
if (modelId?.startsWith("codestral-")) {
4046
return this.options.mistralCodestralUrl || "https://codestral.mistral.ai"
4147
}
@@ -45,7 +51,7 @@ export class MistralHandler implements ApiHandler {
4551
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
4652
const response = await this.client.chat.stream({
4753
model: this.options.apiModelId || mistralDefaultModelId,
48-
messages: convertToMistralMessages(messages),
54+
messages: [{ role: "system", content: systemPrompt }, ...convertToMistralMessages(messages)],
4955
maxTokens: this.options.includeMaxTokens ? this.getModel().info.maxTokens : undefined,
5056
temperature: this.options.modelTemperature ?? MISTRAL_DEFAULT_TEMPERATURE,
5157
})

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,15 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A
321321
color: "var(--vscode-descriptionForeground)",
322322
}}>
323323
This key is stored locally and only used to make API requests from this extension.
324-
{!apiConfiguration?.mistralApiKey && (
325-
<VSCodeLink
326-
href="https://console.mistral.ai/"
327-
style={{
328-
display: "inline",
329-
fontSize: "inherit",
330-
}}>
331-
You can get a La Plateforme (api.mistral.ai) / Codestral (codestral.mistral.ai) API key
332-
by signing up here.
333-
</VSCodeLink>
334-
)}
324+
<VSCodeLink
325+
href="https://console.mistral.ai/"
326+
style={{
327+
display: "inline",
328+
fontSize: "inherit",
329+
}}>
330+
You can get a La Plateforme (api.mistral.ai) or Codestral (codestral.mistral.ai) API key by
331+
signing up here.
332+
</VSCodeLink>
335333
</p>
336334

337335
{(apiConfiguration?.apiModelId?.startsWith("codestral-") ||

0 commit comments

Comments
 (0)