Class SpringAIDashscopeChatController
java.lang.Object
com.bytedesk.ai.springai.providers.dashscope.SpringAIDashscopeChatController
@RestController
@RequestMapping("/api/v1/dashscope")
@ConditionalOnProperty(prefix="spring.ai.dashscope.chat",
name="enabled",
havingValue="true",
matchIfMissing=false)
public class SpringAIDashscopeChatController
extends Object
DashScope接口
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.ai.chat.client.ChatClient
private org.springframework.ai.chat.model.ChatModel
private final ExecutorService
private final SpringAIDashscopeChatService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?>
chatCustom
(String message) 方式4:自定义参数调用 http://127.0.0.1:9003/api/v1/dashscope/chat/custom?org.springframework.web.servlet.mvc.method.annotation.SseEmitter
方式3:SSE调用 http://127.0.0.1:9003/api/v1/dashscope/chat/sse?reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse>
chatStream
(String message) 方式2:异步流式调用 http://127.0.0.1:9003/api/v1/dashscope/chat/stream?org.springframework.http.ResponseEntity<JsonResult<?>>
方式1:同步调用 http://127.0.0.1:9003/api/v1/dashscope/chat/sync?org.springframework.http.ResponseEntity<JsonResult<?>>
chatWithClient
(String message) 方式5:使用 ChatClient 调用演示 http://127.0.0.1:9003/api/v1/dashscope/chat/client?reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse>
chatWithClientStream
(String message) 方式6:使用 ChatClient 流式调用演示 http://127.0.0.1:9003/api/v1/dashscope/chat/client/stream?org.springframework.http.ResponseEntity<JsonResult<?>>
chatWithClientSystem
(String message, String systemPrompt) 方式7:使用 ChatClient 带系统提示的调用演示 http://127.0.0.1:9003/api/v1/dashscope/chat/client/system?void
destroy()
-
Field Details
-
bytedeskDashscopeChatModel
@Autowired(required=false) @Qualifier("bytedeskDashscopeChatModel") private org.springframework.ai.chat.model.ChatModel bytedeskDashscopeChatModel -
springAIDashscopeService
-
bytedeskDashscopeChatClient
private final org.springframework.ai.chat.client.ChatClient bytedeskDashscopeChatClient -
executorService
-
-
Constructor Details
-
SpringAIDashscopeChatController
public SpringAIDashscopeChatController()
-
-
Method Details
-
chatSync
@GetMapping("/chat/sync") public org.springframework.http.ResponseEntity<JsonResult<?>> chatSync(@RequestParam(value="message",defaultValue="Tell me a joke") String message) 方式1:同步调用 http://127.0.0.1:9003/api/v1/dashscope/chat/sync?message=hello -
chatStream
@GetMapping("/chat/stream") public reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse> chatStream(@RequestParam(value="message",defaultValue="Tell me a joke") String message) 方式2:异步流式调用 http://127.0.0.1:9003/api/v1/dashscope/chat/stream?message=hello -
chatSse
@GetMapping("/chat/sse") public org.springframework.web.servlet.mvc.method.annotation.SseEmitter chatSse(@RequestParam(value="message",defaultValue="Tell me a joke") String message) 方式3:SSE调用 http://127.0.0.1:9003/api/v1/dashscope/chat/sse?message=hello -
chatCustom
@GetMapping("/chat/custom") public org.springframework.http.ResponseEntity<?> chatCustom(@RequestParam(value="message",defaultValue="Tell me a joke") String message) 方式4:自定义参数调用 http://127.0.0.1:9003/api/v1/dashscope/chat/custom?message=hello -
chatWithClient
@GetMapping("/chat/client") public org.springframework.http.ResponseEntity<JsonResult<?>> chatWithClient(@RequestParam(value="message",defaultValue="Tell me a joke") String message) 方式5:使用 ChatClient 调用演示 http://127.0.0.1:9003/api/v1/dashscope/chat/client?message=hello -
chatWithClientStream
@GetMapping("/chat/client/stream") public reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse> chatWithClientStream(@RequestParam(value="message",defaultValue="Tell me a joke") String message) 方式6:使用 ChatClient 流式调用演示 http://127.0.0.1:9003/api/v1/dashscope/chat/client/stream?message=hello -
chatWithClientSystem
@GetMapping("/chat/client/system") public org.springframework.http.ResponseEntity<JsonResult<?>> chatWithClientSystem(@RequestParam(value="message",defaultValue="Tell me a joke") String message, @RequestParam(value="systemPrompt",defaultValue="You are a helpful assistant.") String systemPrompt) 方式7:使用 ChatClient 带系统提示的调用演示 http://127.0.0.1:9003/api/v1/dashscope/chat/client/system?message=hello -
destroy
public void destroy()
-