added dev and prod DB in env file

This commit is contained in:
rahulpscraftech360 2025-09-09 12:37:33 +05:30
parent fc526d12f0
commit d22297e66a
9 changed files with 159 additions and 8 deletions

View file

@ -0,0 +1,31 @@
# Spring Profile Configuration
# Set to 'dev' for development or 'prod' for production
SPRING_PROFILES_ACTIVE=dev
# Server Configuration
SERVER_PORT=8002
# Database Configuration (Override if needed)
# DB_HOST=localhost
# DB_PORT=3306
# DB_NAME=xiaozhi
# DB_USERNAME=root
# DB_PASSWORD=your_password_here
# Redis Configuration (Override if needed)
# REDIS_HOST=localhost
# REDIS_PORT=6379
# REDIS_PASSWORD=your_redis_password
# External Services
XIAOZHI_PYTHON_SERVER_URL=http://localhost:8003
# Vector Database (Qdrant)
QDRANT_URL=your_qdrant_url_here
QDRANT_API_KEY=your_qdrant_api_key_here
# Voyage AI API Key
VOYAGE_API_KEY=your_voyage_api_key_here
# Textbook Upload Directory
TEXTBOOK_UPLOAD_DIR=/path/to/uploadfile/textbooks

7
main/manager-api/.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
# Environment files
.env
.env.local
.env.*.local
# But keep the example
!.env.example

View file

@ -2,12 +2,36 @@ package xiaozhi;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;
import org.springframework.context.ConfigurableApplicationContext;
@SpringBootApplication @SpringBootApplication
public class AdminApplication { public class AdminApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(AdminApplication.class, args); // Log profile before Spring Boot starts
System.out.println("http://localhost:8002/xiaozhi/doc.html"); String activeProfile = System.getenv("SPRING_PROFILES_ACTIVE");
if (activeProfile != null && !activeProfile.isEmpty()) {
System.out.println("\n========================================");
System.out.println("Starting with profile: " + activeProfile.toUpperCase());
System.out.println("========================================\n");
}
ConfigurableApplicationContext context = SpringApplication.run(AdminApplication.class, args);
Environment env = context.getEnvironment();
String[] profiles = env.getActiveProfiles();
if (profiles.length > 0) {
System.out.println("\n========================================");
System.out.println("Active Profile: " + profiles[0].toUpperCase());
System.out.println("Configuration: application-" + profiles[0] + ".yml");
System.out.println("========================================");
} else {
System.out.println("\n========================================");
System.out.println("No active profile set - using default configuration");
System.out.println("========================================");
}
System.out.println("Server started: http://localhost:8002/xiaozhi/doc.html\n");
} }
} }

View file

@ -378,6 +378,17 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentDao, AgentEntity> imp
entity.setChatHistoryConf(template.getChatHistoryConf()); entity.setChatHistoryConf(template.getChatHistoryConf());
entity.setLangCode(template.getLangCode()); entity.setLangCode(template.getLangCode());
entity.setLanguage(template.getLanguage()); entity.setLanguage(template.getLanguage());
// Override with custom defaults for memory and voice
entity.setMemModelId("Memory_mem0ai"); // Always use memoAI for memory
entity.setTtsModelId("TTS_EdgeTTS"); // Always use EdgeTTS model
entity.setTtsVoiceId("TTS_EdgeTTS_Ana"); // Always use EdgeTTS Ana voice (en-US-AnaNeural)
// Log the overridden values for debugging
System.out.println("Creating agent with overridden defaults:");
System.out.println(" Memory: " + entity.getMemModelId());
System.out.println(" TTS Model: " + entity.getTtsModelId());
System.out.println(" TTS Voice: " + entity.getTtsVoiceId());
} }
// 设置用户ID和创建者信息 // 设置用户ID和创建者信息

View file

@ -7,6 +7,10 @@ knife4j:
password: 2ZABCDEUgF password: 2ZABCDEUgF
setting: setting:
enableFooter: false enableFooter: false
# Server configuration
server:
secret: d153e93c-bb2f-42e7-8045-a1ee47a1dcfc
spring: spring:
datasource: datasource:
druid: druid:
@ -18,9 +22,9 @@ spring:
# password: cTefiuLmZSMqGpcQImUmBIsUBhNyUvrK # password: cTefiuLmZSMqGpcQImUmBIsUBhNyUvrK
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# Railway MySQL Configuration - Updated for Railway database # Railway MySQL Configuration - Updated for Railway database
url: jdbc:mysql://nozomi.proxy.rlwy.net:25037/railway?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=true&allowPublicKeyRetrieval=true url: jdbc:mysql://crossover.proxy.rlwy.net:56145/railway?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=true&allowPublicKeyRetrieval=true
username: root username: root
password: OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm password: XjOWQwtGNcoMIELTjoMoaaBTfKiBjVcA
initial-size: 10 initial-size: 10
max-active: 100 max-active: 100
@ -46,9 +50,9 @@ spring:
data: data:
redis: redis:
# Railway Redis Configuration # Railway Redis Configuration
host: maglev.proxy.rlwy.net # Railway Redis服务器地址 host: yamanote.proxy.rlwy.net # Railway Redis服务器地址
port: 16780 # Railway Redis服务器连接端口 port: 34938 # Railway Redis服务器连接端口
password: beVfOKcZjMUCBiZIQnvSMivhpSeijpKP # Railway Redis服务器连接密码 password: YbdhwguVUNowduNpDZjuSefZFhBXiOEP # Railway Redis服务器连接密码
username: default # Railway Redis用户名 username: default # Railway Redis用户名
database: 0 # Redis数据库索引(默认为0) database: 0 # Redis数据库索引(默认为0)
timeout: 30000ms # 连接超时时间(毫秒)- 增加超时时间 timeout: 30000ms # 连接超时时间(毫秒)- 增加超时时间

View file

@ -0,0 +1,62 @@
knife4j:
production: false
enable: true
basic:
enable: false
username: renren
password: 2ZABCDEUgF
setting:
enableFooter: false
spring:
datasource:
druid:
#MySQL
# driver-class-name: com.mysql.cj.jdbc.Driver
# # Railway MySQL Configuration - Updated for Railway database
# url: jdbc:mysql://yamanote.proxy.rlwy.net:16958/railway?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=true&allowPublicKeyRetrieval=true
# username: root
# password: cTefiuLmZSMqGpcQImUmBIsUBhNyUvrK
driver-class-name: com.mysql.cj.jdbc.Driver
# Railway MySQL Configuration - Updated for Railway database
url: jdbc:mysql://nozomi.proxy.rlwy.net:25037/railway?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=true&allowPublicKeyRetrieval=true
username: root
password: OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm
initial-size: 10
max-active: 100
min-idle: 10
max-wait: 6000
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
test-while-idle: true
test-on-borrow: false
test-on-return: false
stat-view-servlet:
enabled: false
filter:
stat:
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: false
wall:
config:
multi-statement-allow: true
data:
redis:
# Railway Redis Configuration
host: maglev.proxy.rlwy.net # Railway Redis服务器地址
port: 16780 # Railway Redis服务器连接端口
password: beVfOKcZjMUCBiZIQnvSMivhpSeijpKP # Railway Redis服务器连接密码
username: default # Railway Redis用户名
database: 0 # Redis数据库索引(默认为0)
timeout: 30000ms # 连接超时时间(毫秒)- 增加超时时间
ssl:
enabled: false # 尝试禁用SSL,Railway可能不需要
lettuce:
pool:
max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
max-idle: 8 # 连接池中的最大空闲连接
min-idle: 0 # 连接池中的最小空闲连接
shutdown-timeout: 100ms # 客户端优雅关闭的等待时间

View file

@ -14,8 +14,10 @@ server:
spring: spring:
# 环境 dev|test|prod # 环境 dev|test|prod
# Profile will be set by SPRING_PROFILES_ACTIVE environment variable
# Default to 'dev' if not specified
profiles: profiles:
active: dev # Using dev profile with Railway database configuration default: prod
messages: messages:
encoding: UTF-8 encoding: UTF-8
basename: i18n/messages basename: i18n/messages

View file

@ -0,0 +1,3 @@
-- Add EdgeTTS Ana voice (en-US-AnaNeural) for default agent configuration
delete from `ai_tts_voice` where id = 'TTS_EdgeTTS_Ana';
INSERT INTO `ai_tts_voice` VALUES ('TTS_EdgeTTS_Ana', 'TTS_EdgeTTS', 'EdgeTTS Ana', 'en-US-AnaNeural', 'English', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL);

View file

@ -410,4 +410,11 @@ databaseChangeLog:
- sqlFile: - sqlFile:
encoding: utf8 encoding: utf8
path: classpath:db/changelog/202509030001_clear_tts_config_checksum.sql path: classpath:db/changelog/202509030001_clear_tts_config_checksum.sql
- changeSet:
id: 202509061300
author: claude
changes:
- sqlFile:
encoding: utf8
path: classpath:db/changelog/202509061300_add_ana_voice.sql