Update 2026-05-18 14:31:53

This commit is contained in:
yi
2026-05-18 14:31:54 +08:00
parent df33ce2f18
commit b77e2d8a7a
54 changed files with 1003 additions and 2699 deletions
+6 -6
View File
@@ -19,13 +19,13 @@ TZ=Asia/Shanghai
# ==========================================
# PostgreSQL 连接信息
POSTGRES_DB=mumuai_novel
POSTGRES_USER=mumuai
POSTGRES_DB=mumulingsi_novel
POSTGRES_USER=mumulingsi
POSTGRES_PASSWORD=123456
POSTGRES_PORT=5432
# 数据库连接 URL(Docker 部署时自动生成)
# DATABASE_URL=postgresql+asyncpg://mumuai:123456@localhost:5432/mumuai_novel
# DATABASE_URL=postgresql+asyncpg://mumulingsi:123456@localhost:5432/mumulingsi_novel
# ==========================================
# SQLite 数据库配置
@@ -45,7 +45,7 @@ LOG_BACKUP_COUNT=30
# ==========================================
# CORS 配置
# ==========================================
CORS_ORIGINS=["http://localhost:8000","http://127.0.0.1:8000"]
CORS_ORIGINS=["http://localhost:3000","http://127.0.0.1:8000"]
# ==========================================
# 代理配置(可选)
@@ -116,11 +116,11 @@ EMAIL_VERIFICATION_RESEND_INTERVAL_SECONDS=60
# 提示词工坊配置
# ==========================================
# 运行模式:client(本地部署)或 server(云端服务器)
# 只有 mumuverse.space:1566 需要设置为 server
# 云端服务配置示例
WORKSHOP_MODE=client
# 云端服务地址(client 模式使用)
WORKSHOP_CLOUD_URL=https://mumuverse.space:1566
WORKSHOP_CLOUD_URL=
# 云端 API 请求超时时间(秒)
WORKSHOP_API_TIMEOUT=30
+2 -2
View File
@@ -1,5 +1,5 @@
# Alembic Database Migration Profile - PostgreSQL
# Database version management for the 墨木灵思 project
# Database version management for the mumulingsi project
[alembic]
# Migration Script storage directory (PostgreSQL)
@@ -10,7 +10,7 @@ file_template = %%(year)d%%(month).2d%%(day).2d_%%(hour).2d%%(minute).2d_%%(rev)
# Database connection string
# Note: The actual connection string is read from the environment variable in env.py
# sqlalchemy.url = postgresql+asyncpg://mumuai:password@localhost:5432/mumuai_novel
# sqlalchemy.url = postgresql+asyncpg://mumulingsi:password@localhost:5432/mumulingsi_novel
# Log Configuration
[loggers]
+1 -1
View File
@@ -1,5 +1,5 @@
# Alembic Database Migration Profile - SQLite
# Database version management for the 墨木灵思 project
# Database version management for the mumulingsi project
[alembic]
# Migration Script storage directory (SQLite)
+2 -2
View File
@@ -59,7 +59,7 @@ alembic -c alembic-postgres.ini current
#### 配置环境变量
```bash
# .env 文件
DATABASE_URL=sqlite+aiosqlite:///./data/mumuai.db
DATABASE_URL=sqlite+aiosqlite:///./data/mumulingsi.db
```
#### 生成迁移脚本
@@ -115,7 +115,7 @@ alembic -c alembic-sqlite.ini current
```bash
# 切换到 SQLite
DATABASE_URL=sqlite+aiosqlite:///./data/mumuai.db
DATABASE_URL=sqlite+aiosqlite:///./data/mumulingsi.db
alembic -c alembic-sqlite.ini upgrade head
# 切换到 PostgreSQL
+3 -3
View File
@@ -21,8 +21,8 @@ def require_login(request: Request):
# GitHub API配置
GITHUB_API_BASE = "https://api.github.com"
REPO_OWNER = "xiamuceer-j"
REPO_NAME = "墨木灵思"
REPO_OWNER = "mumulingsi-project"
REPO_NAME = "mumulingsi"
# 缓存配置
_cache = {
@@ -88,7 +88,7 @@ async def fetch_github_commits(page: int = 1, per_page: int = 30) -> List[dict]:
headers = {
"Accept": "application/vnd.github.v3+json",
"User-Agent": "墨木灵思-App"
"User-Agent": "mumulingsi-App"
}
try:
+3 -3
View File
@@ -16,7 +16,7 @@ config_logger = logging.getLogger(__name__)
# 数据库配置:PostgreSQL
# 从环境变量获取数据库URL
DATABASE_URL = os.getenv("DATABASE_URL", "postgresql+asyncpg://mumuai:password@localhost:5432/mumuai_novel")
DATABASE_URL = os.getenv("DATABASE_URL", "postgresql+asyncpg://mumulingsi:password@localhost:5432/mumulingsi_novel")
config_logger.debug(f"数据库类型: PostgreSQL")
config_logger.debug(f"数据库URL: {DATABASE_URL}")
@@ -39,7 +39,7 @@ class Settings(BaseSettings):
log_backup_count: int = 30 # 保留30个备份文件
# CORS配置
cors_origins: list[str] = ["http://localhost:8000", "http://127.0.0.1:8000"]
cors_origins: list[str] = ["http://localhost:3000", "http://127.0.0.1:8000"]
# 数据库配置 - PostgreSQL
database_url: str = DATABASE_URL
@@ -126,7 +126,7 @@ class Settings(BaseSettings):
# 提示词工坊配置
WORKSHOP_MODE: str = "client" # client: 本地部署实例, server: 云端中央服务器
WORKSHOP_CLOUD_URL: str = "https://mumuverse.space:1566" # 云端服务地址
WORKSHOP_CLOUD_URL: str = "" # 云端服务地址
WORKSHOP_API_TIMEOUT: int = 30 # 云端API请求超时时间(秒)
class Config:
+6
View File
@@ -141,6 +141,12 @@ async def db_session_stats(request: Request):
}
@app.get("/nanobot/sessions")
async def nanobot_sessions():
"""兼容层:为环境监控工具提供空的会话列表"""
return []
from app.api import (
projects, outlines, characters, chapters,
wizard_stream, relationships, organizations,
+1 -1
View File
@@ -24,7 +24,7 @@ def _session_secret() -> bytes:
or settings.openai_api_key
)
if not secret:
secret = "mumuainovel-development-session-secret"
secret = "mumulingsi-development-session-secret"
return str(secret).encode("utf-8")
+1 -1
View File
@@ -29,7 +29,7 @@ logger = get_logger(__name__)
def normalize_provider(provider: Optional[str]) -> Optional[str]:
"""标准化 provider 名称,兼容渠道别名。"""
if provider == "mumu":
if provider == "xinmi":
return "openai"
return provider
@@ -225,11 +225,11 @@ class CoverGenerationService:
return GeminiCoverProvider(api_key=api_key, base_url=normalized_base_url)
if provider_value == "grok":
return GrokCoverProvider(api_key=api_key, base_url=normalized_base_url)
if provider_value == "mumu":
if provider_value == "xinmi":
if normalized_base_url.endswith("/v1beta"):
return GeminiCoverProvider(api_key=api_key, base_url=normalized_base_url)
return GrokCoverProvider(api_key=api_key, base_url=normalized_base_url or "https://api.mumuverse.space/v1")
raise HTTPException(status_code=400, detail="当前版本仅支持 Gemini、Grok 或 MuMuのAPI 作为封面图片 Provider")
return GrokCoverProvider(api_key=api_key, base_url=normalized_base_url or "v1")
raise HTTPException(status_code=400, detail="当前版本仅支持 Gemini、Grok 或 墨木灵思 API 作为封面图片 Provider")
def _save_cover_file(
self,
+3 -3
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Docker 容器启动入口脚本
# 功能:等待数据库就绪,执行迁移,启动应用
@@ -31,8 +31,8 @@ echo "================================================"
# 数据库配置(从环境变量读取)
DB_HOST="${DB_HOST:-postgres}"
DB_PORT="${DB_PORT:-5432}"
DB_USER="${POSTGRES_USER:-mumuai}"
DB_NAME="${POSTGRES_DB:-mumuai_novel}"
DB_USER="${POSTGRES_USER:-mumulingsi}"
DB_NAME="${POSTGRES_DB:-mumulingsi_novel}"
# 等待数据库就绪
echo "⏳ 等待数据库启动..."
+1 -1
View File
@@ -8,7 +8,7 @@ CREATE EXTENSION IF NOT EXISTS "pg_trgm"; -- 模糊搜索和全文检索支
DO $$
BEGIN
RAISE NOTICE '==================================================';
RAISE NOTICE '墨木灵思 PostgreSQL 扩展安装完成';
RAISE NOTICE 'mumulingsi PostgreSQL 扩展安装完成';
RAISE NOTICE '已安装扩展:';
RAISE NOTICE ' - uuid-ossp: UUID生成支持';
RAISE NOTICE ' - pg_trgm: 模糊搜索和全文检索支持';
+5 -5
View File
@@ -56,8 +56,8 @@ class PostgreSQLSetup:
port: int = 5432,
admin_user: str = "postgres",
admin_password: str = None,
db_name: str = "mumuai_novel",
db_user: str = "mumuai",
db_name: str = "xinmi_novel",
db_user: str = "mumulingsi",
db_password: str = "123456"
):
"""
@@ -374,9 +374,9 @@ async def main():
admin_password = getpass(f"管理员密码: ")
print("\n请输入要创建的数据库信息:\n")
db_name = input("数据库名 [mumuai_novel]: ").strip() or "mumuai_novel"
db_user = input("数据库用户名 [mumuai]: ").strip() or "mumuai"
db_password = getpass("数据库用户密码 [mumuai123]: ") or "mumuai123"
db_name = input("数据库名 [xinmi_novel]: ").strip() or "xinmi_novel"
db_user = input("数据库用户名 [mumulingsi]: ").strip() or "mumulingsi"
db_password = getpass("数据库用户密码 [xinmi123]: ") or "xinmi123"
print(f"\n{'='*60}")
print(f"配置摘要:")