Skip to content

快速意图扫描所有react经验#49

Merged
AQing-527 merged 6 commits into
mainfrom
feature/20260401_28837583_fast_intent_scan_all_react_experience_1
Apr 1, 2026
Merged

快速意图扫描所有react经验#49
AQing-527 merged 6 commits into
mainfrom
feature/20260401_28837583_fast_intent_scan_all_react_experience_1

Conversation

@AQing-527
Copy link
Copy Markdown
Collaborator

This pull request updates the project version to 0.2.4 across 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:

  • Bumped the parent and all module versions from 0.2.3 to 0.2.4 in pom.xml files to ensure consistency across the project. [1] [2] [3] [4] [5] [6] [7] [8]

FastIntent experience improvements:

  • Changed the default behavior of the trim option in prefix matching: now, if trim is not specified, input is trimmed by default, improving intent recognition for user messages with leading/trailing whitespace.
  • Added a new RetrievalMode enum and property to ExperienceQuery, supporting both default and full-scan candidate recall strategies. This enables exhaustive matching for FastIntent scenarios. [1] [2] [3]
  • Updated the FastIntent React hook to explicitly set the retrieval mode to FULL_SCAN when querying, ensuring comprehensive candidate recall.

Testing and validation:

  • Added unit tests for FastIntentService to verify that prefix matching trims input by default and respects explicit trim=false settings.

Copilot AI review requested due to automatic review settings April 1, 2026 07:01
Copy link
Copy Markdown
Collaborator

@canfuu canfuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AQing-527 AQing-527 merged commit 05d82e7 into main Apr 1, 2026
3 checks passed
@AQing-527 AQing-527 deleted the feature/20260401_28837583_fast_intent_scan_all_react_experience_1 branch April 1, 2026 07:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.3 to 0.2.4.
  • Added ExperienceQuery.RetrievalMode and set FULL_SCAN for FastIntent React queries.
  • Changed message_prefix matching 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, or String#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);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
query.setRetrievalMode(ExperienceQuery.RetrievalMode.FULL_SCAN);

Copilot uses AI. Check for mistakes.
}

public void setRetrievalMode(RetrievalMode retrievalMode) {
this.retrievalMode = retrievalMode;
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
this.retrievalMode = retrievalMode;
this.retrievalMode = retrievalMode != null ? retrievalMode : RetrievalMode.DEFAULT;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants