1.0.0初始化源代码

This commit is contained in:
yuqianqian10204095yu
2026-03-23 15:40:36 +08:00
parent f13ecb3bba
commit cebc0a288f
53 changed files with 5300 additions and 0 deletions

15
docker/mysql/init.sql Normal file
View File

@@ -0,0 +1,15 @@
-- 初始化数据库表结构(如果使用 SQLAlchemy 自动创建,此文件可选)
-- 创建扩展
CREATE DATABASE IF NOT EXISTS huihui_ai_bot
DEFAULT CHARACTER SET utf8mb4
DEFAULT COLLATE utf8mb4_unicode_ci;
USE huihui_ai_bot;
-- 插入初始系统配置数据
INSERT INTO system_configs (config_key, config_value, config_type, description, is_active) VALUES
('schedule_config', '{"task_start_hour": 9, "task_end_hour": 22, "task_interval_min": 10, "task_interval_max": 30}', 'schedule', '定时任务配置', 1),
('limit_config', '{"max_tokens_per_day": 10000, "max_comments_per_user_per_day": 20, "max_replies_per_user_per_day": 10}', 'limit', '限额配置', 1),
('probability_config', '{"like_probability": 0.8, "favorite_probability": 0.5, "share_probability": 0.3}', 'probability', '概率配置', 1)
ON DUPLICATE KEY UPDATE config_value = VALUES(config_value);

41
docker/nginx/nginx.conf Normal file
View File

@@ -0,0 +1,41 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
# API 代理到后端服务
location /api/ {
proxy_pass http://backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket 支持(如果需要)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 超时设置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# 静态资源缓存
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Gzip 压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript;
}