refs #737: preserve unmatched game mentions in query plan
This commit is contained in:
@@ -245,6 +245,26 @@ class McpSseServiceTest {
|
||||
.contains("REPORT_UNSUPPORTED");
|
||||
}
|
||||
|
||||
@Test
|
||||
void keepsUnmatchedMentionsInPartialGameQueryPlan() {
|
||||
ObjectNode request = request(9, "tools/call");
|
||||
ObjectNode params = (ObjectNode) request.putObject("params");
|
||||
params.put("name", "oracle.select_ai.game_query_plan");
|
||||
params.putObject("arguments")
|
||||
.put("question", "supported game and unknown game");
|
||||
|
||||
ObjectNode response = service.handle("default", request, "user-bearer");
|
||||
|
||||
assertThat(response.path("result").path("isError").asBoolean()).isFalse();
|
||||
String payload = response.path("result").path("content").get(0)
|
||||
.path("text").asText();
|
||||
assertThat(payload)
|
||||
.contains("\"status\" : \"PARTIAL\"")
|
||||
.contains("\"gameKey\" : \"SUPPORTED_GAME\"")
|
||||
.contains("\"mention\" : \"Unknown game\"")
|
||||
.contains("\"reasonCode\" : \"NO_CATALOG_IDENTITY_MATCH\"");
|
||||
}
|
||||
|
||||
private ObjectNode request(int id, String method) {
|
||||
ObjectNode request = objectMapper.createObjectNode();
|
||||
request.put("jsonrpc", "2.0");
|
||||
@@ -351,14 +371,40 @@ class McpSseServiceTest {
|
||||
|
||||
@Override
|
||||
public Resolution resolve(String token, String question, int topK) {
|
||||
return new Resolution("SINGLE_GAME", java.util.List.of(new GameCandidate(
|
||||
GameCandidate supported = new GameCandidate(
|
||||
"SUPPORTED_GAME",
|
||||
"SUPPORTED_GAME_ID",
|
||||
"SUPPORTED_PREFIX",
|
||||
"Supported game",
|
||||
"Supported",
|
||||
0.1
|
||||
)));
|
||||
);
|
||||
GameCandidate nearestUnknownCandidate = new GameCandidate(
|
||||
"OTHER_GAME",
|
||||
"OTHER_GAME_ID",
|
||||
"OTHER_PREFIX",
|
||||
"Other game",
|
||||
"Other",
|
||||
0.6
|
||||
);
|
||||
return new Resolution(
|
||||
"MULTI_GAME",
|
||||
java.util.List.of(supported),
|
||||
java.util.List.of(
|
||||
new MentionResolution(
|
||||
"Supported game",
|
||||
"MATCHED",
|
||||
supported,
|
||||
java.util.List.of(supported)
|
||||
),
|
||||
new MentionResolution(
|
||||
"Unknown game",
|
||||
"UNMATCHED",
|
||||
null,
|
||||
java.util.List.of(nearestUnknownCandidate)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user