Skip to content

Commit

Permalink
fix: incorrect prompt as redundant code block, refine i18n/en.json (#705
Browse files Browse the repository at this point in the history
)

## What type of PR is this?

/kind bug

## What this PR does / why we need it:

This PR addresses the following issues:

- Fixes incorrect prompt formatting in `prompt.go` to prevent wrapping
entire responses in code blocks, which improves the readability of
AI-generated responses.

- Refines and simplifies various UI text strings in `en.json` to enhance
clarity and provide a better user experience.

## Which issue(s) this PR fixes:

Fixes #
  • Loading branch information
elliotxx authored Jan 6, 2025
1 parent 9887467 commit 75d576f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 52 deletions.
21 changes: 12 additions & 9 deletions pkg/core/manager/ai/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -175,7 +176,9 @@ 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`,
}
86 changes: 43 additions & 43 deletions ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -100,53 +100,53 @@
"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",
"DisplayName": "Display Name",
"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",
"ViewIssueDetail": "View Issue Detail",
"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",
"Warning": "Warning",
"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",
Expand All @@ -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: <a href='{{linkUrl}}' target='_blank'>[How to Create Token]</a>",
"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: <a href='{{linkUrl}}' target='_blank'>[How to Create Token]</a>",
"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",
Expand Down

0 comments on commit 75d576f

Please sign in to comment.