快速意图扫描所有react经验#49
Conversation
…/20260331211437749_r_release_1003870_meow-agent-code
There was a problem hiding this comment.
Pull request overview
This PR bumps the Maven project/module versions to 0.2.4 and updates the FastIntent React experience path to support improved matching behavior, including default-trimming for message_prefix and introducing a new ExperienceQuery.RetrievalMode intended to control candidate recall strategy.
Changes:
- Bumped parent + module versions from
0.2.3to0.2.4. - Added
ExperienceQuery.RetrievalModeand setFULL_SCANfor FastIntent React queries. - Changed
message_prefixmatching to trim input by default and added unit tests for trim/default behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Bump root project version to 0.2.4. |
| assistant-agent-start/pom.xml | Bump module version to 0.2.4. |
| assistant-agent-prompt-builder/pom.xml | Bump module version to 0.2.4. |
| assistant-agent-extensions/pom.xml | Bump module version to 0.2.4. |
| assistant-agent-evaluation/pom.xml | Bump module version to 0.2.4. |
| assistant-agent-core/pom.xml | Bump module version to 0.2.4. |
| assistant-agent-common/pom.xml | Bump module version to 0.2.4. |
| assistant-agent-autoconfigure/pom.xml | Bump module version to 0.2.4. |
| assistant-agent-extensions/src/main/java/com/alibaba/assistant/agent/extension/experience/model/ExperienceQuery.java | Introduce RetrievalMode field/enum on queries. |
| assistant-agent-extensions/src/main/java/com/alibaba/assistant/agent/extension/experience/hook/FastIntentReactHook.java | Set RetrievalMode.FULL_SCAN for React FastIntent candidate recall. |
| assistant-agent-extensions/src/main/java/com/alibaba/assistant/agent/extension/experience/fastintent/FastIntentService.java | Change prefix matching to trim by default. |
| assistant-agent-extensions/src/test/java/com/alibaba/assistant/agent/extension/experience/fastintent/FastIntentServiceTest.java | Add tests for default trim and explicit trim=false. |
Comments suppressed due to low confidence (1)
assistant-agent-extensions/src/main/java/com/alibaba/assistant/agent/extension/experience/fastintent/FastIntentService.java:163
- Case-insensitive prefix matching uses
toLowerCase()with the default locale, which can produce incorrect results in certain locales (e.g., Turkish I). Prefer a locale-stable approach (e.g.,toLowerCase(Locale.ROOT)for both strings, orString#regionMatches(true, ...)) to make matching deterministic.
boolean trim = condition.getTrim() == null || Boolean.TRUE.equals(condition.getTrim());
boolean ignoreCase = Boolean.TRUE.equals(condition.getIgnoreCase());
String s = trim ? input.trim() : input;
String prefix = condition.getValue();
if (ignoreCase) {
return s.toLowerCase().startsWith(prefix.toLowerCase());
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ExperienceQuery query = new ExperienceQuery(ExperienceType.REACT); | ||
| query.setLimit(Math.max(20, properties.getMaxItemsPerQuery())); // fastpath needs enough candidates | ||
| query.setRetrievalMode(ExperienceQuery.RetrievalMode.FULL_SCAN); |
There was a problem hiding this comment.
query.setRetrievalMode(FULL_SCAN) currently has no effect because no ExperienceProvider implementation reads ExperienceQuery#getRetrievalMode() (repo-wide search only finds this setter/getter). Either wire this flag into the provider/repository query logic (e.g., alter candidate recall behavior) or remove the call to avoid misleading behavior.
| query.setRetrievalMode(ExperienceQuery.RetrievalMode.FULL_SCAN); |
| } | ||
|
|
||
| public void setRetrievalMode(RetrievalMode retrievalMode) { | ||
| this.retrievalMode = retrievalMode; |
There was a problem hiding this comment.
ExperienceQuery#setRetrievalMode(...) allows setting null, which can later lead to NullPointerException if providers implement switch/if logic on getRetrievalMode(). Consider normalizing null to RetrievalMode.DEFAULT (or rejecting null) to keep the query object in a safe default state.
| this.retrievalMode = retrievalMode; | |
| this.retrievalMode = retrievalMode != null ? retrievalMode : RetrievalMode.DEFAULT; |
This pull request updates the project version to
0.2.4across all modules and introduces improvements to the FastIntent experience matching logic. It adds a new retrieval mode for candidate recall, fixes the default behavior for prefix matching, and provides new tests to ensure correct matching behavior.Version updates:
0.2.3to0.2.4inpom.xmlfiles to ensure consistency across the project. [1] [2] [3] [4] [5] [6] [7] [8]FastIntent experience improvements:
trimoption in prefix matching: now, iftrimis not specified, input is trimmed by default, improving intent recognition for user messages with leading/trailing whitespace.RetrievalModeenum and property toExperienceQuery, supporting both default and full-scan candidate recall strategies. This enables exhaustive matching for FastIntent scenarios. [1] [2] [3]FULL_SCANwhen querying, ensuring comprehensive candidate recall.Testing and validation:
FastIntentServiceto verify that prefix matching trims input by default and respects explicittrim=falsesettings.