mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
remove read_folder context before user input
This commit is contained in:
@@ -232,6 +232,7 @@ export interface ConfigParameters {
|
||||
interactive?: boolean;
|
||||
trustedFolder?: boolean;
|
||||
shouldUseNodePtyShell?: boolean;
|
||||
skipStartupContext?: boolean;
|
||||
skipNextSpeakerCheck?: boolean;
|
||||
}
|
||||
|
||||
@@ -317,6 +318,7 @@ export class Config {
|
||||
private readonly interactive: boolean;
|
||||
private readonly trustedFolder: boolean | undefined;
|
||||
private readonly shouldUseNodePtyShell: boolean;
|
||||
private readonly skipStartupContext: boolean;
|
||||
private readonly skipNextSpeakerCheck: boolean;
|
||||
private initialized: boolean = false;
|
||||
|
||||
@@ -398,7 +400,8 @@ export class Config {
|
||||
this.interactive = params.interactive ?? false;
|
||||
this.trustedFolder = params.trustedFolder;
|
||||
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
|
||||
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? false;
|
||||
this.skipStartupContext = params.skipStartupContext ?? true;
|
||||
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? true;
|
||||
|
||||
// Web search
|
||||
this.tavilyApiKey = params.tavilyApiKey;
|
||||
@@ -857,6 +860,10 @@ export class Config {
|
||||
return this.shouldUseNodePtyShell;
|
||||
}
|
||||
|
||||
getSkipStartupContext(): boolean {
|
||||
return this.skipStartupContext;
|
||||
}
|
||||
|
||||
getSkipNextSpeakerCheck(): boolean {
|
||||
return this.skipNextSpeakerCheck;
|
||||
}
|
||||
|
||||
@@ -228,19 +228,24 @@ export class GeminiClient {
|
||||
|
||||
async startChat(extraHistory?: Content[]): Promise<GeminiChat> {
|
||||
this.forceFullIdeContext = true;
|
||||
const envParts = await getEnvironmentContext(this.config);
|
||||
const envParts = this.config.getSkipStartupContext()
|
||||
? []
|
||||
: await getEnvironmentContext(this.config);
|
||||
const toolRegistry = this.config.getToolRegistry();
|
||||
const toolDeclarations = toolRegistry.getFunctionDeclarations();
|
||||
const tools: Tool[] = [{ functionDeclarations: toolDeclarations }];
|
||||
const history: Content[] = [
|
||||
{
|
||||
role: 'user',
|
||||
parts: envParts,
|
||||
},
|
||||
{
|
||||
role: 'model',
|
||||
parts: [{ text: 'Got it. Thanks for the context!' }],
|
||||
},
|
||||
...(
|
||||
envParts.length
|
||||
? [
|
||||
{ role: 'user', parts: envParts },
|
||||
{
|
||||
role: 'model',
|
||||
parts: [{ text: 'Got it. Thanks for the context!' }],
|
||||
},
|
||||
]
|
||||
: []
|
||||
),
|
||||
...(extraHistory ?? []),
|
||||
];
|
||||
try {
|
||||
|
||||
@@ -781,11 +781,15 @@ export class SubAgentScope {
|
||||
);
|
||||
}
|
||||
|
||||
const envParts = await getEnvironmentContext(this.runtimeContext);
|
||||
const envHistory: Content[] = [
|
||||
{ role: 'user', parts: envParts },
|
||||
{ role: 'model', parts: [{ text: 'Got it. Thanks for the context!' }] },
|
||||
];
|
||||
const envParts = this.runtimeContext.getSkipStartupContext()
|
||||
? []
|
||||
: await getEnvironmentContext(this.runtimeContext);
|
||||
const envHistory: Content[] = envParts.length
|
||||
? [
|
||||
{ role: 'user', parts: envParts },
|
||||
{ role: 'model', parts: [{ text: 'Got it. Thanks for the context!' }] },
|
||||
]
|
||||
: [];
|
||||
|
||||
const start_history = [
|
||||
...envHistory,
|
||||
|
||||
Reference in New Issue
Block a user