Class SpringAIOllamaChatController

java.lang.Object
com.bytedesk.ai.springai.providers.ollama.SpringAIOllamaChatController

@RestController @RequestMapping("/api/v1/ollama") @ConditionalOnProperty(prefix="spring.ai.ollama.chat", name="enabled", havingValue="true", matchIfMissing=false) public class SpringAIOllamaChatController extends Object
Ollama接口
  • Field Details

  • Constructor Details

    • SpringAIOllamaChatController

      public SpringAIOllamaChatController()
  • Method Details

    • chatSync

      @GetMapping("/chat/sync") public org.springframework.http.ResponseEntity<JsonResult<?>> chatSync(OllamaRequest request)
      方式1:同步调用 http://127.0.0.1:9003/api/v1/ollama/chat/sync?message=hello&amp;amp;apiUrl=&model=llama3
    • chatStream

      @GetMapping("/chat/stream") public reactor.core.publisher.Flux<org.springframework.ai.chat.model.ChatResponse> chatStream(OllamaRequest request)
      方式2:异步流式调用 http://127.0.0.1:9003/api/v1/ollama/chat/stream?message=hello&amp;amp;apiUrl=&model=llama3
    • chatSSE

      @GetMapping(value="/chat/sse", produces="text/event-stream") public org.springframework.web.servlet.mvc.method.annotation.SseEmitter chatSSE(OllamaRequest request)
      方式3:SSE调用 http://127.0.0.1:9003/api/v1/ollama/chat/sse?message=hello&amp;amp;apiUrl=&model=llama3
    • chatCustom

      @GetMapping("/chat/custom") public org.springframework.http.ResponseEntity<JsonResult<?>> chatCustom(OllamaRequest request)
      自定义模型参数的调用示例 http://127.0.0.1:9003/api/v1/ollama/chat/custom?message=hello&amp;amp;apiUrl=&model=llama3
    • isEmbeddingModelExists

      @GetMapping("/embedding-model/exists") public org.springframework.http.ResponseEntity<?> isEmbeddingModelExists(OllamaRequest request)
    • destroy

      public void destroy()