add RAG Worker deploy + reranker test to CI/CD
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 7s
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 7s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
c9882c8d04
commit
9c8bd59620
@ -84,6 +84,41 @@ jobs:
|
|||||||
$ENV_FILE \
|
$ENV_FILE \
|
||||||
zhixi-api:latest
|
zhixi-api:latest
|
||||||
|
|
||||||
|
- name: Deploy RAG Worker
|
||||||
|
run: |
|
||||||
|
WORKER_DIR="/opt/zhixi/backend/rag-worker"
|
||||||
|
mkdir -p "$WORKER_DIR"
|
||||||
|
|
||||||
|
# Sync worker code from checkout (exclude .env to avoid overwriting secrets)
|
||||||
|
rsync -av --delete --exclude='.env' --exclude='__pycache__' \
|
||||||
|
/tmp/api-server/rag-worker/ "$WORKER_DIR/"
|
||||||
|
|
||||||
|
# Install any new Python dependencies
|
||||||
|
/usr/bin/python3.11 -m pip install -r "$WORKER_DIR/requirements.txt" \
|
||||||
|
-i https://mirrors.tencentyun.com/pypi/simple 2>&1 | tail -3
|
||||||
|
|
||||||
|
# Reload systemd and restart worker
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart zhixi-worker
|
||||||
|
sleep 3
|
||||||
|
systemctl is-active zhixi-worker && echo "[deploy] zhixi-worker restarted OK"
|
||||||
|
|
||||||
|
# Test reranker
|
||||||
|
cd "$WORKER_DIR"
|
||||||
|
/usr/bin/python3.11 -c "
|
||||||
|
import asyncio
|
||||||
|
from reranker import rerank
|
||||||
|
async def t():
|
||||||
|
r = await rerank('什么是主动回忆', [
|
||||||
|
'主动回忆是一种高效的学习策略,通过主动从记忆中提取信息来强化神经连接',
|
||||||
|
'苹果是一种常见的水果,富含维生素C',
|
||||||
|
'间隔重复和主动回忆结合使用效果更佳',
|
||||||
|
], top_n=2)
|
||||||
|
for x in r:
|
||||||
|
print(f'[rerank-test] score={x[\"score\"]:.4f} text={x[\"text\"][:40]}')
|
||||||
|
asyncio.run(t())
|
||||||
|
" && echo "[deploy] Reranker test OK"
|
||||||
|
|
||||||
- name: Health check
|
- name: Health check
|
||||||
run: |
|
run: |
|
||||||
sleep 8
|
sleep 8
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user