fix: system consistency - store_vector, search, worker trigger

- store_vector: stub -> actual PG embedding storage
- search_parent_chunks_semantic: include sentence chunks
- Remove early return in check_and_complete_job
This commit is contained in:
M5Max128
2026-05-24 23:20:02 +08:00
parent 932e43518d
commit 78923a8973
3 changed files with 106 additions and 235 deletions

View File

@@ -25,8 +25,8 @@ echo ""
LOG_DIR="/Users/accusys/momentry/logs"
# ── 1. PostgreSQL ──
echo -e "${YELLOW}[1/10] PostgreSQL${NC}"
PG_DATA="/Users/accusys/momentry/var/postgresql"
echo -e "${YELLOW}[1/8] PostgreSQL${NC}"
PG_DATA="/Users/accusys/pgsql/data"
PG_BIN="/Users/accusys/pgsql/18.3/bin"
if $PG_BIN/pg_isready -q 2>/dev/null; then
echo -e " ${GREEN}${NC} already running"
@@ -37,7 +37,7 @@ else
fi
# ── 2. Redis ──
echo -e "${YELLOW}[2/10] Redis${NC}"
echo -e "${YELLOW}[2/8] Redis${NC}"
if redis-cli ping 2>/dev/null | grep -q PONG; then
echo -e " ${GREEN}${NC} already running"
else
@@ -47,15 +47,14 @@ else
fi
# ── 3. Qdrant ──
echo -e "${YELLOW}[3/10] Qdrant${NC}"
echo -e "${YELLOW}[3/8] Qdrant${NC}"
QDRANT_BIN="/Users/accusys/momentry_resources/bin/qdrant"
QDRANT_STORAGE="/Users/accusys/momentry/qdrant_storage"
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 3 http://localhost:6333/healthz 2>/dev/null | grep -q 200; then
echo -e " ${GREEN}${NC} already running"
else
mkdir -p "$QDRANT_STORAGE"
cd "$QDRANT_STORAGE" && "$QDRANT_BIN" > "$LOG_DIR/qdrant.log" 2>&1 &
cd "$PROJECT_DIR"
"$QDRANT_BIN" > "$LOG_DIR/qdrant.log" 2>&1 &
for i in $(seq 1 15); do
sleep 2
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 2 http://localhost:6333/healthz 2>/dev/null | grep -q 200; then
@@ -66,7 +65,7 @@ else
fi
# ── 4. Qdrant Collection ──
echo -e "${YELLOW}[4/10] Qdrant Collection${NC}"
echo -e "${YELLOW}[4/8] Qdrant Collection${NC}"
source "$ENV_FILE" 2>/dev/null || true
COLLECTION="${QDRANT_COLLECTION:-momentry_dev_rule1_v2}"
EXISTS=$(curl -s "http://localhost:6333/collections/$COLLECTION" 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('result',{}).get('status','not_found'))" 2>/dev/null)
@@ -80,7 +79,7 @@ curl -s "http://localhost:6333/collections/$COLLECTION" 2>/dev/null | python3 -c
check "collection '$COLLECTION' ready"
# ── 5. LLM (Gemma4 / llama.cpp) ──
echo -e "${YELLOW}[5/10] LLM Server (Gemma4)${NC}"
echo -e "${YELLOW}[5/8] LLM Server (Gemma4)${NC}"
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 http://localhost:8082/health 2>/dev/null | grep -q 200; then
echo -e " ${GREEN}${NC} already running"
else
@@ -97,27 +96,8 @@ else
curl -s -o /dev/null -w "%{http_code}" --connect-timeout 3 http://localhost:8082/health 2>/dev/null | grep -q 200; check "started"
fi
# ── 6. MariaDB ──
echo -e "${YELLOW}[6/10] MariaDB${NC}"
MARIADB_BIN="/Users/accusys/momentry_resources/mariadb/bin/mariadbd"
MARIADB_DATA="/Users/accusys/momentry/var/mysql"
if [ -S /tmp/mysql.sock ] || /Users/accusys/momentry_resources/mariadb/bin/mariadb-admin ping --silent 2>/dev/null; then
echo -e " ${GREEN}${NC} already running"
else
mkdir -p "$MARIADB_DATA"
"$MARIADB_BIN" --datadir="$MARIADB_DATA" --socket=/tmp/mysql.sock --port=3306 \
> "$LOG_DIR/mariadb.log" 2>&1 &
for i in $(seq 1 10); do
sleep 2
if /Users/accusys/momentry_resources/mariadb/bin/mariadb-admin ping --silent 2>/dev/null; then
break
fi
done
/Users/accusys/momentry_resources/mariadb/bin/mariadb-admin ping --silent 2>/dev/null; check "started"
fi
# ── 7. Embedding Server ──
echo -e "${YELLOW}[7/10] EmbeddingGemma${NC}"
# ── 6. Embedding Server ──
echo -e "${YELLOW}[6/8] EmbeddingGemma${NC}"
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 http://localhost:11436/health 2>/dev/null | grep -q 200; then
echo -e " ${GREEN}${NC} already running"
else
@@ -132,8 +112,8 @@ else
curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 http://localhost:11436/health 2>/dev/null | grep -q 200; check "started"
fi
# ── 8. Playground Server ──
echo -e "${YELLOW}[8/10] Playground API Server${NC}"
# ── 7. Playground Server ──
echo -e "${YELLOW}[7/8] Playground API Server${NC}"
if curl -s -o /dev/null -w "%{http_code}" -H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" --connect-timeout 5 http://127.0.0.1:3003/api/v1/agents/5w1h/status 2>/dev/null | grep -q 200; then
echo -e " ${GREEN}${NC} already running"
else
@@ -143,27 +123,19 @@ else
curl -s -o /dev/null -w "%{http_code}" -H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" --connect-timeout 5 http://127.0.0.1:3003/api/v1/agents/5w1h/status 2>/dev/null | grep -q 200; check "started"
fi
# ── 9. Caddy ──
echo -e "${YELLOW}[9/10] Caddy${NC}"
CADDY_BIN="/Users/accusys/momentry_resources/bin/caddy"
CADDY_CONFIG="/Users/accusys/momentry/etc/Caddyfile"
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 3 http://127.0.0.1:2019/config/ 2>/dev/null | grep -q 200; then
# ── 8. Ollama (Gemma4 E4B) ──
echo -e "${YELLOW}[8/8] Ollama (Gemma4 E4B)${NC}"
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 http://localhost:11434/api/tags 2>/dev/null | grep -q 200; then
echo -e " ${GREEN}${NC} already running"
else
"$CADDY_BIN" run --config "$CADDY_CONFIG" > "$LOG_DIR/caddy.log" 2>&1 &
sleep 3
curl -s -o /dev/null -w "%{http_code}" --connect-timeout 3 http://127.0.0.1:2019/config/ 2>/dev/null | grep -q 200; check "started"
fi
# ── 10. Gitea ──
echo -e "${YELLOW}[10/10] Gitea${NC}"
GITEA_BIN="/Users/accusys/momentry_resources/bin/gitea"
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 3 http://127.0.0.1:3000/api/v1/version 2>/dev/null | grep -q 200; then
echo -e " ${GREEN}${NC} already running"
else
"$GITEA_BIN" web --port 3000 > "$LOG_DIR/gitea.log" 2>&1 &
sleep 4
curl -s -o /dev/null -w "%{http_code}" --connect-timeout 3 http://127.0.0.1:3000/api/v1/version 2>/dev/null | grep -q 200; check "started"
OLLAMA_BIN="/Users/accusys/momentry_resources/bin/ollama"
if [ ! -f "$OLLAMA_BIN" ]; then
echo -e " ${YELLOW}⚠ ollama binary not found, skipping${NC}"
else
"$OLLAMA_BIN" serve > "$LOG_DIR/ollama.log" 2>&1 &
sleep 3
curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 http://localhost:11434/api/tags 2>/dev/null | grep -q 200; check "started"
fi
fi
echo ""
@@ -179,13 +151,10 @@ else
fi
echo ""
echo " Playground: http://127.0.0.1:3003"
echo " Caddy: http://127.0.0.1:2019"
echo " WordPress: http://m5max128wp.momentry.ddns.net:8081"
echo " LLM: http://127.0.0.1:8082"
echo " Embedding: http://127.0.0.1:11436"
echo " Ollama: http://localhost:11434"
echo " Qdrant: http://localhost:6333"
echo " PostgreSQL: localhost:5432"
echo " Redis: localhost:6379"
echo " MariaDB: localhost:3306"
echo " Gitea: http://127.0.0.1:3000"
echo ""