File tree Expand file tree Collapse file tree
java/io/github/javaaidev/agent Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package io .github .javaaidev .agent ;
2+
3+ import java .net .http .HttpClient ;
4+ import java .time .Duration ;
5+ import org .springframework .context .annotation .Bean ;
6+ import org .springframework .context .annotation .Configuration ;
7+ import org .springframework .core .task .SimpleAsyncTaskExecutor ;
8+ import org .springframework .http .client .JdkClientHttpRequestFactory ;
9+ import org .springframework .http .client .reactive .JdkClientHttpConnector ;
10+ import org .springframework .web .client .RestClient ;
11+ import org .springframework .web .reactive .function .client .WebClient ;
12+
13+ @ Configuration
14+ public class AppConfiguration {
15+
16+ @ Bean
17+ public RestClient .Builder restClientBuilder (HttpClient httpClient ) {
18+ JdkClientHttpRequestFactory requestFactory = new JdkClientHttpRequestFactory (httpClient );
19+ requestFactory .setReadTimeout (Duration .ofMinutes (3 ));
20+ return RestClient .builder ().requestFactory (requestFactory );
21+ }
22+
23+ @ Bean
24+ public WebClient .Builder webClientBuilder (HttpClient httpClient ) {
25+ var connector = new JdkClientHttpConnector (httpClient );
26+ connector .setReadTimeout (Duration .ofMinutes (3 ));
27+ return WebClient .builder ().clientConnector (connector );
28+ }
29+
30+ @ Bean
31+ public HttpClient httpClient () {
32+ var executor = new SimpleAsyncTaskExecutor ();
33+ executor .setVirtualThreads (true );
34+ return HttpClient .newBuilder ()
35+ .executor (executor )
36+ .connectTimeout (Duration .ofMinutes (3 ))
37+ .build ();
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ spring :
2+ ai :
3+ openai :
4+ baseUrl : https://api.deepseek.com
5+ api-key : ${DEEPSEEK_API_KEY:}
6+ chat :
7+ options :
8+ model : deepseek-chat
9+ temperature : 0.0
You can’t perform that action at this time.
0 commit comments