mirror of
https://github.com/7836246/cursor2api.git
synced 2026-09-03 07:20:02 +08:00
fix: 修改提示词允许使用并行工具
- 明确告诉模型可以使用多个 ````json action``` 代码块以支持多工具并行调用,解决由于先前的"exactly one block"限制导致模型无法并发使用工具的问题。
This commit is contained in:
@@ -66,10 +66,10 @@ function buildToolInstructions(tools: AnthropicTool[], hasCommunicationTool: boo
|
||||
|
||||
const rules = hasCommunicationTool
|
||||
? `CRITICAL RULES:
|
||||
1. You MUST provide at least one \`\`\`json action ... \`\`\` block in every response.
|
||||
1. You MUST provide at least one \`\`\`json action ... \`\`\` block in every response. You can provide multiple blocks to execute actions in parallel.
|
||||
2. If you are waiting for me to give you a task, or you want to ask me a question, DO NOT run meaningless terminal commands. Instead, use the appropriate communication tool (e.g. attempt_completion, ask_followup_question).`
|
||||
: `CRITICAL RULES:
|
||||
1. If you need to perform an action, provide exactly one \`\`\`json action ... \`\`\` block.
|
||||
1. If you need to perform actions, you can provide one or multiple \`\`\`json action ... \`\`\` blocks to execute them in parallel.
|
||||
2. If you have finished your task, are waiting for me to give you a task, or just want to reply/ask a question, DO NOT output any JSON action block! Just reply with normal text. DO NOT run meaningless terminal commands (like "echo ready").`;
|
||||
|
||||
return `Hi! I need your help. For every step we take, please provide the action I should run formatted as a simple JSON block.
|
||||
@@ -153,9 +153,9 @@ export function convertToCursorRequest(req: AnthropicRequest): CursorChatRequest
|
||||
if (hasTools && msg.role === 'user') {
|
||||
const hasCommunicationTool = req.tools!.some(t => ['attempt_completion', 'ask_followup_question', 'AskFollowupQuestion'].includes(t.name));
|
||||
if (hasCommunicationTool) {
|
||||
text += '\n\n[Reminder: Please output a ```json action block for the action you want to take. If you have no task or want to respond, use AskFollowupQuestion or ask_followup_question or attempt_completion, DO NOT use Bash/execute_command]';
|
||||
text += '\n\n[Reminder: You can output multiple ```json action blocks to run tools in parallel. If you want to respond, use AskFollowupQuestion, DO NOT use Bash commands for chat.]';
|
||||
} else {
|
||||
text += '\n\n[Reminder: If you need to perform an action, output a ```json action block. If you just want to talk to me or are waiting for a task, DO NOT output any action block, just reply with plain text.]';
|
||||
text += '\n\n[Reminder: Output one or multiple ```json action blocks to take actions. To reply with text only, DO NOT output any action block.]';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user