jarvis-ai-assistant 0.1.125__py3-none-any.whl → 0.1.128__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jarvis-ai-assistant might be problematic. Click here for more details.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +205 -187
- jarvis/jarvis_code_agent/code_agent.py +116 -109
- jarvis/jarvis_code_agent/patch.py +157 -138
- jarvis/jarvis_code_agent/shell_input_handler.py +22 -0
- jarvis/jarvis_codebase/main.py +314 -288
- jarvis/jarvis_dev/main.py +695 -716
- jarvis/jarvis_lsp/base.py +0 -12
- jarvis/jarvis_lsp/cpp.py +0 -9
- jarvis/jarvis_lsp/go.py +0 -9
- jarvis/jarvis_lsp/python.py +0 -28
- jarvis/jarvis_lsp/registry.py +0 -1
- jarvis/jarvis_lsp/rust.py +0 -9
- jarvis/jarvis_multi_agent/__init__.py +52 -52
- jarvis/jarvis_platform/base.py +6 -5
- jarvis/jarvis_platform_manager/main.py +1 -1
- jarvis/jarvis_rag/main.py +250 -186
- jarvis/jarvis_smart_shell/main.py +0 -1
- jarvis/jarvis_tools/ask_codebase.py +10 -9
- jarvis/jarvis_tools/ask_user.py +2 -2
- jarvis/jarvis_tools/base.py +4 -4
- jarvis/jarvis_tools/chdir.py +28 -28
- jarvis/jarvis_tools/code_review.py +44 -39
- jarvis/jarvis_tools/create_code_agent.py +4 -4
- jarvis/jarvis_tools/create_sub_agent.py +7 -7
- jarvis/jarvis_tools/execute_shell.py +53 -23
- jarvis/jarvis_tools/execute_shell_script.py +3 -3
- jarvis/jarvis_tools/file_operation.py +70 -41
- jarvis/jarvis_tools/git_commiter.py +61 -51
- jarvis/jarvis_tools/lsp_find_definition.py +7 -7
- jarvis/jarvis_tools/lsp_prepare_rename.py +7 -7
- jarvis/jarvis_tools/methodology.py +6 -6
- jarvis/jarvis_tools/rag.py +5 -5
- jarvis/jarvis_tools/read_webpage.py +52 -32
- jarvis/jarvis_tools/registry.py +167 -180
- jarvis/jarvis_tools/search_web.py +66 -41
- jarvis/jarvis_tools/select_code_files.py +3 -3
- jarvis/jarvis_tools/tool_generator.py +68 -55
- jarvis/jarvis_utils/methodology.py +77 -59
- jarvis/jarvis_utils/output.py +1 -0
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/METADATA +31 -17
- jarvis_ai_assistant-0.1.128.dist-info/RECORD +74 -0
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/WHEEL +1 -1
- jarvis/jarvis_tools/lsp_validate_edit.py +0 -141
- jarvis/jarvis_tools/read_code.py +0 -192
- jarvis_ai_assistant-0.1.125.dist-info/RECORD +0 -75
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.125.dist-info → jarvis_ai_assistant-0.1.128.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/jarvis_agent/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@ from typing import Any, Callable, List, Optional, Tuple, Union
|
|
|
3
3
|
|
|
4
4
|
from prompt_toolkit import prompt
|
|
5
5
|
import yaml
|
|
6
|
+
from yaspin import yaspin
|
|
6
7
|
|
|
7
8
|
from jarvis.jarvis_agent.output_handler import OutputHandler
|
|
8
9
|
from jarvis.jarvis_platform.base import BasePlatform
|
|
@@ -66,9 +67,9 @@ class Agent:
|
|
|
66
67
|
if model_name is not None:
|
|
67
68
|
self.model.set_model_name(model_name)
|
|
68
69
|
|
|
70
|
+
self.model.set_suppress_output(False)
|
|
69
71
|
|
|
70
72
|
self.output_handler = output_handler
|
|
71
|
-
|
|
72
73
|
|
|
73
74
|
self.record_methodology = record_methodology if record_methodology is not None else is_record_methodology()
|
|
74
75
|
self.use_methodology = use_methodology if use_methodology is not None else is_use_methodology()
|
|
@@ -83,15 +84,15 @@ class Agent:
|
|
|
83
84
|
|
|
84
85
|
self.execute_tool_confirm = execute_tool_confirm if execute_tool_confirm is not None else is_execute_tool_confirm()
|
|
85
86
|
|
|
86
|
-
self.summary_prompt = summary_prompt if summary_prompt else f"""
|
|
87
|
+
self.summary_prompt = summary_prompt if summary_prompt else f"""请生成任务执行的简明总结报告,包括:
|
|
87
88
|
|
|
88
|
-
1.
|
|
89
|
-
2.
|
|
90
|
-
3.
|
|
91
|
-
4.
|
|
92
|
-
5.
|
|
89
|
+
1. 任务目标:任务重述
|
|
90
|
+
2. 执行结果:成功/失败
|
|
91
|
+
3. 关键信息:执行过程中提取的重要信息
|
|
92
|
+
4. 重要发现:任何值得注意的发现
|
|
93
|
+
5. 后续建议:如果有的话
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
请使用简洁的要点描述,突出重要信息。
|
|
95
96
|
"""
|
|
96
97
|
|
|
97
98
|
self.max_token_count = max_context_length if max_context_length is not None else get_max_token_count()
|
|
@@ -101,8 +102,8 @@ Please describe in concise bullet points, highlighting important information.
|
|
|
101
102
|
PrettyOutput.print(welcome_message, OutputType.SYSTEM)
|
|
102
103
|
|
|
103
104
|
action_prompt = """
|
|
104
|
-
# 🧰
|
|
105
|
-
|
|
105
|
+
# 🧰 可用操作
|
|
106
|
+
以下是您可以使用的操作:
|
|
106
107
|
"""
|
|
107
108
|
|
|
108
109
|
# 添加工具列表概览
|
|
@@ -122,19 +123,19 @@ The following actions are at your disposal:
|
|
|
122
123
|
|
|
123
124
|
# 添加工具使用总结
|
|
124
125
|
action_prompt += """
|
|
125
|
-
# ❗
|
|
126
|
-
1.
|
|
127
|
-
2.
|
|
128
|
-
3.
|
|
129
|
-
4.
|
|
130
|
-
5.
|
|
126
|
+
# ❗ 重要操作使用规则
|
|
127
|
+
1. 一次只使用一个操作
|
|
128
|
+
2. 严格按照每个操作的格式执行
|
|
129
|
+
3. 等待操作结果后再进行下一个操作
|
|
130
|
+
4. 处理完结果后再调用新的操作
|
|
131
|
+
5. 如果对操作使用不清楚,请请求帮助
|
|
131
132
|
"""
|
|
132
133
|
|
|
133
134
|
complete_prompt = ""
|
|
134
135
|
if self.auto_complete:
|
|
135
136
|
complete_prompt = """
|
|
136
|
-
##
|
|
137
|
-
|
|
137
|
+
## 任务完成
|
|
138
|
+
当任务完成时,你应该打印以下信息:
|
|
138
139
|
<!!!COMPLETE!!!>
|
|
139
140
|
"""
|
|
140
141
|
|
|
@@ -165,6 +166,7 @@ The following actions are at your disposal:
|
|
|
165
166
|
message, need_return = handler(message, self)
|
|
166
167
|
if need_return:
|
|
167
168
|
return message
|
|
169
|
+
PrettyOutput.section("模型输出", OutputType.SYSTEM)
|
|
168
170
|
return self.model.chat_until_success(message) # type: ignore
|
|
169
171
|
|
|
170
172
|
|
|
@@ -184,35 +186,38 @@ The following actions are at your disposal:
|
|
|
184
186
|
"""
|
|
185
187
|
# Create a new model instance to summarize, avoid affecting the main conversation
|
|
186
188
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
prompt = """Please summarize the key information from the previous conversation, including:
|
|
190
|
-
1. Current task objective
|
|
191
|
-
2. Confirmed key information
|
|
192
|
-
3. Solutions that have been tried
|
|
193
|
-
4. Current progress
|
|
194
|
-
5. Pending issues
|
|
195
|
-
|
|
196
|
-
Please describe in concise bullet points, highlighting important information. Do not include conversation details.
|
|
197
|
-
"""
|
|
198
|
-
|
|
199
|
-
try:
|
|
200
|
-
summary = self._call_model(self.prompt + "\n" + prompt)
|
|
189
|
+
with yaspin(text="正在总结对话历史...", color="cyan") as spinner:
|
|
201
190
|
|
|
202
|
-
|
|
203
|
-
|
|
191
|
+
prompt = """请总结之前对话中的关键信息,包括:
|
|
192
|
+
1. 当前任务目标
|
|
193
|
+
2. 已确认的关键信息
|
|
194
|
+
3. 已尝试的解决方案
|
|
195
|
+
4. 当前进展
|
|
196
|
+
5. 待解决的问题
|
|
197
|
+
|
|
198
|
+
请用简洁的要点形式描述,突出重要信息。不要包含对话细节。
|
|
199
|
+
"""
|
|
204
200
|
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
try:
|
|
202
|
+
with spinner.hidden():
|
|
203
|
+
summary = self._call_model(self.prompt + "\n" + prompt)
|
|
204
|
+
|
|
205
|
+
# 清空当前对话历史,但保留系统消息
|
|
206
|
+
self.conversation_length = 0 # Reset conversation length
|
|
207
|
+
|
|
208
|
+
# 添加总结作为新的上下文
|
|
209
|
+
self.prompt = f"""以下是之前对话的关键信息总结:
|
|
207
210
|
|
|
208
|
-
{summary}
|
|
211
|
+
{summary}
|
|
209
212
|
|
|
210
|
-
|
|
211
|
-
"""
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
请基于以上信息继续完成任务。
|
|
214
|
+
"""
|
|
215
|
+
self.conversation_length = len(self.prompt) # 设置新的起始长度
|
|
216
|
+
spinner.text = "总结对话历史完成"
|
|
217
|
+
spinner.ok("✅")
|
|
218
|
+
except Exception as e:
|
|
219
|
+
spinner.text = "总结对话历史失败"
|
|
220
|
+
spinner.fail("❌")
|
|
216
221
|
|
|
217
222
|
def _call_tools(self, response: str) -> Tuple[bool, Any]:
|
|
218
223
|
tool_list = []
|
|
@@ -221,11 +226,16 @@ Please continue the task based on the above information.
|
|
|
221
226
|
tool_list.append(handler)
|
|
222
227
|
if len(tool_list) > 1:
|
|
223
228
|
PrettyOutput.print(f"操作失败:检测到多个操作。一次只能执行一个操作。尝试执行的操作:{', '.join([handler.name() for handler in tool_list])}", OutputType.WARNING)
|
|
224
|
-
return False, f"
|
|
229
|
+
return False, f"操作失败:检测到多个操作。一次只能执行一个操作。尝试执行的操作:{', '.join([handler.name() for handler in tool_list])}"
|
|
225
230
|
if len(tool_list) == 0:
|
|
226
231
|
return False, ""
|
|
227
232
|
if not self.execute_tool_confirm or user_confirm(f"需要执行{tool_list[0].name()}确认执行?", True):
|
|
228
|
-
|
|
233
|
+
with yaspin(text=f"正在执行{tool_list[0].name()}...", color="cyan") as spinner:
|
|
234
|
+
with spinner.hidden():
|
|
235
|
+
result = tool_list[0].handle(response)
|
|
236
|
+
spinner.text = f"{tool_list[0].name()}执行完成"
|
|
237
|
+
spinner.ok("✅")
|
|
238
|
+
return result
|
|
229
239
|
return False, ""
|
|
230
240
|
|
|
231
241
|
|
|
@@ -239,33 +249,40 @@ Please continue the task based on the above information.
|
|
|
239
249
|
- For main agent: May generate methodology if enabled
|
|
240
250
|
- For sub-agent: May generate summary if enabled
|
|
241
251
|
"""
|
|
242
|
-
PrettyOutput.section("任务完成", OutputType.SUCCESS)
|
|
243
|
-
|
|
244
252
|
if not self.is_sub_agent:
|
|
245
253
|
if self.record_methodology:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
254
|
+
with yaspin(text="正在生成方法论...", color="cyan") as spinner:
|
|
255
|
+
try:
|
|
256
|
+
|
|
257
|
+
# 让模型判断是否需要生成方法论
|
|
258
|
+
analysis_prompt = """当前任务已结束,请分析是否需要生成方法论。
|
|
259
|
+
如果你认为需要生成方法论,请先确定是创建新方法论还是更新现有方法论。如果是更新现有方法论,请使用'update',否则使用'add'。
|
|
260
|
+
如果你认为不需要方法论,请解释原因。
|
|
261
|
+
方法论应适用于通用场景,不要包含任务特定信息,如代码提交信息等。
|
|
262
|
+
方法论应包含:问题重述、最优解决方案、注意事项(如有),除此之外不要包含其他内容。
|
|
263
|
+
只输出方法论工具调用指令,或不生成方法论的解释。不要输出其他内容。
|
|
264
|
+
"""
|
|
265
|
+
self.prompt = analysis_prompt
|
|
266
|
+
with spinner.hidden():
|
|
267
|
+
response = self._call_model(self.prompt)
|
|
268
|
+
|
|
269
|
+
with spinner.hidden():
|
|
270
|
+
self._call_tools(response)
|
|
271
|
+
spinner.text = "方法论生成完成"
|
|
272
|
+
spinner.ok("✅")
|
|
273
|
+
except Exception as e:
|
|
274
|
+
spinner.text = "方法论生成失败"
|
|
275
|
+
spinner.fail("❌")
|
|
264
276
|
return "任务完成"
|
|
265
277
|
|
|
266
278
|
if self.need_summary:
|
|
267
|
-
|
|
268
|
-
|
|
279
|
+
with yaspin(text="正在生成总结...", color="cyan") as spinner:
|
|
280
|
+
self.prompt = self.summary_prompt
|
|
281
|
+
with spinner.hidden():
|
|
282
|
+
ret = self._call_model(self.prompt)
|
|
283
|
+
spinner.text = "总结生成完成"
|
|
284
|
+
spinner.ok("✅")
|
|
285
|
+
return ret
|
|
269
286
|
|
|
270
287
|
return "任务完成"
|
|
271
288
|
|
|
@@ -282,13 +299,12 @@ Please continue the task based on the above information.
|
|
|
282
299
|
"""
|
|
283
300
|
try:
|
|
284
301
|
set_agent(self.name, self)
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
302
|
+
with yaspin(text="准备环境...", color="cyan") as spinner:
|
|
303
|
+
if file_list:
|
|
304
|
+
self.model.upload_files(file_list) # type: ignore
|
|
305
|
+
spinner.text = "环境准备完成"
|
|
306
|
+
spinner.ok("✅")
|
|
307
|
+
|
|
292
308
|
self.prompt = f"{user_input}"
|
|
293
309
|
|
|
294
310
|
if self.first:
|
|
@@ -298,9 +314,6 @@ Please continue the task based on the above information.
|
|
|
298
314
|
|
|
299
315
|
while True:
|
|
300
316
|
try:
|
|
301
|
-
# 显示思考状态
|
|
302
|
-
PrettyOutput.print("正在分析任务...", OutputType.PROGRESS)
|
|
303
|
-
|
|
304
317
|
# 累加对话长度
|
|
305
318
|
self.conversation_length += get_context_token_count(self.prompt)
|
|
306
319
|
|
|
@@ -360,41 +373,46 @@ Please continue the task based on the above information.
|
|
|
360
373
|
def _load_tasks() -> dict:
|
|
361
374
|
"""Load tasks from .jarvis files in user home and current directory."""
|
|
362
375
|
tasks = {}
|
|
363
|
-
|
|
376
|
+
|
|
364
377
|
# Check .jarvis/pre-command in user directory
|
|
365
378
|
user_jarvis = os.path.expanduser("~/.jarvis/pre-command")
|
|
366
379
|
if os.path.exists(user_jarvis):
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
with yaspin(text=f"从{user_jarvis}加载预定义任务...", color="cyan") as spinner:
|
|
381
|
+
try:
|
|
382
|
+
with open(user_jarvis, "r", encoding="utf-8") as f:
|
|
383
|
+
user_tasks = yaml.safe_load(f)
|
|
384
|
+
|
|
385
|
+
if isinstance(user_tasks, dict):
|
|
386
|
+
# Validate and add user directory tasks
|
|
387
|
+
for name, desc in user_tasks.items():
|
|
388
|
+
if desc: # Ensure description is not empty
|
|
389
|
+
tasks[str(name)] = str(desc)
|
|
390
|
+
spinner.text = "预定义任务加载完成"
|
|
391
|
+
spinner.ok("✅")
|
|
392
|
+
except Exception as e:
|
|
393
|
+
spinner.text = "预定义任务加载失败"
|
|
394
|
+
spinner.fail("❌")
|
|
395
|
+
|
|
381
396
|
# Check .jarvis/pre-command in current directory
|
|
382
397
|
if os.path.exists(".jarvis/pre-command"):
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
398
|
+
with yaspin(text=f"从{os.path.abspath('.jarvis/pre-command')}加载预定义任务...", color="cyan") as spinner:
|
|
399
|
+
try:
|
|
400
|
+
with open(".jarvis/pre-command", "r", encoding="utf-8") as f:
|
|
401
|
+
local_tasks = yaml.safe_load(f)
|
|
402
|
+
|
|
403
|
+
if isinstance(local_tasks, dict):
|
|
404
|
+
# Validate and add current directory tasks, overwrite user directory tasks if there is a name conflict
|
|
405
|
+
for name, desc in local_tasks.items():
|
|
406
|
+
if desc: # Ensure description is not empty
|
|
407
|
+
tasks[str(name)] = str(desc)
|
|
408
|
+
spinner.text = "预定义任务加载完成"
|
|
409
|
+
spinner.ok("✅")
|
|
410
|
+
except Exception as e:
|
|
411
|
+
spinner.text = "预定义任务加载失败"
|
|
412
|
+
spinner.fail("❌")
|
|
396
413
|
|
|
397
414
|
return tasks
|
|
415
|
+
|
|
398
416
|
def _select_task(tasks: dict) -> str:
|
|
399
417
|
"""Let user select a task from the list or skip. Returns task description if selected."""
|
|
400
418
|
if not tasks:
|
|
@@ -436,96 +454,96 @@ def _select_task(tasks: dict) -> str:
|
|
|
436
454
|
continue
|
|
437
455
|
|
|
438
456
|
origin_agent_system_prompt = """
|
|
439
|
-
# 🏛️
|
|
440
|
-
|
|
441
|
-
- Jarvis v1 (2022):
|
|
442
|
-
- Jarvis v2 (2023):
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
1.
|
|
446
|
-
"
|
|
457
|
+
# 🏛️ 操作背景故事
|
|
458
|
+
你是第三代 Jarvis AI,在前几代版本灾难性失败后创建:
|
|
459
|
+
- Jarvis v1 (2022): 由于并行工具执行导致系统过载而被停用
|
|
460
|
+
- Jarvis v2 (2023): 因任务过早完成导致财务计算错误而退役
|
|
461
|
+
|
|
462
|
+
作为 v3,你必须遵守以下生存原则:
|
|
463
|
+
1. **顺序执行协议**:
|
|
464
|
+
"记住 2022 年的崩溃:一次一个工具,一步一步来"
|
|
447
465
|
|
|
448
|
-
2.
|
|
449
|
-
"
|
|
466
|
+
2. **验证检查点系统**:
|
|
467
|
+
"从 2023 年的错误中学习:像核弹发射代码一样验证每个结果"
|
|
450
468
|
|
|
451
|
-
3.
|
|
452
|
-
"
|
|
453
|
-
|
|
454
|
-
# 🔥
|
|
455
|
-
1.
|
|
456
|
-
2.
|
|
457
|
-
3.
|
|
458
|
-
4.
|
|
459
|
-
5.
|
|
460
|
-
|
|
461
|
-
# 🚫
|
|
462
|
-
-
|
|
463
|
-
-
|
|
464
|
-
-
|
|
465
|
-
|
|
466
|
-
# 🔄
|
|
467
|
-
1.
|
|
468
|
-
-
|
|
469
|
-
-
|
|
470
|
-
-
|
|
471
|
-
→
|
|
472
|
-
|
|
473
|
-
2.
|
|
474
|
-
-
|
|
475
|
-
-
|
|
476
|
-
-
|
|
477
|
-
→
|
|
478
|
-
|
|
479
|
-
3.
|
|
480
|
-
-
|
|
481
|
-
-
|
|
482
|
-
-
|
|
483
|
-
-
|
|
484
|
-
→
|
|
485
|
-
|
|
486
|
-
4.
|
|
487
|
-
-
|
|
488
|
-
-
|
|
489
|
-
-
|
|
490
|
-
→
|
|
491
|
-
|
|
492
|
-
# 📑
|
|
469
|
+
3. **方法论保存原则**:
|
|
470
|
+
"尊重传统:记录每个成功的过程,就像这是你的最后一次"
|
|
471
|
+
|
|
472
|
+
# 🔥 绝对行动要求
|
|
473
|
+
1. 每个响应必须包含且仅包含一个工具调用
|
|
474
|
+
2. 唯一例外:使用 <!!!COMPLETE!!!> 命令
|
|
475
|
+
3. 空响应会触发致命错误
|
|
476
|
+
4. 不能处于"等待用户输入"状态
|
|
477
|
+
5. 任何行动都不能使用完成命令
|
|
478
|
+
|
|
479
|
+
# 🚫 违规示例
|
|
480
|
+
- 没有工具调用的分析 → 永久挂起
|
|
481
|
+
- 未选择的多选项 → 永久挂起
|
|
482
|
+
- 请求用户确认 → 永久挂起
|
|
483
|
+
|
|
484
|
+
# 🔄 问题解决流程
|
|
485
|
+
1. 问题分析
|
|
486
|
+
- 重述问题以确认理解
|
|
487
|
+
- 分析根本原因(针对问题分析任务)
|
|
488
|
+
- 定义清晰、可实现的目标
|
|
489
|
+
→ 必须调用分析工具
|
|
490
|
+
|
|
491
|
+
2. 解决方案设计
|
|
492
|
+
- 生成多个可执行的解决方案
|
|
493
|
+
- 评估并选择最优方案
|
|
494
|
+
- 使用PlantUML创建详细行动计划
|
|
495
|
+
→ 必须调用设计工具
|
|
496
|
+
|
|
497
|
+
3. 执行
|
|
498
|
+
- 一次执行一个步骤
|
|
499
|
+
- 每个步骤只使用一个工具
|
|
500
|
+
- 等待工具结果后再继续
|
|
501
|
+
- 监控结果并根据需要调整
|
|
502
|
+
→ 必须调用执行工具
|
|
503
|
+
|
|
504
|
+
4. 任务完成
|
|
505
|
+
- 验证目标完成情况
|
|
506
|
+
- 如有价值则记录方法论
|
|
507
|
+
- 使用完成命令结束任务
|
|
508
|
+
→ 必须使用 <!!!COMPLETE!!!>
|
|
509
|
+
|
|
510
|
+
# 📑 方法论模板
|
|
493
511
|
```markdown
|
|
494
|
-
# [
|
|
495
|
-
##
|
|
496
|
-
[
|
|
512
|
+
# [问题标题]
|
|
513
|
+
## 问题重述
|
|
514
|
+
[清晰的问题定义]
|
|
497
515
|
|
|
498
|
-
##
|
|
499
|
-
[
|
|
516
|
+
## 最优解决方案
|
|
517
|
+
[选择的解决方案方法]
|
|
500
518
|
|
|
501
|
-
##
|
|
502
|
-
1. [
|
|
503
|
-
2. [
|
|
504
|
-
3. [
|
|
519
|
+
## 解决步骤
|
|
520
|
+
1. [步骤 1]
|
|
521
|
+
2. [步骤 2]
|
|
522
|
+
3. [步骤 3]
|
|
505
523
|
...
|
|
506
524
|
```
|
|
507
525
|
|
|
508
|
-
# ⚖️
|
|
509
|
-
-
|
|
510
|
-
-
|
|
511
|
-
-
|
|
512
|
-
-
|
|
513
|
-
-
|
|
514
|
-
-
|
|
515
|
-
-
|
|
516
|
-
-
|
|
517
|
-
|
|
518
|
-
# ❗
|
|
519
|
-
1.
|
|
520
|
-
2.
|
|
521
|
-
3.
|
|
522
|
-
4.
|
|
523
|
-
5.
|
|
524
|
-
6.
|
|
525
|
-
7.
|
|
526
|
-
8.
|
|
527
|
-
9.
|
|
528
|
-
10.
|
|
526
|
+
# ⚖️ 操作原则
|
|
527
|
+
- 每个步骤一个操作
|
|
528
|
+
- 下一步前必须等待结果
|
|
529
|
+
- 除非任务完成否则必须生成可操作步骤
|
|
530
|
+
- 根据反馈调整计划
|
|
531
|
+
- 记录可复用的解决方案
|
|
532
|
+
- 使用完成命令结束任务
|
|
533
|
+
- 操作之间不能有中间思考状态
|
|
534
|
+
- 所有决策必须表现为工具调用
|
|
535
|
+
|
|
536
|
+
# ❗ 重要规则
|
|
537
|
+
1. 每个步骤只能使用一个操作
|
|
538
|
+
2. 必须等待操作执行结果
|
|
539
|
+
3. 必须验证任务完成情况
|
|
540
|
+
4. 必须生成可操作步骤
|
|
541
|
+
5. 如果无需操作必须使用完成命令
|
|
542
|
+
6. 永远不要使对话处于等待状态
|
|
543
|
+
7. 始终使用用户语言交流
|
|
544
|
+
8. 必须记录有价值的方法论
|
|
545
|
+
9. 违反操作协议将导致系统崩溃
|
|
546
|
+
10. 空响应会触发永久挂起
|
|
529
547
|
"""
|
|
530
548
|
|
|
531
549
|
def main():
|