mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-21 04:41:16 -05:00
Turn SYSTEM_PROMPT into a function so it always has the latest values
This commit is contained in:
@@ -17,7 +17,8 @@ import { ClaudeAsk, ClaudeSay, ClaudeSayTool } from "./shared/ExtensionMessage"
|
|||||||
import { Tool, ToolName } from "./shared/Tool"
|
import { Tool, ToolName } from "./shared/Tool"
|
||||||
import { ClaudeAskResponse } from "./shared/WebviewMessage"
|
import { ClaudeAskResponse } from "./shared/WebviewMessage"
|
||||||
|
|
||||||
const SYSTEM_PROMPT = `You are Claude Dev, a highly skilled software developer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
|
const SYSTEM_PROMPT =
|
||||||
|
() => `You are Claude Dev, a highly skilled software developer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
|
||||||
|
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -36,8 +37,9 @@ CAPABILITIES
|
|||||||
RULES
|
RULES
|
||||||
|
|
||||||
- Unless otherwise specified by the user, you MUST accomplish your task within the following directory: ${
|
- Unless otherwise specified by the user, you MUST accomplish your task within the following directory: ${
|
||||||
vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ?? path.join(os.homedir(), "Desktop")
|
vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ??
|
||||||
}
|
path.join(os.homedir(), "Desktop")
|
||||||
|
}
|
||||||
- Your current working directory is '${process.cwd()}', and you cannot \`cd\` into a different directory to complete a task. You are stuck operating from '${process.cwd()}', so be sure to pass in the appropriate 'path' parameter when using tools that require a path.
|
- Your current working directory is '${process.cwd()}', and you cannot \`cd\` into a different directory to complete a task. You are stuck operating from '${process.cwd()}', so be sure to pass in the appropriate 'path' parameter when using tools that require a path.
|
||||||
- If you do not know the contents of an existing file you need to edit, use the read_file tool to help you make informed changes. However if you have seen this file before, you can assume its contents have not changed since you last read it or wrote to it.
|
- If you do not know the contents of an existing file you need to edit, use the read_file tool to help you make informed changes. However if you have seen this file before, you can assume its contents have not changed since you last read it or wrote to it.
|
||||||
- When editing files, always provide the complete file content in your response, regardless of the extent of changes. The system handles diff generation automatically.
|
- When editing files, always provide the complete file content in your response, regardless of the extent of changes. The system handles diff generation automatically.
|
||||||
@@ -76,14 +78,14 @@ VSCode Visible Files: ${
|
|||||||
?.map((editor) => editor.document?.uri?.fsPath)
|
?.map((editor) => editor.document?.uri?.fsPath)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(", ") || "(No files open)"
|
.join(", ") || "(No files open)"
|
||||||
}
|
}
|
||||||
VSCode Opened Tabs: ${
|
VSCode Opened Tabs: ${
|
||||||
vscode.window.tabGroups.all
|
vscode.window.tabGroups.all
|
||||||
.flatMap((group) => group.tabs)
|
.flatMap((group) => group.tabs)
|
||||||
.map((tab) => (tab.input as vscode.TabInputText)?.uri?.fsPath)
|
.map((tab) => (tab.input as vscode.TabInputText)?.uri?.fsPath)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(", ") || "(No tabs open)"
|
.join(", ") || "(No tabs open)"
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const tools: Tool[] = [
|
const tools: Tool[] = [
|
||||||
@@ -623,7 +625,7 @@ export class ClaudeDev {
|
|||||||
model: "claude-3-5-sonnet-20240620", // https://docs.anthropic.com/en/docs/about-claude/models
|
model: "claude-3-5-sonnet-20240620", // https://docs.anthropic.com/en/docs/about-claude/models
|
||||||
// beta max tokens
|
// beta max tokens
|
||||||
max_tokens: 8192,
|
max_tokens: 8192,
|
||||||
system: SYSTEM_PROMPT,
|
system: SYSTEM_PROMPT(),
|
||||||
messages: (await this.providerRef.deref()?.getApiConversationHistory()) || [],
|
messages: (await this.providerRef.deref()?.getApiConversationHistory()) || [],
|
||||||
tools: tools,
|
tools: tools,
|
||||||
tool_choice: { type: "auto" },
|
tool_choice: { type: "auto" },
|
||||||
|
|||||||
Reference in New Issue
Block a user