豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit ac97070

Browse files
committed
Optimize Claude 4.6 prompt configurations with type adjustments and conditional rendering for tool instructions
1 parent 7f4d8d9 commit ac97070

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/extension/prompts/node/agent/anthropicPrompts.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { BasePromptElementProps, PromptElement, PromptElementProps, PromptSizing } from '@vscode/prompt-tsx';
6+
import { BasePromptElementProps, PromptElement, PromptElementProps, PromptPiece, PromptSizing } from '@vscode/prompt-tsx';
77
import type { LanguageModelToolInformation } from 'vscode';
88
import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
99
import { CUSTOM_TOOL_SEARCH_NAME, isAnthropicContextEditingEnabled, isAnthropicCustomToolSearchEnabled, isAnthropicToolSearchEnabled, nonDeferredToolNames, TOOL_SEARCH_TOOL_NAME } from '../../../../platform/networking/common/anthropic';
@@ -541,11 +541,11 @@ class Claude46OptimizedBasePrompt extends PromptElement<DefaultAgentPromptProps>
541541
super(props);
542542
}
543543

544-
protected renderExplorationGuidance(_tools: ReturnType<typeof detectToolCapabilities>): any {
544+
protected renderExplorationGuidance(_tools: ReturnType<typeof detectToolCapabilities>): PromptPiece | undefined {
545545
return undefined;
546546
}
547547

548-
protected renderParallelizationStrategy(): any {
548+
protected renderParallelizationStrategy(): PromptPiece | undefined {
549549
return undefined;
550550
}
551551

@@ -716,10 +716,10 @@ class AnthropicReminderInstructionsOptimized extends PromptElement<ReminderInstr
716716
const contextEditingEnabled = isAnthropicContextEditingEnabled(this.props.endpoint, this.configurationService, this.experimentationService);
717717

718718
return <>
719-
When using {ToolName.EditFile}, use line comments with `{EXISTING_CODE_MARKER}` to represent unchanged regions.<br />
720-
When using {ToolName.ReplaceString}, include 3-5 lines of unchanged context before and after the target string.<br />
721-
For multiple independent edits, use {ToolName.MultiReplaceString} simultaneously rather than sequential {ToolName.ReplaceString} calls.<br />
722-
Prefer {ToolName.ReplaceString} or {ToolName.MultiReplaceString} over {ToolName.EditFile}.<br />
719+
{this.props.hasEditFileTool && <>When using {ToolName.EditFile}, use line comments with `{EXISTING_CODE_MARKER}` to represent unchanged regions.<br /></>}
720+
{this.props.hasReplaceStringTool && <>When using {ToolName.ReplaceString}, include 3-5 lines of unchanged context before and after the target string.<br /></>}
721+
{this.props.hasMultiReplaceStringTool && <>For multiple independent edits, use {ToolName.MultiReplaceString} simultaneously rather than sequential {ToolName.ReplaceString} calls.<br /></>}
722+
{this.props.hasEditFileTool && this.props.hasReplaceStringTool && <>Prefer {ToolName.ReplaceString}{this.props.hasMultiReplaceStringTool ? <> or {ToolName.MultiReplaceString}</> : ''} over {ToolName.EditFile}.<br /></>}
723723
Do NOT create markdown files to document changes unless requested.<br />
724724
{contextEditingEnabled && <>
725725
Do NOT view your memory directory before every task. Your context is managed automatically. Only use memory as described in memoryInstructions.<br />

0 commit comments

Comments
 (0)