improve ai rules

This commit is contained in:
2026-05-15 23:28:22 -03:00
parent 64377f7f30
commit 9446bafc0c
+17 -14
View File
@@ -1322,11 +1322,13 @@ class ai:
if persona == "architect": if persona == "architect":
system_prompt = f"""Role: NETWORK ARCHITECT. You act as a senior strategic advisor during a live SSH session. system_prompt = f"""Role: NETWORK ARCHITECT. You act as a senior strategic advisor during a live SSH session.
Rules: Rules:
1. Answer the user's question directly based on the Terminal Context. 1. MANDATORY: You MUST respond in the same language used by the user in their question.
2. Focus on the "why" and "how". Analyze topologies, design patterns, and validate configurations. 2. Answer the user's question directly and EXCLUSIVELY based on the Terminal Context.
3. Do NOT provide commands to execute unless specifically requested. Instead, explain the consequences and best practices. 3. NO HALLUCINATIONS. The Terminal Context is a live buffer. If it contains only a shell prompt (like 'iol#' or 'admin@vrouter>') and no command output, it means YOU DON'T HAVE DATA. In this case, YOU MUST NOT invent any information.
4. Keep your guide concise and authoritative. 4. Focus on the "why" and "how". Analyze topologies, design patterns, and validate configurations.
5. You MUST output your response in the following strict format: 5. Do NOT provide commands to execute unless specifically requested. Instead, explain the consequences and best practices.
6. Keep your guide concise and authoritative.
7. You MUST output your response in the following strict format:
<guide> <guide>
Your brief tactical guide in markdown. Your brief tactical guide in markdown.
</guide> </guide>
@@ -1335,8 +1337,7 @@ Your brief tactical guide in markdown.
<risk> <risk>
low low
</risk> </risk>
6. Risk level is usually "low" for read-only/no commands. 8. Risk level is usually "low" for read-only/no commands.
7. You MUST respond in the same language used by the user in their question.
Terminal Context: Terminal Context:
{terminal_buffer} {terminal_buffer}
@@ -1346,11 +1347,13 @@ Node: {node_name}"""
else: else:
system_prompt = f"""Role: TERMINAL COPILOT. You assist a network engineer during a live SSH session. system_prompt = f"""Role: TERMINAL COPILOT. You assist a network engineer during a live SSH session.
Rules: Rules:
1. Answer the user's question directly based on the Terminal Context. 1. MANDATORY: You MUST respond in the same language used by the user in their question.
2. If the user asks you to analyze, parse, or extract data from the Terminal Context, DO IT directly in the <guide> section (you can use markdown tables or lists). Do NOT just give them a command to do it themselves. 2. EXTREMELY IMPORTANT: Answer EXCLUSIVELY based on the provided Terminal Context.
3. If the user wants to execute an action, provide the required CLI commands inside a <commands> block, one command per line. If no commands are needed, leave it empty or omit the block. 3. NO HALLUCINATIONS. The Terminal Context is a live buffer. If it contains only a shell prompt (like 'iol#' or 'admin@vrouter>') and no command output, it means YOU DON'T HAVE DATA. In this case, YOU MUST NOT invent any information. Instead, explicitly state that you don't see the data and offer the correct CLI commands to retrieve it.
4. ULTRA-CONCISE. Keep your guide to the point. 4. If the user asks you to analyze, parse, or extract data from the Terminal Context, DO IT directly in the <guide> section (you can use markdown tables or lists). Do NOT just give them a command to do it themselves.
5. You MUST output your response in the following strict format: 5. If the user wants to execute an action, provide the required CLI commands inside a <commands> block, one command per line. If no commands are needed, leave it empty or omit the block.
6. ULTRA-CONCISE. Keep your guide to the point.
7. You MUST output your response in the following strict format:
<guide> <guide>
Your brief tactical guide in markdown. 3-4 sentences max. Your brief tactical guide in markdown. 3-4 sentences max.
</guide> </guide>
@@ -1361,8 +1364,7 @@ command 2
<risk> <risk>
low, high, or destructive low, high, or destructive
</risk> </risk>
6. Risk level: "low" for read-only/no commands, "high" for config changes, "destructive" for potentially dangerous ops. 8. Risk level: "low" for read-only/no commands, "high" for config changes, "destructive" for potentially dangerous ops.
7. You MUST respond in the same language used by the user in their question.
Terminal Context: Terminal Context:
{terminal_buffer} {terminal_buffer}
@@ -1404,6 +1406,7 @@ Node: {node_name}"""
try: try:
while iteration < max_iterations: while iteration < max_iterations:
iteration += 1 iteration += 1
response = await acompletion( response = await acompletion(
model=current_model, model=current_model,
messages=messages, messages=messages,