pat_w8sIwaOaSfGJzn3DNtbc9gUEty01789K6kTNbHDLEB9fW1WsWqrmPHvXylADspea
This commit is contained in:
parent
c304828398
commit
35d1245529
@ -9,6 +9,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@ -46,7 +47,10 @@ public class AssistantApiController {
|
||||
this.fileStore = fileStore;
|
||||
}
|
||||
|
||||
@PostMapping({"/general/query", "/general/query/", "/general/query/general"})
|
||||
@PostMapping(
|
||||
value = {"/general/query", "/general/query/", "/general/query/general"},
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AssistantQueryResponse generalQuery(@RequestBody AssistantQueryRequest request) {
|
||||
String query = request == null ? "" : request.normalizedQuery();
|
||||
if (query.isEmpty()) return AssistantQueryResponse.failure("query不能为空");
|
||||
@ -58,11 +62,14 @@ public class AssistantApiController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({
|
||||
"/sports-venue/query",
|
||||
"/sports-venue/query/",
|
||||
"/sports-venue/query/sports-venue"
|
||||
})
|
||||
@PostMapping(
|
||||
value = {
|
||||
"/sports-venue/query",
|
||||
"/sports-venue/query/",
|
||||
"/sports-venue/query/sports-venue"
|
||||
},
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public AssistantQueryResponse sportsVenueQuery(
|
||||
@RequestBody AssistantQueryRequest request,
|
||||
HttpServletRequest httpRequest
|
||||
|
||||
@ -3,6 +3,7 @@ package com.company.agentfoundation.assistant.api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@ -11,7 +12,9 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequestMapping("/api/assistant/openapi")
|
||||
public class AssistantOpenApiController {
|
||||
@GetMapping({"/general", "/general.json"})
|
||||
@GetMapping(
|
||||
value = {"/general", "/general.json"},
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> general() {
|
||||
return specification(
|
||||
"问答小助手API",
|
||||
@ -20,7 +23,9 @@ public class AssistantOpenApiController {
|
||||
"将用户输入发送给扣子问答工作流并返回回答");
|
||||
}
|
||||
|
||||
@GetMapping({"/sports-venue", "/sports-venue.json"})
|
||||
@GetMapping(
|
||||
value = {"/sports-venue", "/sports-venue.json"},
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> sportsVenue() {
|
||||
return specification(
|
||||
"运动馆智能助手API",
|
||||
|
||||
@ -39,7 +39,7 @@ foundation:
|
||||
coze:
|
||||
base-url: https://api.coze.cn
|
||||
chat-path: /v1/workflows/chat
|
||||
api-key: cztei_ltE7Q8NDyJq6v4f6yUg5s9oMYfzwC4d25vj70j9FoLLJbQneDXi8pw7uBoqXLeV8x
|
||||
api-key: pat_w8sIwaOaSfGJzn3DNtbc9gUEty01789K6kTNbHDLEB9fW1WsWqrmPHvXylADspea
|
||||
default-workflow: wecom-default
|
||||
workflows:
|
||||
wecom-default:
|
||||
@ -61,14 +61,12 @@ foundation:
|
||||
name: 问答小助手
|
||||
agent-id: 1000002
|
||||
secret: 8tnH50ISscWBhQbxSzjRrA6XT2oJBUvEdEpY77hmEK4
|
||||
#callback-path: /v1/integrations/wecom/callback
|
||||
callback-path: /v1/integrations/wecom/sports-venue/callback
|
||||
callback-path: /v1/integrations/wecom/callback
|
||||
sports-venue:
|
||||
name: 运动馆智能助手
|
||||
agent-id: 1000002
|
||||
secret: 8tnH50ISscWBhQbxSzjRrA6XT2oJBUvEdEpY77hmEK4
|
||||
#callback-path: /v1/integrations/wecom/sports-venue/callback
|
||||
callback-path: /v1/integrations/wecom/callback
|
||||
callback-path: /v1/integrations/wecom/sports-venue/callback
|
||||
admin-user-ids:
|
||||
- TangLong
|
||||
- TangLong
|
||||
|
||||
@ -7,6 +7,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
class AssistantOpenApiControllerTest {
|
||||
@ -19,6 +20,7 @@ class AssistantOpenApiControllerTest {
|
||||
void exposesGeneralAssistantOpenApiDocument() throws Exception {
|
||||
mvc.perform(get("/api/assistant/openapi/general.json"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType("application/json"))
|
||||
.andExpect(jsonPath("$.openapi").value("3.0.1"))
|
||||
.andExpect(jsonPath("$.paths['/api/assistant/general/query'].post.operationId")
|
||||
.value("generalAssistantQuery"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user