路径
This commit is contained in:
parent
e89fbd3141
commit
5e2c493e5b
@ -45,7 +45,7 @@ public class AssistantApiController {
|
||||
this.fileStore = fileStore;
|
||||
}
|
||||
|
||||
@PostMapping("/general/query")
|
||||
@PostMapping({"/general/query", "/general/query/", "/general/query/general"})
|
||||
public AssistantQueryResponse generalQuery(@RequestBody AssistantQueryRequest request) {
|
||||
String query = request == null ? "" : request.normalizedQuery();
|
||||
if (query.isEmpty()) return AssistantQueryResponse.failure("query不能为空");
|
||||
@ -57,7 +57,11 @@ public class AssistantApiController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/sports-venue/query")
|
||||
@PostMapping({
|
||||
"/sports-venue/query",
|
||||
"/sports-venue/query/",
|
||||
"/sports-venue/query/sports-venue"
|
||||
})
|
||||
public AssistantQueryResponse sportsVenueQuery(
|
||||
@RequestBody AssistantQueryRequest request,
|
||||
HttpServletRequest httpRequest
|
||||
|
||||
@ -92,6 +92,43 @@ class AssistantApiControllerTest {
|
||||
verify(semantic).dispatchWithAttachments("YiNianYiQingJing", "查看今日客资日报");
|
||||
}
|
||||
|
||||
@Test
|
||||
void sportsVenueApiSupportsWecomAppendedToolNamePath() throws Exception {
|
||||
SemanticDispatchService semantic = mock(SemanticDispatchService.class);
|
||||
when(semantic.dispatchWithAttachments("YiNianYiQingJing", "客资日报"))
|
||||
.thenReturn(new SemanticDispatchResult("客资日报结果", List.of()));
|
||||
MockMvc mvc = mvc(
|
||||
mock(CozeWorkflowService.class),
|
||||
semantic,
|
||||
new AssistantFileStore());
|
||||
|
||||
mvc.perform(post("/api/assistant/sports-venue/query/sports-venue")
|
||||
.header("userid", "YiNianYiQingJing")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"query\":\"客资日报\"}"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.success").value(true))
|
||||
.andExpect(jsonPath("$.content").value("客资日报结果"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void sportsVenueApiSupportsWecomTrailingSlashPath() throws Exception {
|
||||
SemanticDispatchService semantic = mock(SemanticDispatchService.class);
|
||||
when(semantic.dispatchWithAttachments("YiNianYiQingJing", "客资日报"))
|
||||
.thenReturn(new SemanticDispatchResult("客资日报结果", List.of()));
|
||||
MockMvc mvc = mvc(
|
||||
mock(CozeWorkflowService.class),
|
||||
semantic,
|
||||
new AssistantFileStore());
|
||||
|
||||
mvc.perform(post("/api/assistant/sports-venue/query/")
|
||||
.header("userid", "YiNianYiQingJing")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"query\":\"客资日报\"}"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.success").value(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void sportsVenueApiRejectsRequestWhenWecomContextHasNoUserId() throws Exception {
|
||||
MockMvc mvc = mvc(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user