Skip to content

Commit 3e89170

Browse files
authored
Add null-check of 'read-timeout' (#54)
* gh-51 add null-check of 'read-timeout' Signed-off-by: Linar Abzaltdinov <abzaltdinov@gmail.com> * spotless Signed-off-by: Linar Abzaltdinov <abzaltdinov@gmail.com> * bump spring-ai to 1.0.3 Signed-off-by: Linar Abzaltdinov <abzaltdinov@gmail.com> * release 1.0.6 Signed-off-by: Linar Abzaltdinov <abzaltdinov@gmail.com> --------- Signed-off-by: Linar Abzaltdinov <abzaltdinov@gmail.com>
1 parent f4c2a46 commit 3e89170

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<dependency>
3535
<groupId>chat.giga</groupId>
3636
<artifactId>spring-ai-starter-model-gigachat</artifactId>
37-
<version>1.0.5</version>
37+
<version>1.0.6</version>
3838
<!-- или 1.1.0-M1.001 - для работы с релизом Spring AI 1.1.0-M1 -->
3939
</dependency>
4040
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,4 +390,4 @@
390390
</build>
391391
</profile>
392392
</profiles>
393-
</project>
393+
</project>

spring-ai-gigachat-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@
157157
</plugins>
158158
</build>
159159

160-
</project>
160+
</project>

spring-ai-gigachat/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@
6161
</dependency>
6262
</dependencies>
6363

64-
</project>
64+
</project>

spring-ai-gigachat/src/main/java/chat/giga/springai/api/auth/bearer/GigaChatBearerAuthApi.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static chat.giga.springai.api.chat.GigaChatApi.USER_AGENT_SPRING_AI_GIGACHAT;
44

55
import chat.giga.springai.api.GigaChatApiProperties;
6+
import chat.giga.springai.api.GigaChatInternalProperties;
67
import chat.giga.springai.api.HttpClientUtils;
78
import chat.giga.springai.api.auth.GigaChatApiScope;
89
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -45,9 +46,12 @@ public GigaChatBearerAuthApi(
4546
boolean isUnsafeSsl = apiProperties.isUnsafeSsl();
4647
SSLFactory sslFactory = HttpClientUtils.buildSslFactory(kmf, tmf, isUnsafeSsl);
4748
String authUrl = apiProperties.getAuthUrl();
48-
var clientHttpRequestFactory = new JdkClientHttpRequestFactory(HttpClientUtils.buildHttpClient(
49-
sslFactory, apiProperties.getInternal().getConnectTimeout()));
50-
clientHttpRequestFactory.setReadTimeout(apiProperties.getInternal().getReadTimeout());
49+
GigaChatInternalProperties internalProps = apiProperties.getInternal();
50+
var clientHttpRequestFactory = new JdkClientHttpRequestFactory(
51+
HttpClientUtils.buildHttpClient(sslFactory, internalProps.getConnectTimeout()));
52+
if (internalProps.getReadTimeout() != null) {
53+
clientHttpRequestFactory.setReadTimeout(internalProps.getReadTimeout());
54+
}
5155
this.restClient = builder.baseUrl(authUrl)
5256
.requestFactory(clientHttpRequestFactory)
5357
.build();

spring-ai-gigachat/src/main/java/chat/giga/springai/api/chat/GigaChatApi.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ public GigaChatApi(
8383

8484
var clientHttpRequestFactory = new JdkClientHttpRequestFactory(buildHttpClient(
8585
buildSslFactory(kmf, tmf, properties.isUnsafeSsl()), internalProps.getConnectTimeout()));
86-
clientHttpRequestFactory.setReadTimeout(internalProps.getReadTimeout());
86+
if (internalProps.getReadTimeout() != null) {
87+
clientHttpRequestFactory.setReadTimeout(internalProps.getReadTimeout());
88+
}
8789
this.restClient = restClientBuilder
8890
.clone()
8991
.requestFactory(clientHttpRequestFactory)

0 commit comments

Comments
 (0)