Skip to content

Commit 8170b94

Browse files
committed
More checkstyle changes
1 parent 25201eb commit 8170b94

File tree

142 files changed

+758
-703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+758
-703
lines changed

models/spring-ai-postgresml/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
<developerConnection>[email protected]:spring-projects/spring-ai.git</developerConnection>
3737
</scm>
3838

39+
<properties>
40+
<disable.checks>false</disable.checks>
41+
</properties>
42+
3943
<dependencies>
4044
<dependency>
4145
<groupId>org.springframework.ai</groupId>

models/spring-ai-qianfan/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
<developerConnection>[email protected]:spring-projects/spring-ai.git</developerConnection>
3737
</scm>
3838

39+
<properties>
40+
<disable.checks>false</disable.checks>
41+
</properties>
42+
3943
<dependencies>
4044

4145
<!-- production dependencies -->

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/QianFanChatModel.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ public Flux<ChatResponse> stream(Prompt prompt) {
223223
return new ChatResponse(generations, from(chatCompletion, request.model()));
224224
}))
225225
.doOnError(observation::error)
226-
.doFinally(s -> {
227-
observation.stop();
228-
})
226+
.doFinally(s -> observation.stop())
229227
.contextWrite(ctx -> ctx.put(ObservationThreadLocalAccessor.KEY, observation));
230228
return new MessageAggregator().aggregate(chatResponse, observationContext::setResponse);
231229

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/QianFanImageOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @since 1.0
3232
*/
3333
@JsonInclude(JsonInclude.Include.NON_NULL)
34-
public class QianFanImageOptions implements ImageOptions {
34+
public final class QianFanImageOptions implements ImageOptions {
3535

3636
/**
3737
* The number of images to generate. Must be between 1 and 4.
@@ -188,7 +188,7 @@ public String toString() {
188188
+ ", user='" + this.user + '\'' + '}';
189189
}
190190

191-
public static class Builder {
191+
public static final class Builder {
192192

193193
private final QianFanImageOptions options;
194194

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/aot/QianFanRuntimeHints.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ public class QianFanRuntimeHints implements RuntimeHintsRegistrar {
3737
@Override
3838
public void registerHints(@NonNull RuntimeHints hints, @Nullable ClassLoader classLoader) {
3939
var mcs = MemberCategory.values();
40-
for (var tr : findJsonAnnotatedClassesInPackage(QianFanApi.class))
40+
for (var tr : findJsonAnnotatedClassesInPackage(QianFanApi.class)) {
4141
hints.reflection().registerType(tr, mcs);
42-
for (var tr : findJsonAnnotatedClassesInPackage(QianFanImageApi.class))
42+
}
43+
for (var tr : findJsonAnnotatedClassesInPackage(QianFanImageApi.class)) {
4344
hints.reflection().registerType(tr, mcs);
45+
}
4446
}
4547

4648
}

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/api/QianFanApi.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public QianFanApi(String baseUrl, String apiKey, String secretKey, RestClient.Bu
112112
* @param responseErrorHandler Response error handler.
113113
*/
114114
public QianFanApi(String baseUrl, String apiKey, String secretKey, RestClient.Builder restClientBuilder,
115-
WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) {
115+
WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) {
116116
super(apiKey, secretKey);
117117

118118
this.restClient = restClientBuilder
@@ -139,7 +139,7 @@ public ResponseEntity<ChatCompletion> chatCompletionEntity(ChatCompletionRequest
139139
Assert.isTrue(!chatRequest.stream(), "Request must set the stream property to false.");
140140

141141
return this.restClient.post()
142-
.uri("/v1/wenxinworkshop/chat/{model}?access_token={token}",chatRequest.model, getAccessToken())
142+
.uri("/v1/wenxinworkshop/chat/{model}?access_token={token}", chatRequest.model, getAccessToken())
143143
.body(chatRequest)
144144
.retrieve()
145145
.toEntity(ChatCompletion.class);
@@ -156,7 +156,7 @@ public Flux<ChatCompletionChunk> chatCompletionStream(ChatCompletionRequest chat
156156
Assert.isTrue(chatRequest.stream(), "Request must set the stream property to true.");
157157

158158
return this.webClient.post()
159-
.uri("/v1/wenxinworkshop/chat/{model}?access_token={token}",chatRequest.model, getAccessToken())
159+
.uri("/v1/wenxinworkshop/chat/{model}?access_token={token}", chatRequest.model, getAccessToken())
160160
.body(Mono.just(chatRequest), ChatCompletionRequest.class)
161161
.retrieve()
162162
.bodyToFlux(ChatCompletionChunk.class)
@@ -287,7 +287,7 @@ public String getValue() {
287287
* probability mass are considered. We generally recommend altering this or temperature but not both.
288288
*/
289289
@JsonInclude(Include.NON_NULL)
290-
public record ChatCompletionRequest (
290+
public record ChatCompletionRequest(
291291
@JsonProperty("messages") List<ChatCompletionMessage> messages,
292292
@JsonProperty("system") String system,
293293
@JsonProperty("model") String model,
@@ -308,7 +308,7 @@ public record ChatCompletionRequest (
308308
* @param temperature What sampling temperature to use, between 0 and 1.
309309
*/
310310
public ChatCompletionRequest(List<ChatCompletionMessage> messages, String system, String model, Double temperature) {
311-
this(messages, system, model, null,null,
311+
this(messages, system, model, null, null,
312312
null, null, null, false, temperature, null);
313313
}
314314

@@ -322,7 +322,7 @@ public ChatCompletionRequest(List<ChatCompletionMessage> messages, String system
322322
* as they become available, with the stream terminated by a data: [DONE] message.
323323
*/
324324
public ChatCompletionRequest(List<ChatCompletionMessage> messages, String system, String model, Double temperature, boolean stream) {
325-
this(messages, system, model, null,null,
325+
this(messages, system, model, null, null,
326326
null, null, null, stream, temperature, null);
327327
}
328328

@@ -336,7 +336,7 @@ public ChatCompletionRequest(List<ChatCompletionMessage> messages, String system
336336
* as they become available, with the stream terminated by a data: [DONE] message.
337337
*/
338338
public ChatCompletionRequest(List<ChatCompletionMessage> messages, String system, Boolean stream) {
339-
this(messages, system, DEFAULT_CHAT_MODEL, null,null,
339+
this(messages, system, DEFAULT_CHAT_MODEL, null, null,
340340
null, null, null, stream, 0.8, null);
341341
}
342342

@@ -382,15 +382,18 @@ public enum Role {
382382
/**
383383
* System message.
384384
*/
385-
@JsonProperty("system") SYSTEM,
385+
@JsonProperty("system")
386+
SYSTEM,
386387
/**
387388
* User message.
388389
*/
389-
@JsonProperty("user") USER,
390+
@JsonProperty("user")
391+
USER,
390392
/**
391393
* Assistant message.
392394
*/
393-
@JsonProperty("assistant") ASSISTANT
395+
@JsonProperty("assistant")
396+
ASSISTANT
394397
}
395398
}
396399

@@ -483,7 +486,7 @@ public EmbeddingRequest(String text) {
483486
* @param userId A unique identifier representing your end-user, which can help QianFan to
484487
* monitor and detect abuse.
485488
*/
486-
public EmbeddingRequest(String text,String model,String userId) {
489+
public EmbeddingRequest(String text, String model, String userId) {
487490
this(List.of(text), model, userId);
488491
}
489492

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/api/QianFanConstants.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@
2525
* @author Geng Rong
2626
* @since 1.0
2727
*/
28-
public class QianFanConstants {
28+
public final class QianFanConstants {
2929

3030
public static final String DEFAULT_BASE_URL = "https://aip.baidubce.com/rpc/2.0/ai_custom";
3131

3232
public static final String PROVIDER_NAME = AiProvider.QIANFAN.value();
3333

34+
private QianFanConstants() {
35+
36+
}
37+
3438
}

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/api/QianFanImageApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public String getValue() {
114114

115115
// @formatter:off
116116
@JsonInclude(JsonInclude.Include.NON_NULL)
117-
public record QianFanImageRequest (
117+
public record QianFanImageRequest(
118118
@JsonProperty("model") String model,
119119
@JsonProperty("prompt") String prompt,
120120
@JsonProperty("negative_prompt") String negativePrompt,

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/api/QianFanUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121
import org.springframework.http.HttpHeaders;
2222
import org.springframework.http.MediaType;
2323

24-
public class QianFanUtils {
24+
public final class QianFanUtils {
2525

2626
public static Consumer<HttpHeaders> defaultHeaders() {
2727
return headers -> headers.setContentType(MediaType.APPLICATION_JSON);
2828
}
2929

30+
private QianFanUtils() {
31+
32+
}
33+
3034
}

models/spring-ai-qianfan/src/main/java/org/springframework/ai/qianfan/api/auth/QianFanAccessToken.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ private long getCurrentTimeInSeconds() {
8686
return System.currentTimeMillis() / 1000L;
8787
}
8888

89-
}
89+
}

0 commit comments

Comments
 (0)