@@ -142,12 +142,10 @@ def _setup(self):
142142 system_content += f" * writemd工具:支持多种模式(覆盖、追加、修改、插入、智能替换、章节更新)\n "
143143 system_content += f" * update_template工具:专门用于模板操作,支持章节级别更新\n "
144144 system_content += f"- 模板操作工具,让AI更方便地操作模板:\n "
145- system_content += f" * extract_headers: 快速提取模板中的所有标题,了解结构\n "
146- system_content += f" * get_structure_summary: 获取模板结构摘要\n "
147145 system_content += f" * analyze_template: 深度分析模板结构和内容\n "
148146 system_content += f" * get_section_content: 查看指定章节内容\n "
149- system_content += f" * update_section_content: 更新章节内容(支持多种模式) \n "
150- system_content += f" * add_new_section : 添加新章节\n "
147+ system_content += f" * update_section_content: 更新章节内容\n "
148+ system_content += f" * add_section : 添加新章节\n "
151149 system_content += f"- 生成论文时必须严格遵循模板的格式、结构和风格\n "
152150 system_content += f"- 如果模板有特定的章节要求,请保持这些章节结构\n "
153151 system_content += f"- 最终论文应该是一个完整的、格式规范的学术文档\n "
@@ -199,15 +197,15 @@ def _setup(self):
199197 "type" : "function" ,
200198 "function" : {
201199 "name" : "update_template" ,
202- "description" : "专门用于更新论文文件的工具,支持章节级别的更新 " ,
200+ "description" : "专门用于更新论文文件的工具,只支持章节级别更新,必须指定章节名称 " ,
203201 "parameters" : {
204202 "type" : "object" ,
205203 "properties" : {
206204 "template_name" : {"type" : "string" , "description" : "论文文件名,默认为paper.md" },
207205 "content" : {"type" : "string" , "description" : "要更新的内容" },
208- "section" : {"type" : "string" , "description" : "要更新的章节名称(可选 )" }
206+ "section" : {"type" : "string" , "description" : "要更新的章节名称(必需 )" }
209207 },
210- "required" : ["content" ],
208+ "required" : ["content" , "section" ],
211209 },
212210 },
213211 }
@@ -273,45 +271,18 @@ def _setup(self):
273271 },
274272 }
275273
276- add_new_section_tool = {
274+ add_section_tool = {
277275 "type" : "function" ,
278276 "function" : {
279- "name" : "add_new_section " ,
280- "description" : "在paper.md文件中指定父章节下添加新章节 " ,
277+ "name" : "add_section " ,
278+ "description" : "在paper.md文件末尾添加新章节 " ,
281279 "parameters" : {
282280 "type" : "object" ,
283281 "properties" : {
284- "parent_section" : {"type" : "string" , "description" : "父章节标题" },
285282 "section_title" : {"type" : "string" , "description" : "新章节标题" },
286283 "content" : {"type" : "string" , "description" : "新章节内容" , "default" : "" }
287284 },
288- "required" : ["parent_section" , "section_title" ],
289- },
290- },
291- }
292-
293- extract_headers_tool = {
294- "type" : "function" ,
295- "function" : {
296- "name" : "extract_headers" ,
297- "description" : "从paper.md文件中提取所有标题信息,快速了解文档结构" ,
298- "parameters" : {
299- "type" : "object" ,
300- "properties" : {},
301- "required" : [],
302- },
303- },
304- }
305-
306- get_structure_summary_tool = {
307- "type" : "function" ,
308- "function" : {
309- "name" : "get_structure_summary" ,
310- "description" : "获取paper.md文件的内容结构摘要,显示所有标题的层级关系" ,
311- "parameters" : {
312- "type" : "object" ,
313- "properties" : {},
314- "required" : [],
285+ "required" : ["section_title" ],
315286 },
316287 },
317288 }
@@ -330,13 +301,7 @@ def _setup(self):
330301 "analyze_template" : self .template_agent_tools .analyze_template ,
331302 "get_section_content" : self .template_agent_tools .get_section_content ,
332303 "update_section_content" : self .template_agent_tools .update_section_content ,
333- "add_new_section" : self .template_agent_tools .add_new_section ,
334- "remove_section" : self .template_agent_tools .remove_section ,
335- "reorder_sections" : self .template_agent_tools .reorder_sections ,
336- "format_template" : self .template_agent_tools .format_template ,
337- "get_template_help" : self .template_agent_tools .get_template_help ,
338- "extract_headers" : self .template_agent_tools .extract_headers_from_content ,
339- "get_structure_summary" : self .template_agent_tools .get_content_structure_summary
304+ "add_section" : self .template_agent_tools .add_section
340305 })
341306
342307 # 将模板工具定义添加到tools列表
@@ -348,9 +313,7 @@ def _setup(self):
348313 analyze_template_tool ,
349314 get_section_content_tool ,
350315 update_section_content_tool ,
351- add_new_section_tool ,
352- extract_headers_tool ,
353- get_structure_summary_tool
316+ add_section_tool
354317 ]
355318 else :
356319 # 没有模板时,只注册基础工具
0 commit comments