Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
*/

@AutoConfiguration
@Conditional(PromptTmplNacosConfigCondition.class)
@EnableConfigurationProperties(NacosPromptTmplProperties.class)
@Conditional(PromptTemplateConfigCondition.class)
@EnableConfigurationProperties(PromptTemplateProperties.class)
public class PromptTemplateAutoConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
* of Nacos log error during startup.
*/

public class PromptTmplNacosConfigCondition implements Condition {
public class PromptTemplateConfigCondition implements Condition {

private final Logger logger = LoggerFactory.getLogger(PromptTmplNacosConfigCondition.class);
private final Logger logger = LoggerFactory.getLogger(PromptTemplateConfigCondition.class);

public PromptTmplNacosConfigCondition() {
public PromptTemplateConfigCondition() {
}

@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

// @formatter:off
String tmplPrefix = NacosPromptTmplProperties.TEMPLATE_PREFIX + ".enabled";
String tmplPrefix = PromptTemplateProperties.TEMPLATE_PREFIX + ".enabled";

// The default value is false, means that the nacos prompt template is not enabled.
Boolean enabled = context.getEnvironment().getProperty(tmplPrefix, Boolean.class, false);
Expand All @@ -50,7 +50,7 @@ public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata)
if (!enabled) {
System.setProperty("spring.nacos.config.enabled", "false");
}
logger.debug("PromptTmplNacosConfigCondition matches enabled: {}",enabled);
logger.debug("PromptTemplateConfigCondition matches enabled: {}",enabled);
// @formatter:on

return enabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* @author <a href="mailto:yuluo08290126@gmail.com">yuluo</a>
*/

@ConfigurationProperties(NacosPromptTmplProperties.TEMPLATE_PREFIX)
public class NacosPromptTmplProperties {
@ConfigurationProperties(PromptTemplateProperties.TEMPLATE_PREFIX)
public class PromptTemplateProperties {

public final static String TEMPLATE_PREFIX = "spring.ai.nacos.prompt.template";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
{
"name": "spring.ai.nacos.prompt.template",
"type": "com.alibaba.cloud.ai.autoconfigure.prompt.NacosPromptTmplProperties",
"sourceType": "com.alibaba.cloud.ai.autoconfigure.prompt.NacosPromptTmplProperties",
"type": "com.alibaba.cloud.ai.autoconfigure.prompt.PromptTemplateProperties",
"sourceType": "com.alibaba.cloud.ai.autoconfigure.prompt.PromptTemplateProperties",
"description": "Configuration properties for Nacos prompt template integration."
}
],
Expand Down Expand Up @@ -161,7 +161,7 @@
"name": "spring.ai.nacos.prompt.template.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable Nacos prompt template support.",
"sourceType": "com.alibaba.cloud.ai.autoconfigure.prompt.NacosPromptTmplProperties",
"sourceType": "com.alibaba.cloud.ai.autoconfigure.prompt.PromptTemplateProperties",
"defaultValue": false
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

@SpringBootTest
class NacosPromptTmplPropertiesTests {
class PromptTemplatePropertiesTests {

@Autowired
private NacosPromptTmplProperties properties;
private PromptTemplateProperties properties;

@Test
void testDefaultEnabled() {
Expand All @@ -43,7 +43,7 @@ void testSetEnabled() {
}

@Configuration
@EnableConfigurationProperties(NacosPromptTmplProperties.class)
@EnableConfigurationProperties(PromptTemplateProperties.class)
static class TestConfig {

}
Expand Down
Loading