Class SpringAISiliconFlowController
java.lang.Object
com.bytedesk.ai.springai.siliconflow.SpringAISiliconFlowController
@RestController
@RequestMapping("/springai/siliconflow")
@ConditionalOnProperty(name="spring.ai.siliconflow.chat.enabled",
havingValue="true",
matchIfMissing=false)
public class SpringAISiliconFlowController
extends Object
- Author:
- https://github.com/fzj111 date: 2025-03-19 siliconFlow https://docs.spring.io/spring-ai/reference/api/chat/siliconFlow-chat.html#chat-options 参考: https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/proxy/siliconFlowWithOpenAiChatModelIT.java
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ExecutorService
private final SpringAISiliconFlowService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?>
chatCustom
(String message) 自定义模型参数的调用示例 http://127.0.0.1:9003/springai/deepseek/chat/custom?org.springframework.web.servlet.mvc.method.annotation.SseEmitter
方式3:SSE调用 http://127.0.0.1:9003/springai/deepseek/chat/sse?reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse>
chatStream
(String message) 方式2:异步流式调用 http://127.0.0.1:9003/springai/deepseek/chat/stream?org.springframework.http.ResponseEntity<JsonResult<?>>
方式1:同步调用 http://127.0.0.1:9003/springai/deepseek/chat/sync?void
destroy()
-
Field Details
-
springAISiliconFlowService
-
executorService
-
-
Constructor Details
-
SpringAISiliconFlowController
public SpringAISiliconFlowController()
-
-
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/springai/deepseek/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/springai/deepseek/chat/stream?message=hello -
chatSSE
@GetMapping(value="/chat/sse", produces="text/event-stream") 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/springai/deepseek/chat/sse?message=hello -
chatCustom
@GetMapping("/chat/custom") public org.springframework.http.ResponseEntity<?> chatCustom(@RequestParam(value="message",defaultValue="Tell me a joke") String message) 自定义模型参数的调用示例 http://127.0.0.1:9003/springai/deepseek/chat/custom?message=hello -
destroy
public void destroy()
-