@@ -259,19 +259,23 @@ export class ChatPanel {
259259 this . panel . webview . postMessage ( { command : 'hideStopButton' } ) ;
260260 }
261261
262+ // Function to load prompt from file
263+ private loadAgentPrompt ( ) : string {
264+ // Resolve path to resources/agentPrompt.txt
265+ const filePath = this . context . asAbsolutePath ( path . join ( 'src' , 'resources' , 'agentPrompt.txt' ) ) ;
266+ try {
267+ const prmompt = fs . readFileSync ( filePath , 'utf-8' ) ;
268+ return prmompt . trim ( ) ;
269+ } catch ( error ) {
270+ throw new Error ( `Failed to load agentPrompt.txt: ${ ( error as Error ) . message } ` ) ;
271+ }
272+ }
273+
262274 private async callModelApi ( message : any , webviewOutputChannel : WebviewOutputChannel ) : Promise < string | null > {
263275 const tools = message . webSearch ? apiTools . getAllTools ( ) : null ;
264276 const normalSystemPrompt = "用markdown输出。如果有数学公式要用$$包裹,每条一行不要换行。如果有流程图(Mermaid)里的每个字符串都要用引号包裹。" ;
265277 const systemPrompt = message . webSearch
266- ? `每次回答问题前,不要太过自信, 先用tool收集一下信息,比如可以上网搜索或者查询记忆。
267- 第一步一定是先用读取记忆的tool检查以往的记忆里有没有相关信息。然后再看是否需要上网搜索。最后再看是否需要调用其他工具。一个tool没有返回就别急着推理下一步。
268- 每次只调用一个工具,然后结束输出等返回。然后再调用下一个工具。
269- 你要先理解任务,搞清楚哪些信息你是不知道的, 用记忆结构查询记忆,如果能查到就采用,
270- 然后指定任务计划,规划好分几个步骤,用tool去逐步去推进。
271- 等你觉得信息获得足够了再开始决策和输出结论。
272- 每次任务开始,你要先调取老记忆,看看以前有没有执行过类似任务,吸取经验。
273- 每次对话结束,如果获得了新的知识或者有感悟,或者我纠正了你某些内容,你可以用工具存储这些记忆。
274- ` + normalSystemPrompt
278+ ? this . loadAgentPrompt ( ) + normalSystemPrompt
275279 : normalSystemPrompt ;
276280
277281 return await callDeepSeekApi (
0 commit comments