71 lines
2.4 KiB
Bash
Executable File
71 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
cdir=$(cd "$(dirname "$0")"; pwd)
|
|
|
|
export SAGE_RBAC_DB=rag
|
|
|
|
if [ ! -d py3 ]; then
|
|
python3 -m venv py3
|
|
fi
|
|
source py3/bin/activate
|
|
|
|
pip install -q xls2ddl
|
|
|
|
mkdir -p pkgs logs files
|
|
|
|
# Foundation modules
|
|
for repo in apppublic sqlor ahserver rbac appbase bricks-for-python; do
|
|
[ -d pkgs/$repo ] || git clone git@git.opencomputing.cn:yumoqing/$repo.git pkgs/$repo
|
|
pip install -q -e pkgs/$repo
|
|
done
|
|
|
|
# Clone and install rag business module
|
|
[ -d pkgs/rag ] || git clone git@git.opencomputing.cn:yumoqing/rag.git pkgs/rag
|
|
pip install -q -e pkgs/rag
|
|
|
|
# rag-pipeline (core engine - PYTHONPATH only)
|
|
[ -d pkgs/rag-pipeline ] || git clone git@git.opencomputing.cn:yumoqing/rag-pipeline.git pkgs/rag-pipeline
|
|
|
|
# Service modules (reference only)
|
|
for svc in clip_embedding vdb face-service graph-service ner-service; do
|
|
[ -d pkgs/$svc ] || git clone git@git.opencomputing.cn:yumoqing/$svc.git pkgs/$svc 2>/dev/null || echo "Skip $svc"
|
|
done
|
|
[ -d pkgs/bge-reranker ] || git clone git@git.opencomputing.cn:yumoqing/bge-reranker.git pkgs/bge-reranker 2>/dev/null || echo "Skip bge-reranker"
|
|
[ -d pkgs/speaker-id ] || git clone git@git.opencomputing.cn:yumoqing/speaker-id.git pkgs/speaker-id 2>/dev/null || echo "Skip speaker-id"
|
|
|
|
# Build bricks frontend
|
|
if [ ! -d pkgs/bricks ]; then
|
|
git clone git@git.opencomputing.cn:yumoqing/bricks.git pkgs/bricks
|
|
fi
|
|
mkdir -p pkgs/bricks/dist/i18n
|
|
cd pkgs/bricks
|
|
bash build.sh
|
|
cd $cdir
|
|
|
|
# Symlink bricks + module wwwroots (one link per module)
|
|
ln -sf ../pkgs/bricks/dist wwwroot/bricks 2>/dev/null || true
|
|
ln -sf ../pkgs/rbac/wwwroot wwwroot/rbac 2>/dev/null || true
|
|
ln -sf ../pkgs/rag/wwwroot wwwroot/rag 2>/dev/null || true
|
|
|
|
# Generate DDL from rag module models
|
|
if ls pkgs/rag/models/*.json >/dev/null 2>&1; then
|
|
cd pkgs/rag/models
|
|
json2ddl mysql . > /tmp/rag_ddl.sql
|
|
mysql -h db -utest -ptest123 rag < /tmp/rag_ddl.sql 2>/dev/null || echo "DDL apply skipped"
|
|
cd $cdir
|
|
fi
|
|
|
|
# Sync password_key from Sage
|
|
if [ -f /d/apitest/sage/conf/config.json ]; then
|
|
sage_key=$(python3 -c "import json; print(json.load(open('/d/apitest/sage/conf/config.json'))['password_key'])")
|
|
python3 -c "
|
|
import json
|
|
c = json.load(open('$cdir/conf/config.json'))
|
|
c['password_key'] = '$sage_key'
|
|
json.dump(c, open('$cdir/conf/config.json', 'w'), indent=4, ensure_ascii=False)
|
|
" 2>/dev/null
|
|
echo "password_key synced"
|
|
fi
|
|
|
|
echo "=== RAG Server build complete ==="
|