mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix: invalid tool call with IDE companion feature enabled
This commit is contained in:
@@ -485,7 +485,24 @@ export class GeminiClient {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.config.getIdeModeFeature() && this.config.getIdeMode()) {
|
||||
// Prevent context updates from being sent while a tool call is
|
||||
// waiting for a response. The Qwen API requires that a functionResponse
|
||||
// part from the user immediately follows a functionCall part from the model
|
||||
// in the conversation history . The IDE context is not discarded; it will
|
||||
// be included in the next regular message sent to the model.
|
||||
const history = this.getHistory();
|
||||
const lastMessage =
|
||||
history.length > 0 ? history[history.length - 1] : undefined;
|
||||
const hasPendingToolCall =
|
||||
!!lastMessage &&
|
||||
lastMessage.role === 'model' &&
|
||||
(lastMessage.parts?.some((p) => 'functionCall' in p) || false);
|
||||
|
||||
if (
|
||||
this.config.getIdeModeFeature() &&
|
||||
this.config.getIdeMode() &&
|
||||
!hasPendingToolCall
|
||||
) {
|
||||
const { contextParts, newIdeContext } = this.getIdeContextParts(
|
||||
this.forceFullIdeContext || this.getHistory().length === 0,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user