Who knows how to solve this?I have a model of ollama 3.1 running locally, and go to call it through this framework, and there is a problem with ssl。
2024-10-12T19:40:04.266+08:00 INFO 12580 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms 2024-10-12T19:40:04.436+08:00 ERROR 12580 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://localhost:11434/api/chat": Unsupported or unrecognized SSL message] with root cause
javax.net.ssl.SSLException: Unsupported or unrecognized SSL message at java.base/sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(SSLSocketInputRecord.java:457) ~[na:na] at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:175) ~[na:na] at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111) ~[na:na] at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1510) ~[na:na] at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1425) ~[na:na]
Here is my code:
@Resource
private OllamaChatModel ollamaChatModel;
@RequestMapping("/ai/ollama/chat")
public Object chat(){
ChatResponse response = ollamaChatModel.call(
new Prompt(
"hello",
OllamaOptions.builder()
.withModel(OllamaModel.LLAMA3_1)
.withTemperature(0.4)
.build()
));
return response.getResult().getOutput().getContent();
}