Skip to content

The Unified and Autonomous Development Platform

chore: Update AI query descriptions

Robin Shen4f4bc5f4ef03
diff --git a/server-core/src/main/java/io/onedev/server/ai/QueryDescriptions.java b/server-core/src/main/java/io/onedev/server/ai/QueryDescriptions.java
index 1bab809e29..9e984eeb32 100644
--- a/server-core/src/main/java/io/onedev/server/ai/QueryDescriptions.java
+++ b/server-core/src/main/java/io/onedev/server/ai/QueryDescriptions.java
@@ -4,18 +4,16 @@ import static java.util.stream.Collectors.joining;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.List;
import java.util.stream.IntStream;
import io.onedev.server.OneDev;
import io.onedev.server.model.Agent;
import io.onedev.server.model.Build;
-import io.onedev.server.model.Workspace;
import io.onedev.server.model.Issue;
-import io.onedev.server.model.LabelSpec;
import io.onedev.server.model.Pack;
import io.onedev.server.model.Project;
import io.onedev.server.model.PullRequest;
+import io.onedev.server.model.Workspace;
import io.onedev.server.model.support.issue.field.spec.BooleanField;
import io.onedev.server.model.support.issue.field.spec.BuildChoiceField;
import io.onedev.server.model.support.issue.field.spec.CommitField;
@@ -34,7 +32,6 @@ import io.onedev.server.model.support.pullrequest.MergeStrategy;
import io.onedev.server.pack.PackSupport;
import io.onedev.server.service.AgentAttributeService;
import io.onedev.server.service.AgentService;
-import io.onedev.server.service.LabelSpecService;
import io.onedev.server.service.LinkSpecService;
import io.onedev.server.service.SettingService;
@@ -246,7 +243,7 @@ public class QueryDescriptions {
| 'merged'
| 'discarded'
| '"Source Branch"' 'is' ('not')? '"'BranchNameOrPattern'"'
- | '"Souce Project"' 'is' ('not')? '"'ProjectPathOrPattern'"'
+ | '"Source Project"' 'is' ('not')? '"'ProjectPathOrPattern'"'
| '"Target Branch"' 'is' ('not')? '"'BranchNameOrPattern'"'
| '"Merge Strategy"' 'is' ('not')? '"'MergeStrategy'"'
| '"Label"' 'is' ('not')? '"'LabelName'"'
@@ -286,7 +283,7 @@ public class QueryDescriptions {
| '"Comment Count"' 'is' ('not')? '"'Number'"'
| '"Comment Count"' 'is' ('greater'|'less') 'than' '"'Number'"'
%s
- | '"Project"' 'is' ('not')? '"'ProjectPathOrPattern'"'
+ | '"Target Project"' 'is' ('not')? '"'ProjectPathOrPattern'"'
| 'watched by' '"'LoginNameOfUser'"'
| 'watched by me'
| 'ignored by' '"'LoginNameOfUser'"'
@@ -321,10 +318,6 @@ public class QueryDescriptions {
: %s
;
- LabelName
- : %s
- ;
-
OrderField
: %s
;
@@ -338,7 +331,6 @@ public class QueryDescriptions {
2. Use an empty query to list all accessible pull requests""",
REACTION_CRITERIAS,
Arrays.stream(MergeStrategy.values()).map(it->"'" + it.name() + "'").collect(joining("\n | ")).trim(),
- getLabelSpecs().stream().map(it->"'" + it.getName() + "'").collect(joining("\n | ")).trim(),
PullRequest.SORT_FIELDS.keySet().stream().map(it->"'" + it + "'").collect(joining("\n | ")).trim());
return description;
@@ -355,7 +347,7 @@ public class QueryDescriptions {
criteria
: '"Number"' 'is' ('not')? '"'EntityReference'"'
| '"Number"' 'is' ('greater'|'less') 'than' '"'EntityReference'"'
- | 'sucessful'
+ | 'successful'
| 'failed'
| 'cancelled'
| 'timed out'
@@ -376,9 +368,12 @@ public class QueryDescriptions {
| '"Version"' 'is' ('not')? '"'VersionNameOrPattern'"'
| '"Branch"' 'is' ('not')? '"'BranchNameOrPattern'"'
| '"Tag"' 'is' ('not')? '"'TagNameOrPattern'"'
- | '"Param"' 'is' ('not')? '"'ParamName'"'
| '"Label"' 'is' ('not')? '"'LabelName'"'
| '"Pull Request"' 'is' ('not')? '"'EntityReference'"'
+ | '"Pull Request"' 'is' ('not')? 'empty'
+ | '"Version"' 'is' ('not')? 'empty'
+ | '"Branch"' 'is' ('not')? 'empty'
+ | '"Tag"' 'is' ('not')? 'empty'
| '"Commit"' 'is' ('not')? '"'CommitReference'"'
| '"Submit Date"' 'is' ('until'|'since') '"'DateDescription'"'
| '"Pending Date"' 'is' ('until'|'since') '"'DateDescription'"'
@@ -400,10 +395,6 @@ public class QueryDescriptions {
: (ProjectPath':')?CommitHash
;
- LabelName
- : %s
- ;
-
OrderField
: %s
;
@@ -415,16 +406,11 @@ public class QueryDescriptions {
Please note:
1. "LoginNameOfUser" should be retrieved via tool 'getLoginName' if available, with parameter set to user name
2. Use an empty query to list all accessible builds""",
- getLabelSpecs().stream().map(it->"'" + it.getName() + "'").collect(joining("\n | ")).trim(),
Build.SORT_FIELDS.keySet().stream().map(it->"'" + it + "'").collect(joining("\n | ")).trim());
return description;
}
- private static List<LabelSpec> getLabelSpecs() {
- return OneDev.getInstance(LabelSpecService.class).query();
- }
-
public static String getPackQueryDescription() {
var packSupports = new ArrayList<>(OneDev.getExtensions(PackSupport.class));
@@ -462,10 +448,6 @@ public class QueryDescriptions {
: %s
;
- LabelName
- : %s
- ;
-
OrderField
: %s
;
@@ -478,7 +460,6 @@ public class QueryDescriptions {
1. "LoginNameOfUser" should be retrieved via tool 'getLoginName' if available, with parameter set to user name
2. Use an empty query to list all accessible packages""",
packSupports.stream().map(it->"'" + it.getPackType() + "'").collect(joining("\n | ")).trim(),
- getLabelSpecs().stream().map(it->"'" + it.getName() + "'").collect(joining("\n | ")).trim(),
Pack.SORT_FIELDS.keySet().stream().map(it->"'" + it + "'").collect(joining("\n | ")).trim());
return description;
@@ -495,7 +476,7 @@ public class QueryDescriptions {
criteria
: 'pending'
| 'active'
- | 'error'
+ | 'inactive'
| 'created by me'
| 'created by' '"'LoginNameOfUser'"'
| 'ran on' '"'AgentName'"'
@@ -520,10 +501,6 @@ public class QueryDescriptions {
| ProjectKey'-'Number
;
- LabelName
- : %s
- ;
-
OrderField
: %s
;
@@ -535,7 +512,6 @@ public class QueryDescriptions {
Please note:
1. "LoginNameOfUser" should be retrieved via tool 'getLoginName' if available, with parameter set to user name
2. Use an empty query to list all accessible workspaces""",
- getLabelSpecs().stream().map(it -> "'" + it.getName() + "'").collect(joining("\n | ")).trim(),
Workspace.SORT_FIELDS.keySet().stream().map(it -> "'" + it + "'").collect(joining("\n | ")).trim());
return description;
@@ -612,10 +588,6 @@ public class QueryDescriptions {
| '('criteria')'
;
- LabelName
- : %s
- ;
-
OrderField
: %s
;
@@ -627,7 +599,6 @@ public class QueryDescriptions {
Please note:
1. "LoginNameOfUser" should be retrieved via tool 'getLoginName' if available, with parameter set to user name
2. Use an empty query to list all accessible projects""",
- getLabelSpecs().stream().map(it->"'" + it.getName() + "'").collect(joining("\n | ")).trim(),
Project.SORT_FIELDS.keySet().stream().map(it->"'" + it + "'").collect(joining("\n | ")).trim());
return description;