feat: 增强情绪博物馆项目功能 - 新增用户评论和帖子功能,优化前端架构和WebSocket通信 - 更新文档和部署配置
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.emotionmuseum.config;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* Coze配置类
|
||||
*
|
||||
* @author emotion-museum
|
||||
* @version 1.0.0
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "emotion.coze")
|
||||
@Data
|
||||
@Slf4j
|
||||
public class CozeConfig {
|
||||
|
||||
/**
|
||||
* API密钥
|
||||
*/
|
||||
private String apiKey;
|
||||
|
||||
/**
|
||||
* 机器人ID
|
||||
*/
|
||||
private String botId;
|
||||
|
||||
/**
|
||||
* 基础URL
|
||||
*/
|
||||
private String baseUrl = "https://www.coze.cn/api";
|
||||
|
||||
/**
|
||||
* 超时时间(毫秒)
|
||||
*/
|
||||
private int timeout = 30000;
|
||||
|
||||
/**
|
||||
* 最大重试次数
|
||||
*/
|
||||
private int maxRetries = 3;
|
||||
|
||||
/**
|
||||
* 验证配置
|
||||
*/
|
||||
@PostConstruct
|
||||
public void validateConfig() {
|
||||
if (!StringUtils.hasText(apiKey)) {
|
||||
log.warn("Coze API Key未配置,AI功能可能无法正常使用");
|
||||
}
|
||||
if (!StringUtils.hasText(botId)) {
|
||||
log.warn("Coze Bot ID未配置,AI功能可能无法正常使用");
|
||||
}
|
||||
if (StringUtils.hasText(apiKey) && StringUtils.hasText(botId)) {
|
||||
log.info("Coze配置验证通过,Bot ID: {}", botId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user