Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 7s
Multi-line Python in ExecStartPre is invalid systemd syntax. Extract pip install + reranker self-test into startup.sh. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
22 lines
636 B
Bash
Executable File
22 lines
636 B
Bash
Executable File
#!/bin/bash
|
|
# zhixi-worker startup checks — called by systemd ExecStartPre
|
|
set -e
|
|
cd /opt/zhixi/backend/rag-worker
|
|
|
|
# Install any new dependencies
|
|
/usr/bin/python3.11 -m pip install -q -r requirements.txt \
|
|
-i https://mirrors.tencentyun.com/pypi/simple
|
|
|
|
# Self-test: reranker
|
|
/usr/bin/python3.11 -c "
|
|
import asyncio
|
|
from reranker import rerank
|
|
async def t():
|
|
r = await rerank('测试', ['这是测试文本', '无关内容'], top_n=1)
|
|
if not r:
|
|
raise RuntimeError('reranker returned empty')
|
|
print(f'[self-test] reranker OK, score={r[0][\"score\"]:.4f}')
|
|
asyncio.run(t())
|
|
print('[self-test] all checks passed')
|
|
"
|