Skip to content

Commit f7d60e7

Browse files
committed
Create DashscopeChatOptions bean
1 parent 89b61fa commit f7d60e7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

spring-boot-autoconfigure/src/main/java/io/github/alexcheng1982/springai/dashscope/autoconfigure/DashscopeAutoConfiguration.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.alexcheng1982.springai.dashscope.autoconfigure;
22

33
import io.github.alexcheng1982.springai.dashscope.DashscopeChatClient;
4+
import io.github.alexcheng1982.springai.dashscope.DashscopeChatOptions;
45
import io.github.alexcheng1982.springai.dashscope.DashscopeEmbeddingClient;
56
import io.github.alexcheng1982.springai.dashscope.api.DashscopeApi;
67
import org.springframework.ai.model.function.FunctionCallbackContext;
@@ -27,12 +28,21 @@ public DashscopeApi dashscopeApi() {
2728
@ConditionalOnProperty(prefix = DashscopeChatProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
2829
matchIfMissing = true)
2930
public DashscopeChatClient dashscopeChatClient(DashscopeApi dashscopeApi,
30-
DashscopeChatProperties properties,
31+
DashscopeChatOptions options,
3132
FunctionCallbackContext functionCallbackContext) {
32-
return new DashscopeChatClient(dashscopeApi, properties.getOptions(),
33+
return new DashscopeChatClient(dashscopeApi, options,
3334
functionCallbackContext);
3435
}
3536

37+
@Bean
38+
@ConditionalOnMissingBean
39+
@ConditionalOnProperty(prefix = DashscopeChatProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
40+
matchIfMissing = true)
41+
public DashscopeChatOptions defaultDashscopeChatOptions(
42+
DashscopeChatProperties properties) {
43+
return properties.getOptions();
44+
}
45+
3646
@Bean
3747
@ConditionalOnMissingBean
3848
@ConditionalOnProperty(prefix = DashscopeEmbeddingProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",

0 commit comments

Comments
 (0)