mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
remove read_folder context before user input
This commit is contained in:
@@ -603,6 +603,7 @@ export async function loadCliConfig(
|
|||||||
interactive,
|
interactive,
|
||||||
trustedFolder,
|
trustedFolder,
|
||||||
shouldUseNodePtyShell: settings.shouldUseNodePtyShell,
|
shouldUseNodePtyShell: settings.shouldUseNodePtyShell,
|
||||||
|
skipStartupContext: settings.skipStartupContext,
|
||||||
skipNextSpeakerCheck: settings.skipNextSpeakerCheck,
|
skipNextSpeakerCheck: settings.skipNextSpeakerCheck,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -595,12 +595,22 @@ export const SETTINGS_SCHEMA = {
|
|||||||
description: 'The API key for the Tavily API.',
|
description: 'The API key for the Tavily API.',
|
||||||
showInDialog: false,
|
showInDialog: false,
|
||||||
},
|
},
|
||||||
|
skipStartupContext: {
|
||||||
|
type: 'boolean',
|
||||||
|
label: 'Skip Startup Context',
|
||||||
|
category: 'General',
|
||||||
|
requiresRestart: false,
|
||||||
|
default: true,
|
||||||
|
description:
|
||||||
|
'Do not prepend environment/folder structure context or the initial acknowledgment message.',
|
||||||
|
showInDialog: true,
|
||||||
|
},
|
||||||
skipNextSpeakerCheck: {
|
skipNextSpeakerCheck: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
label: 'Skip Next Speaker Check',
|
label: 'Skip Next Speaker Check',
|
||||||
category: 'General',
|
category: 'General',
|
||||||
requiresRestart: false,
|
requiresRestart: false,
|
||||||
default: false,
|
default: true,
|
||||||
description: 'Skip the next speaker check.',
|
description: 'Skip the next speaker check.',
|
||||||
showInDialog: true,
|
showInDialog: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ export interface ConfigParameters {
|
|||||||
interactive?: boolean;
|
interactive?: boolean;
|
||||||
trustedFolder?: boolean;
|
trustedFolder?: boolean;
|
||||||
shouldUseNodePtyShell?: boolean;
|
shouldUseNodePtyShell?: boolean;
|
||||||
|
skipStartupContext?: boolean;
|
||||||
skipNextSpeakerCheck?: boolean;
|
skipNextSpeakerCheck?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,6 +318,7 @@ export class Config {
|
|||||||
private readonly interactive: boolean;
|
private readonly interactive: boolean;
|
||||||
private readonly trustedFolder: boolean | undefined;
|
private readonly trustedFolder: boolean | undefined;
|
||||||
private readonly shouldUseNodePtyShell: boolean;
|
private readonly shouldUseNodePtyShell: boolean;
|
||||||
|
private readonly skipStartupContext: boolean;
|
||||||
private readonly skipNextSpeakerCheck: boolean;
|
private readonly skipNextSpeakerCheck: boolean;
|
||||||
private initialized: boolean = false;
|
private initialized: boolean = false;
|
||||||
|
|
||||||
@@ -398,7 +400,8 @@ export class Config {
|
|||||||
this.interactive = params.interactive ?? false;
|
this.interactive = params.interactive ?? false;
|
||||||
this.trustedFolder = params.trustedFolder;
|
this.trustedFolder = params.trustedFolder;
|
||||||
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
|
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
|
||||||
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? false;
|
this.skipStartupContext = params.skipStartupContext ?? true;
|
||||||
|
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? true;
|
||||||
|
|
||||||
// Web search
|
// Web search
|
||||||
this.tavilyApiKey = params.tavilyApiKey;
|
this.tavilyApiKey = params.tavilyApiKey;
|
||||||
@@ -857,6 +860,10 @@ export class Config {
|
|||||||
return this.shouldUseNodePtyShell;
|
return this.shouldUseNodePtyShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSkipStartupContext(): boolean {
|
||||||
|
return this.skipStartupContext;
|
||||||
|
}
|
||||||
|
|
||||||
getSkipNextSpeakerCheck(): boolean {
|
getSkipNextSpeakerCheck(): boolean {
|
||||||
return this.skipNextSpeakerCheck;
|
return this.skipNextSpeakerCheck;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,19 +228,24 @@ export class GeminiClient {
|
|||||||
|
|
||||||
async startChat(extraHistory?: Content[]): Promise<GeminiChat> {
|
async startChat(extraHistory?: Content[]): Promise<GeminiChat> {
|
||||||
this.forceFullIdeContext = true;
|
this.forceFullIdeContext = true;
|
||||||
const envParts = await getEnvironmentContext(this.config);
|
const envParts = this.config.getSkipStartupContext()
|
||||||
|
? []
|
||||||
|
: await getEnvironmentContext(this.config);
|
||||||
const toolRegistry = this.config.getToolRegistry();
|
const toolRegistry = this.config.getToolRegistry();
|
||||||
const toolDeclarations = toolRegistry.getFunctionDeclarations();
|
const toolDeclarations = toolRegistry.getFunctionDeclarations();
|
||||||
const tools: Tool[] = [{ functionDeclarations: toolDeclarations }];
|
const tools: Tool[] = [{ functionDeclarations: toolDeclarations }];
|
||||||
const history: Content[] = [
|
const history: Content[] = [
|
||||||
{
|
...(
|
||||||
role: 'user',
|
envParts.length
|
||||||
parts: envParts,
|
? [
|
||||||
},
|
{ role: 'user', parts: envParts },
|
||||||
{
|
{
|
||||||
role: 'model',
|
role: 'model',
|
||||||
parts: [{ text: 'Got it. Thanks for the context!' }],
|
parts: [{ text: 'Got it. Thanks for the context!' }],
|
||||||
},
|
},
|
||||||
|
]
|
||||||
|
: []
|
||||||
|
),
|
||||||
...(extraHistory ?? []),
|
...(extraHistory ?? []),
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -781,11 +781,15 @@ export class SubAgentScope {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const envParts = await getEnvironmentContext(this.runtimeContext);
|
const envParts = this.runtimeContext.getSkipStartupContext()
|
||||||
const envHistory: Content[] = [
|
? []
|
||||||
{ role: 'user', parts: envParts },
|
: await getEnvironmentContext(this.runtimeContext);
|
||||||
{ role: 'model', parts: [{ text: 'Got it. Thanks for the context!' }] },
|
const envHistory: Content[] = envParts.length
|
||||||
];
|
? [
|
||||||
|
{ role: 'user', parts: envParts },
|
||||||
|
{ role: 'model', parts: [{ text: 'Got it. Thanks for the context!' }] },
|
||||||
|
]
|
||||||
|
: [];
|
||||||
|
|
||||||
const start_history = [
|
const start_history = [
|
||||||
...envHistory,
|
...envHistory,
|
||||||
|
|||||||
Reference in New Issue
Block a user