ai_member_xiaoban/scripts/export_user_data.sh
xiaoban 338e2f659b feat: 导出行课数据封装为 skill + CLI 参数支持
- scripts/export_user_data.sh: 便捷 wrapper,内置数据库凭证
- skills/export-user-data/SKILL.md: 技能定义
- git_repos/llm_offline_production/export_user_id_data.py: main() 加 argparse,支持 --user-id/--user-ids/--account-ids/--output-dir,保持向后兼容
2026-05-29 17:07:54 +08:00

56 lines
1.9 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 导出行课数据 wrapper 脚本
# 用法: ./scripts/export_user_data.sh --user-id 33123
# ./scripts/export_user_data.sh --user-ids 33123,33124
# ./scripts/export_user_data.sh --account-ids 2148
# ./scripts/export_user_data.sh --user-id 33123 --output-dir ./my_output/
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORKSPACE="$(dirname "$SCRIPT_DIR")"
# 数据库凭证(从 secrets.md
export MYSQL_HOST="${MYSQL_HOST:-bj-cdb-8frbdwju.sql.tencentcdb.com}"
export MYSQL_USERNAME="${MYSQL_USERNAME:-read_only}"
export MYSQL_PASSWORD='fdsfiidier^$*hjfdijjd232'
export MYSQL_PORT="${MYSQL_PORT:-25413}"
export MYSQL_HOST_online="${MYSQL_HOST_online:-bj-cdb-dh2fkqa0.sql.tencentcdb.com}"
export MYSQL_USERNAME_online="${MYSQL_USERNAME_online:-read_only}"
export MYSQL_PASSWORD_online='fsdo45ijfmfmuu77$%^&'
export MYSQL_PORT_online="${MYSQL_PORT_online:-27751}"
export PG_DB_HOST="${PG_DB_HOST:-bj-postgres-16pob4sg.sql.tencentcdb.com}"
export PG_DB_PORT="${PG_DB_PORT:-28591}"
export PG_DB_USER="${PG_DB_USER:-ai_member}"
export PG_DB_PASSWORD='LdfjdjL83h3h3^$&**YGG*'
export PG_DB_DATABASE="${PG_DB_DATABASE:-vala}"
export ES_HOST="${ES_HOST:-es-7vd7jcu9.public.tencentelasticsearch.com}"
export ES_PORT="${ES_PORT:-9200}"
export ES_SCHEME="${ES_SCHEME:-https}"
export ES_USER="${ES_USER:-elastic}"
export ES_PASSWORD='F%?QDcWes7N2WTuiYD11'
# 默认输出目录
DEFAULT_OUTPUT="${WORKSPACE}/output"
mkdir -p "$DEFAULT_OUTPUT"
# 如果未指定 --output-dir自动加默认值
HAS_OUTPUT=false
for arg in "$@"; do
if [[ "$arg" == "--output-dir" ]]; then
HAS_OUTPUT=true
break
fi
done
PYTHON_SCRIPT="${WORKSPACE}/git_repos/llm_offline_production/config_user_data_extract_and_analyze/export_user_id_data.py"
if [ "$HAS_OUTPUT" = false ]; then
exec python3 "$PYTHON_SCRIPT" --output-dir "$DEFAULT_OUTPUT" "$@"
else
exec python3 "$PYTHON_SCRIPT" "$@"
fi