forked from Kilo-Org/kilocode
-
Notifications
You must be signed in to change notification settings - Fork 0
Integration test: PRs #5370 + #5660 + #5704 merged together #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e06eb02
fix: preserve original line_ranges format in API history for anthropi…
f4d8487
Merge branch 'main' into fix/preserve-line-ranges-in-history
eliasyin eb222d7
Use Mistral SDK in `MistralHandler.streamFim`
wkordalski 4a67cde
fix(ui): add case-insensitive model search in ModelPicker
Patel230 fe5c575
docs(changeset): add case-insensitive model search
Patel230 5d1baba
fix: Improve Kimi model search and add fallback models
Patel230 a0172fa
Merge branch 'review/PR-5704' into review/combined-batch-1
jeremylongshore ab77ab1
Merge review/PR-5660 (resolved import conflict)
jeremylongshore a8187d3
Merge review/PR-5370 (resolved Task.ts conflict: keep dedup + rawInput)
jeremylongshore 4ee3d67
test: update mistral-fim.spec.ts to mock SDK instead of fetch()
jeremylongshore a9bd78b
fix(agent-runtime): fix doubled path in VSCode.applyEdit.spec.ts
jeremylongshore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| "webview-ui": patch | ||
| --- | ||
|
|
||
| Fix case-insensitive model search in ModelPicker | ||
|
|
||
| Users can now search for models regardless of casing. For example, searching for "kimi k2.5" will find models like "Kimi-K2.5-Instruct". This fixes model discovery issues when using Azure Cognitive Services or other OpenAI-compatible providers that return models with different casing. | ||
|
|
||
| Before: Search was case-sensitive, making it hard to find models | ||
| After: Search is case-insensitive for better discoverability |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "kilo-code": patch | ||
| --- | ||
|
|
||
| Fix Kimi model search and add Kimi models as fallback for OpenAI Compatible provider |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,12 +15,9 @@ import { ApiHandlerOptions } from "../../shared/api" | |
|
|
||
| import { convertToMistralMessages } from "../transform/mistral-format" | ||
| import { ApiStream } from "../transform/stream" | ||
| import { handleProviderError } from "./utils/error-handler" | ||
|
|
||
| import { BaseProvider } from "./base-provider" | ||
| import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from "../index" | ||
| import { DEFAULT_HEADERS } from "./constants" // kilocode_change | ||
| import { streamSse } from "../../services/autocomplete/continuedev/core/fetch/stream" // kilocode_change | ||
| import type { CompletionUsage } from "./openrouter" // kilocode_change | ||
| import type { FimHandler } from "./kilocode/FimHandler" // kilocode_change | ||
|
|
||
|
|
@@ -258,56 +255,50 @@ export class MistralHandler extends BaseProvider implements SingleCompletionHand | |
| ): AsyncGenerator<string> { | ||
| const { id: model, maxTokens } = this.getModel() | ||
|
|
||
| // Get the base URL for the model | ||
| // copy pasted from constructor, be sure to keep in sync | ||
| const baseUrl = model.startsWith("codestral-") | ||
| ? this.options.mistralCodestralUrl || "https://codestral.mistral.ai" | ||
| : "https://api.mistral.ai" | ||
|
|
||
| const endpoint = new URL("v1/fim/completions", baseUrl) | ||
|
|
||
| const headers: Record<string, string> = { | ||
| ...DEFAULT_HEADERS, | ||
| "Content-Type": "application/json", | ||
| Accept: "application/json", | ||
| Authorization: `Bearer ${this.options.mistralApiKey}`, | ||
| } | ||
|
|
||
| // temperature: 0.2 is mentioned as a sane example in mistral's docs | ||
| const temperature = 0.2 | ||
| const requestMaxTokens = 256 | ||
|
|
||
| const response = await fetch(endpoint, { | ||
| method: "POST", | ||
| body: JSON.stringify({ | ||
| model, | ||
| prompt: prefix, | ||
| suffix, | ||
| max_tokens: Math.min(requestMaxTokens, maxTokens ?? requestMaxTokens), | ||
| temperature, | ||
| stream: true, | ||
| }), | ||
| headers, | ||
| }) | ||
| const request = { | ||
| model, | ||
| temperature, | ||
| maxTokens: Math.min(requestMaxTokens, maxTokens ?? requestMaxTokens), | ||
| stream: true, | ||
| prompt: prefix, | ||
| suffix, | ||
| } | ||
|
|
||
| if (!response.ok) { | ||
| const errorText = await response.text() | ||
| throw new Error(`FIM streaming failed: ${response.status} ${response.statusText} - ${errorText}`) | ||
| let response | ||
| try { | ||
| response = await this.client.fim.stream(request) | ||
| } catch (error) { | ||
| const errorMessage = error instanceof Error ? error.message : String(error) | ||
| const apiError = new ApiProviderError(errorMessage, this.providerName, model, "streamFim") | ||
| TelemetryService.instance.captureException(apiError) | ||
| throw new Error(`Mistral FIM completion error: ${errorMessage}`) | ||
| } | ||
|
|
||
| for await (const data of streamSse(response)) { | ||
| const content = data.choices?.[0]?.delta?.content | ||
| if (content) { | ||
| for await (const ev of response) { | ||
| const data = ev.data | ||
|
|
||
| const content = data.choices[0]?.delta.content | ||
| if (typeof content === "string") { | ||
|
Comment on lines
+282
to
+285
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Unsafe data.choices[0] access streamFim now indexes data.choices[0] without guarding when choices is missing, which can throw at runtime and break streaming. This violates the requirement to explicitly handle null/empty edge cases. Agent Prompt
|
||
| yield content | ||
| } else if (content !== null && content !== undefined) { | ||
| for (const chunk of content) { | ||
| if (chunk.type === "text") { | ||
| yield chunk.text | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Call usage callback when available | ||
| // Note: Mistral FIM API returns usage in the final chunk with prompt_tokens and completion_tokens | ||
| if (data.usage && onUsage) { | ||
| onUsage({ | ||
| prompt_tokens: data.usage.prompt_tokens, | ||
| completion_tokens: data.usage.completion_tokens, | ||
| total_tokens: data.usage.total_tokens, | ||
| prompt_tokens: data.usage.promptTokens, | ||
| completion_tokens: data.usage.completionTokens, | ||
| total_tokens: data.usage.totalTokens, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Mistral fim tests stale
🐞 Bug⛯ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools