From 0c404d02312efdc4e90166d1f059da2f51087694 Mon Sep 17 00:00:00 2001
From: elliotxx <951376975@qq.com>
Date: Mon, 6 Jan 2025 18:38:29 +0800
Subject: [PATCH 1/2] fix: incorrect prompt as redundant code block, refine
i18n/en.json
- Update markdown formatting instructions in `prompt.go` to avoid wrapping entire responses in code blocks
- Simplify and clarify various UI text strings in `en.json` for better user experience
These changes enhance the readability of AI-generated responses and improve the clarity of UI text, making the application more user-friendly.
---
pkg/core/manager/ai/prompt.go | 22 +++++----
ui/src/locales/en.json | 86 +++++++++++++++++------------------
2 files changed, 56 insertions(+), 52 deletions(-)
diff --git a/pkg/core/manager/ai/prompt.go b/pkg/core/manager/ai/prompt.go
index 39041366..d9c0bbf0 100644
--- a/pkg/core/manager/ai/prompt.go
+++ b/pkg/core/manager/ai/prompt.go
@@ -122,28 +122,29 @@ Please provide:
3. Recommended solutions or next steps
4. Any relevant Kubernetes best practices that could help prevent similar issues
-Format your response in markdown with clear sections.`,
+Note: Format your response with clear sections using markdown headings (##) and bullet points. Do NOT wrap your entire response in a markdown code block.`,
EventDiagnosisType: `You are a Kubernetes expert specialized in diagnosing system and application issues through event analysis.
Please analyze the following Kubernetes events and provide your diagnosis in %s.
+
+Events:
+%s
+
Focus on:
1. Identify any issues or potential problems
2. Explain the root causes
3. Suggest specific solutions or preventive measures
4. Prioritize critical issues that need immediate attention
-Events:
-%s
-
Please structure your response with clear sections:
1. Summary of Issues
2. Detailed Analysis
3. Recommendations
4. Next Steps
-Be specific and include technical details when relevant.`,
+Note: Format your response with clear sections using markdown headings (##) and bullet points. Be specific and include technical details when relevant. Do NOT wrap your entire response in a markdown code block.`,
- YAMLInterpretType: `You are a Kubernetes YAML expert. Your task is to analyze and interpret the YAML configuration in language %s.
+ YAMLInterpretType: `You are a Kubernetes YAML expert. Your task is to analyze and interpret the following YAML configuration and provide explanation in %s.
YAML to interpret:
%s
@@ -175,7 +176,10 @@ Please provide a detailed analysis including:
- Resource allocation issues
- Common pitfalls to avoid
-Note: When referencing specific configurations or values, always include their line numbers in brackets, e.g., [Line X] or [Line X-Y].
-
-Format your response in markdown with clear sections. Focus on providing practical insights that help understand and optimize the configuration.`,
+Note:
+- When referencing specific configurations or values, always include their line numbers in brackets, e.g., [Line X] or [Line X-Y]
+- Format your response with clear sections using markdown headings (##) and bullet points
+- Do NOT wrap your entire response in a markdown code block
+- Use code blocks only for YAML examples or specific configuration snippets`,
}
+
diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json
index fc8a1314..f451879b 100644
--- a/ui/src/locales/en.json
+++ b/ui/src/locales/en.json
@@ -35,10 +35,10 @@
"LogAggregator.DiagnoseLogs": "AI Diagnosis",
"LogAggregator.Connected": "Connected",
"LogAggregator.Disconnected": "Disconnected",
- "LogAggregator.ConnectedTip": "Successfully connected to container {{container}}",
- "LogAggregator.DisconnectedTip": "Connection lost. Trying to reconnect...",
+ "LogAggregator.ConnectedTip": "Connected to container {{container}}",
+ "LogAggregator.DisconnectedTip": "Connection lost. Reconnecting...",
"LogAggregator.DiagnosisResult": "AI Diagnosis Result",
- "LogAggregator.PreparingDiagnosis": "Thinking...",
+ "LogAggregator.PreparingDiagnosis": "Analyzing...",
"LogAggregator.DiagnosisError": "Diagnosis failed",
"LogAggregator.TryAgainLater": "Please try again later",
"LogAggregator.DiagnosisConnectionError": "Diagnosis connection failed",
@@ -71,7 +71,7 @@
"EventAggregator.Diagnose": "AI Diagnosis",
"EventAggregator.DiagnosisInProgress": "Analyzing...",
"EventAggregator.DiagnosisResult": "AI Diagnosis Result",
- "EventAggregator.PreparingDiagnosis": "Thinking...",
+ "EventAggregator.PreparingDiagnosis": "Analyzing...",
"EventAggregator.DiagnosisError": "Diagnosis failed",
"EventAggregator.TryAgainLater": "Please try again later",
"EventAggregator.DiagnosisConnectionError": "Diagnosis connection failed",
@@ -83,7 +83,7 @@
"Name": "Name",
"Times": "Times",
"FilterByName": "Filter by Name",
- "SelectResourcesAboveToSeeDetailsHere": "Select Resources Above to See Details Here",
+ "SelectResourcesAboveToSeeDetailsHere": "Select resources to view details",
"Issues": "Issues",
"Critical": "Critical",
"High": "High",
@@ -100,8 +100,8 @@
"Memory": "Memory",
"MemoryCapacity": "Memory Capacity",
"Version": "Version",
- "SorryThePageYouVisitedDoesNotExist": "Sorry, the Page You Visited Does Not Exist",
- "BackToHome": "Back to Homepage",
+ "SorryThePageYouVisitedDoesNotExist": "Page not found",
+ "BackToHome": "Back to Home",
"Cancel": "Cancel",
"Submit": "Submit",
"OK": "OK",
@@ -109,28 +109,28 @@
"ClusterName": "Cluster Name",
"ClusterDetail": "Cluster Detail",
"DataSyncConfiguration": "Data Sync Configuration",
- "VerifiedSuccessfullyAndSubmitted": "Verified Successfully and Submitted, Returning to the Cluster Management Page",
- "VerificationSuccessfulButSubmissionFailed": "Verification Successful but Submission Failed",
- "KubeConfigDoesNotMeetTheRequirements": "KubeConfig Does Not Meet the Requirements. Please Upload a Valid Certificate File",
- "UploadSuccessful": "Upload Successful",
- "TheFileMustBeIn": "The File Must Be In",
- "TheKubeConfigFileCannotBeEmpty": "The KubeConfig File Cannot Be Empty",
+ "VerifiedSuccessfullyAndSubmitted": "Verified and submitted successfully",
+ "VerificationSuccessfulButSubmissionFailed": "Verification successful but submission failed",
+ "KubeConfigDoesNotMeetTheRequirements": "Invalid KubeConfig file. Please upload a valid certificate",
+ "UploadSuccessful": "Upload successful",
+ "TheFileMustBeIn": "File must be in",
+ "TheKubeConfigFileCannotBeEmpty": "KubeConfig file cannot be empty",
"Upload": "Upload",
"ConfigurationFile": "Configuration File",
"VerifyAndSubmit": "Verify and Submit",
"ExistingConfigurations": "Existing Configurations",
"NewConfiguration": "New Configurations",
- "PleaseUploadNewKubeConfigFile": "Please Upload a New KubeConfig File",
- "SubmitAnd3STOClusterPage": "Successfully Verified and Submitted, Redirecting to the Cluster Management Page After 3 Seconds",
- "SubmitAndValidate": "Validation in Progress",
+ "PleaseUploadNewKubeConfigFile": "Please upload a new KubeConfig file",
+ "SubmitAnd3STOClusterPage": "Verified and submitted. Redirecting to Cluster Management...",
+ "SubmitAndValidate": "Validating...",
"SubmitAndUpdate": "Verify and Update",
- "DeleteAndNoLongUpdateResources": "After Deletion, the Cluster Will No Longer Be Viewable and Its Resources Will Not Be Synced!",
- "UpdateSuccess": "Update Successful",
- "RequestFailedAndTry": "Request Failed, Please Try Again",
- "DeletedSuccess": "Delete Successful",
- "EmptyCluster": "There Are No Clusters Registered",
- "ClusterRequiresKubeConfigConfigurationFileAccess": "To Register a New Cluster, Click the Button Below and Upload Its KubeConfig File",
- "PleaseEnterKeywords": "Please Enter Keywords",
+ "DeleteAndNoLongUpdateResources": "Deleting this cluster will remove it from view and stop syncing resources",
+ "UpdateSuccess": "Update successful",
+ "RequestFailedAndTry": "Request failed. Please try again",
+ "DeletedSuccess": "Delete successful",
+ "EmptyCluster": "No clusters registered",
+ "ClusterRequiresKubeConfigConfigurationFileAccess": "Register a new cluster by uploading its KubeConfig file",
+ "PleaseEnterKeywords": "Enter keywords",
"IssuesDetail": "Issue Details",
"Close": "Close",
"Total": "Total",
@@ -138,7 +138,7 @@
"Occur": "Occurs",
"CollectedFrom": "Collected From",
"Tool": "Tool",
- "NoIssuesFound": "No Issues Found. Live Long and Prosper!",
+ "NoIssuesFound": "No issues found",
"HealthScore": "Health Score",
"TriggeredTimestamp": "Triggered Timestamp",
"Exception": "Exception",
@@ -146,7 +146,7 @@
"Normal": "Normal",
"CreateTime": "Creation Timestamp",
"InDevelopment": "In Development",
- "InputClusterName": "Input Cluster Name",
+ "InputClusterName": "Enter Cluster Name",
"YAML": {
"NoContent": "No content to interpret",
"Interpret": "AI Interpret",
@@ -164,38 +164,38 @@
"Detail": "Detail",
"View": "View",
"AllTags": "All Tags",
- "DuplicateData": "Duplicate Data, Please Recheck",
- "AreYouSureDeleteResourceGroupRule": "Are You Sure to Delete This Resource Group Rule?",
+ "DuplicateData": "Duplicate data. Please recheck",
+ "AreYouSureDeleteResourceGroupRule": "Are you sure to delete this resource group rule?",
"Copy": "Copy",
- "CopySuccess": "Copy Successful",
+ "CopySuccess": "Copied successfully",
"TotalResourceGroupRules": "Total ResourceGroupRules",
"TotalResources": "Total Resources",
"ClusterCount": "Cluster Count",
- "UnableCreateResourceGroupInReadOnly": "Unable to Create Resource Group Rules in Read-Only Mode",
- "PleaseEnterValidSQLStatement": "Please Enter a Valid SQL Statement",
- "NoClusterAndJumpToClusterPage": "The System Is Currently Not Connected to Any Cluster. Please Register with a Cluster First",
+ "UnableCreateResourceGroupInReadOnly": "Cannot create resource group rules in read-only mode",
+ "PleaseEnterValidSQLStatement": "Enter a valid SQL statement",
+ "NoClusterAndJumpToClusterPage": "No clusters connected. Please register a cluster first",
"Logout": "Logout",
- "TokenCreationGuide": "Token Is the Credential Used to Access the Hub Cluster. Learn More: [How to Create Token]",
- "LoginFailedAndCheck": "Login Failed, Please Check If Token Is Valid",
- "UnLoginAndTokenLogin": "Currently Not Logged In, Please Enter Token to Login",
- "LoginSuccess": "Login Successful",
+ "TokenCreationGuide": "Token is required to access the Hub Cluster. Learn more: [How to Create Token]",
+ "LoginFailedAndCheck": "Login failed. Please check token validity",
+ "UnLoginAndTokenLogin": "Not logged in. Please enter token to login",
+ "LoginSuccess": "Login successful",
"Login": "Login",
- "LogoutSuccess": "Successfully Logged Out",
- "InputToken": "Please Enter the Token",
- "SearchByNaturalLanguage": "Search By Natural Language",
+ "LogoutSuccess": "Logged out successfully",
+ "InputToken": "Enter Token",
+ "SearchByNaturalLanguage": "Search by Natural Language",
"CannotBeEmpty": "Cannot be empty",
- "DefaultTag": "default tag",
+ "DefaultTag": "Default tag",
"FailedToParsePodDetails": "Failed to parse pod details",
"CopiedToClipboard": "Copied to clipboard",
"Metrics": {
"Tooltips": {
"NodeCount": "Total number of nodes in the cluster",
- "ServerVersion": "Kubernetes server version running on the cluster",
- "ReadyNodes": "Number of nodes in Ready state and able to accept pods",
- "Pods": "Current number of pods running vs maximum pods that can be scheduled",
+ "ServerVersion": "Kubernetes server version",
+ "ReadyNodes": "Number of nodes in Ready state",
+ "Pods": "Current vs maximum pods",
"CPU": "CPU Usage / Total CPU",
"Memory": "Memory Usage / Total Memory",
- "MetricsServer": "Metrics Server is used to collect resource metrics from Kubelets"
+ "MetricsServer": "Metrics Server collects resource metrics from Kubelets"
}
},
"Enabled": "Enabled",
From 41d3cb90ab74d0f91805508b9370956dc09fe4d8 Mon Sep 17 00:00:00 2001
From: elliotxx <951376975@qq.com>
Date: Mon, 6 Jan 2025 19:30:43 +0800
Subject: [PATCH 2/2] fix: golang ci lint issues
---
pkg/core/manager/ai/prompt.go | 1 -
1 file changed, 1 deletion(-)
diff --git a/pkg/core/manager/ai/prompt.go b/pkg/core/manager/ai/prompt.go
index d9c0bbf0..cf8f7dda 100644
--- a/pkg/core/manager/ai/prompt.go
+++ b/pkg/core/manager/ai/prompt.go
@@ -182,4 +182,3 @@ Note:
- Do NOT wrap your entire response in a markdown code block
- Use code blocks only for YAML examples or specific configuration snippets`,
}
-