mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Merge pull request #419 from QwenLM/fix/v0.0.8-nightly.7
Fix: Critical Issues in v0.0.8-nightly.7
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(
|
const { contextParts, newIdeContext } = this.getIdeContextParts(
|
||||||
this.forceFullIdeContext || this.getHistory().length === 0,
|
this.forceFullIdeContext || this.getHistory().length === 0,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ export class OpenAIContentGenerator implements ContentGenerator {
|
|||||||
: isDashScopeProvider
|
: isDashScopeProvider
|
||||||
? {
|
? {
|
||||||
'X-DashScope-CacheControl': 'enable',
|
'X-DashScope-CacheControl': 'enable',
|
||||||
|
'X-DashScope-UserAgent': userAgent,
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { BaseTool, Icon, ToolResult } from './tools.js';
|
import { BaseTool, Icon, ToolResult } from './tools.js';
|
||||||
import { Type } from '@google/genai';
|
|
||||||
import { SchemaValidator } from '../utils/schemaValidator.js';
|
import { SchemaValidator } from '../utils/schemaValidator.js';
|
||||||
import { getErrorMessage } from '../utils/errors.js';
|
import { getErrorMessage } from '../utils/errors.js';
|
||||||
import { Config } from '../config/config.js';
|
import { Config } from '../config/config.js';
|
||||||
@@ -57,10 +56,10 @@ export class WebSearchTool extends BaseTool<
|
|||||||
'Performs a web search using the Tavily API and returns a concise answer with sources. Requires the TAVILY_API_KEY environment variable.',
|
'Performs a web search using the Tavily API and returns a concise answer with sources. Requires the TAVILY_API_KEY environment variable.',
|
||||||
Icon.Globe,
|
Icon.Globe,
|
||||||
{
|
{
|
||||||
type: Type.OBJECT,
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
query: {
|
query: {
|
||||||
type: Type.STRING,
|
type: 'string',
|
||||||
description: 'The search query to find information on the web.',
|
description: 'The search query to find information on the web.',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user