Ship native iOS app, Wiki/TTS backend, and skeleton loading UX.

Replace the WebView shell with SwiftUI screens, add account-scoped Wiki and TTS APIs with adaptive review and photo scan support, and keep web/iOS pages usable while data loads asynchronously.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-08 15:13:59 +08:00
parent db5465c646
commit 05e173b293
115 changed files with 12709 additions and 1212 deletions
+34
View File
@@ -10,7 +10,17 @@ MYSQL_PORT="${MYSQL_PORT:-3306}"
MYSQL_USER="${MYSQL_USER:?MYSQL_USER required}"
MYSQL_PASSWORD="${MYSQL_PASSWORD:?MYSQL_PASSWORD required}"
MYSQL_DATABASE="${MYSQL_DATABASE:-wordloop}"
if [ -z "${WORDLOOP_SECRET_KEY:-}" ] && [ -f "$ROOT/backend/.env" ]; then
WORDLOOP_SECRET_KEY="$(grep -E '^WORDLOOP_SECRET_KEY=' "$ROOT/backend/.env" | cut -d= -f2- || true)"
fi
WORDLOOP_SECRET_KEY="${WORDLOOP_SECRET_KEY:-$(openssl rand -hex 32)}"
DEEPSEEK_API_KEY="${DEEPSEEK_API_KEY:-}"
DEEPSEEK_BASE_URL="${DEEPSEEK_BASE_URL:-https://api.deepseek.com}"
DEEPSEEK_MODEL="${DEEPSEEK_MODEL:-deepseek-chat}"
AI_WIKI_DAILY_LLM_LIMIT="${AI_WIKI_DAILY_LLM_LIMIT:-20}"
TKMIND_TTS_BASE_URL="${TKMIND_TTS_BASE_URL:-http://127.0.0.1:19200}"
TKMIND_TTS_ENABLED="${TKMIND_TTS_ENABLED:-true}"
TKMIND_TTS_SPK_ID="${TKMIND_TTS_SPK_ID:-aitong}"
echo ">>> 写入 backend/.env"
cat > "$ROOT/backend/.env" <<EOF
@@ -20,6 +30,13 @@ MYSQL_USER=${MYSQL_USER}
MYSQL_PASSWORD=${MYSQL_PASSWORD}
MYSQL_DATABASE=${MYSQL_DATABASE}
WORDLOOP_SECRET_KEY=${WORDLOOP_SECRET_KEY}
DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}
DEEPSEEK_BASE_URL=${DEEPSEEK_BASE_URL}
DEEPSEEK_MODEL=${DEEPSEEK_MODEL}
AI_WIKI_DAILY_LLM_LIMIT=${AI_WIKI_DAILY_LLM_LIMIT}
TKMIND_TTS_BASE_URL=${TKMIND_TTS_BASE_URL}
TKMIND_TTS_ENABLED=${TKMIND_TTS_ENABLED}
TKMIND_TTS_SPK_ID=${TKMIND_TTS_SPK_ID}
EOF
chmod 600 "$ROOT/backend/.env"
@@ -31,6 +48,23 @@ fi
source venv/bin/activate
pip install -q -r requirements.txt
echo ">>> OCR 依赖(iOS 拍照录入走服务端识别)"
if command -v tesseract >/dev/null 2>&1; then
echo "tesseract 已安装: $(tesseract --version 2>&1 | head -1)"
else
if command -v apt-get >/dev/null 2>&1; then
apt-get update -qq
apt-get install -y -qq tesseract-ocr tesseract-ocr-chi-sim tesseract-ocr-eng
elif command -v yum >/dev/null 2>&1; then
yum install -y tesseract tesseract-langpack-chi-sim 2>/dev/null || true
elif command -v dnf >/dev/null 2>&1; then
dnf install -y tesseract tesseract-langpack-chi-sim 2>/dev/null || true
fi
fi
if ! command -v tesseract >/dev/null 2>&1; then
echo "警告: 未安装 tesseractiOS 拍照录入将无法识别照片" >&2
fi
echo ">>> 创建数据库(若不存在)并建表"
python - <<'PY'
import pymysql