mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
fix: switch system prompt to avoid malformed tool_calls (#650)
* fix: switch system prompt to avoid malformed tool_calls * fix: circular dependency issue and configurable tool-call style * fix: regExp issue
This commit is contained in:
@@ -7,11 +7,7 @@
|
||||
import type { Content, GenerateContentConfig } from '@google/genai';
|
||||
import type { GeminiClient } from '../core/client.js';
|
||||
import type { EditToolParams } from '../tools/edit.js';
|
||||
import { EditTool } from '../tools/edit.js';
|
||||
import { WriteFileTool } from '../tools/write-file.js';
|
||||
import { ReadFileTool } from '../tools/read-file.js';
|
||||
import { ReadManyFilesTool } from '../tools/read-many-files.js';
|
||||
import { GrepTool } from '../tools/grep.js';
|
||||
import { ToolNames } from '../tools/tool-names.js';
|
||||
import { LruCache } from './LruCache.js';
|
||||
import { DEFAULT_QWEN_FLASH_MODEL } from '../config/models.js';
|
||||
import {
|
||||
@@ -85,14 +81,14 @@ async function findLastEditTimestamp(
|
||||
const history = (await client.getHistory()) ?? [];
|
||||
|
||||
// Tools that may reference the file path in their FunctionResponse `output`.
|
||||
const toolsInResp = new Set([
|
||||
WriteFileTool.Name,
|
||||
EditTool.Name,
|
||||
ReadManyFilesTool.Name,
|
||||
GrepTool.Name,
|
||||
const toolsInResp = new Set<string>([
|
||||
ToolNames.WRITE_FILE,
|
||||
ToolNames.EDIT,
|
||||
ToolNames.READ_MANY_FILES,
|
||||
ToolNames.GREP,
|
||||
]);
|
||||
// Tools that may reference the file path in their FunctionCall `args`.
|
||||
const toolsInCall = new Set([...toolsInResp, ReadFileTool.Name]);
|
||||
const toolsInCall = new Set<string>([...toolsInResp, ToolNames.READ_FILE]);
|
||||
|
||||
// Iterate backwards to find the most recent relevant action.
|
||||
for (const entry of history.slice().reverse()) {
|
||||
|
||||
Reference in New Issue
Block a user