Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assistant-agent-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
</parent>

<artifactId>assistant-agent-autoconfigure</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion assistant-agent-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
</parent>

<artifactId>assistant-agent-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion assistant-agent-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
</parent>

<artifactId>assistant-agent-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion assistant-agent-evaluation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
</parent>

<artifactId>assistant-agent-evaluation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion assistant-agent-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
</parent>

<artifactId>assistant-agent-extensions</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public boolean matches(FastIntentConfig.Condition condition, FastIntentContext c
if (!StringUtils.hasText(input) || !StringUtils.hasText(condition.getValue())) {
return false;
}
boolean trim = Boolean.TRUE.equals(condition.getTrim());
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();
Expand Down Expand Up @@ -275,4 +275,3 @@ public boolean matches(FastIntentConfig.Condition condition, FastIntentContext c
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public CompletableFuture<Map<String, Object>> beforeAgent(OverAllState state, Ru

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.
// 关键修复:设置查询文本,用于向量搜索
if (StringUtils.hasText(userInput)) {
query.setText(userInput);
Expand Down Expand Up @@ -253,4 +254,3 @@ private ExperienceQueryContext buildQueryContext(OverAllState state, RunnableCon
return context;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class ExperienceQuery {
*/
private int limit = 5;

/**
* 经验候选召回策略。
*/
private RetrievalMode retrievalMode = RetrievalMode.DEFAULT;

/**
* 排序方式
*/
Expand All @@ -64,6 +69,20 @@ public enum OrderBy {
SCORE
}

/**
* 候选召回策略。
*/
public enum RetrievalMode {
/**
* 默认策略,由 Provider 自行决定是否走向量召回或普通查询。
*/
DEFAULT,
/**
* 全量扫描候选集,适用于 FastIntent 等需要穷举匹配的场景。
*/
FULL_SCAN
}

public ExperienceQuery() {
}

Expand Down Expand Up @@ -119,6 +138,14 @@ public void setLimit(int limit) {
this.limit = limit;
}

public RetrievalMode getRetrievalMode() {
return retrievalMode;
}

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.
}

public OrderBy getOrderBy() {
return orderBy;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.alibaba.assistant.agent.extension.experience.fastintent;

import com.alibaba.assistant.agent.extension.experience.model.FastIntentConfig;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

class FastIntentServiceTest {

private final FastIntentService service = new FastIntentService(List.of());

@Test
void messagePrefixShouldTrimByDefault() {
FastIntentConfig.Condition condition = new FastIntentConfig.Condition();
condition.setType("message_prefix");
condition.setValue("帮我诊断这个缺陷");

FastIntentConfig.MatchExpression expression = new FastIntentConfig.MatchExpression();
expression.setCondition(condition);

FastIntentContext context = new FastIntentContext(
"\n帮我诊断这个缺陷,缺陷ID:71410746",
List.of(),
Map.of(),
null,
null
);

assertTrue(service.matches(expression, context));
}

@Test
void messagePrefixShouldRespectExplicitNoTrim() {
FastIntentConfig.Condition condition = new FastIntentConfig.Condition();
condition.setType("message_prefix");
condition.setValue("帮我诊断这个缺陷");
condition.setTrim(false);

FastIntentConfig.MatchExpression expression = new FastIntentConfig.MatchExpression();
expression.setCondition(condition);

FastIntentContext context = new FastIntentContext(
"\n帮我诊断这个缺陷,缺陷ID:71410746",
List.of(),
Map.of(),
null,
null
);

assertFalse(service.matches(expression, context));
}
}
2 changes: 1 addition & 1 deletion assistant-agent-prompt-builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
</parent>

<artifactId>assistant-agent-prompt-builder</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion assistant-agent-start/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
</parent>

<artifactId>assistant-agent-start</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba.agent.assistant</groupId>
<artifactId>assistant-agent</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
<packaging>pom</packaging>
<distributionManagement>
<repository>
Expand Down
Loading