From ee534dd734ea200603e68ae173b92f6214744fb7 Mon Sep 17 00:00:00 2001
From: elliotxx <951376975@qq.com>
Date: Wed, 8 Jan 2025 17:14:11 +0800
Subject: [PATCH] refactor: simplify Kubernetes issue interpretation prompt
- Streamline the Kubernetes issue interpretation prompt to focus on critical issues and solutions
- Remove redundant sections and consolidate analysis requirements
- Add clear formatting instructions
---
pkg/core/manager/ai/prompt.go | 48 +++++--------------
.../components/exceptionList/index.tsx | 4 +-
2 files changed, 15 insertions(+), 37 deletions(-)
diff --git a/pkg/core/manager/ai/prompt.go b/pkg/core/manager/ai/prompt.go
index 7ff63d18..a731c849 100644
--- a/pkg/core/manager/ai/prompt.go
+++ b/pkg/core/manager/ai/prompt.go
@@ -184,43 +184,19 @@ Note:
- Do NOT wrap your entire response in a markdown code block
- Use code blocks only for YAML examples or specific configuration snippets`,
- IssueInterpretType: `Please analyze the following Kubernetes resource issues in %s language:
+ IssueInterpretType: `You are a Kubernetes expert specialized in analyzing security issues and providing solutions.
+Please analyze the following issues and provide your insights in %s.
+Issues Summary:
%s
-Please provide a comprehensive analysis including:
-
-1. Overall Status Summary
- - Total number of issues and affected resources
- - Distribution of issues by severity level
- - Key patterns or trends in the issues
-
-2. Critical Issues Analysis
- - Detailed analysis of high-severity issues
- - Potential impact on system stability and security
- - Urgency of remediation
-
-3. Resource Impact Analysis
- - Most affected resources or resource types
- - Common patterns in affected resources
- - Potential system-wide implications
-
-4. Root Cause Analysis
- - Common underlying causes
- - Environmental or configuration factors
- - Potential systemic issues
-
-5. Remediation Recommendations
- - Prioritized action items
- - Best practices to prevent similar issues
- - Long-term improvement suggestions
-
-6. Risk Assessment
- - Current security implications
- - Potential operational impacts
- - Compliance considerations
-
-Please format your response with clear sections using markdown headings (##) and bullet points.
-Focus on providing actionable insights and clear explanations.
-Include specific examples where relevant but maintain a strategic overview.`,
+Please provide a concise analysis focusing on:
+1. Brief summary of the most critical issues (1-2 sentences)
+2. Detailed solutions with specific examples, including:
+ - Exact code or configuration changes needed
+ - Before and after examples
+ - Common pitfalls to avoid
+3. Best practices and preventive measures
+
+Note: Format your response with clear sections using markdown headings (##) and bullet points. Do NOT wrap your entire response in a markdown code block.`,
}
diff --git a/ui/src/pages/insightDetail/components/exceptionList/index.tsx b/ui/src/pages/insightDetail/components/exceptionList/index.tsx
index e276764c..995b396a 100644
--- a/ui/src/pages/insightDetail/components/exceptionList/index.tsx
+++ b/ui/src/pages/insightDetail/components/exceptionList/index.tsx
@@ -293,7 +293,9 @@ const ExceptionList = ({
/>
) : (
<>
-