forked from niuniu/llm-intelligence
feat(phase1): OpenRouter采集器接入PostgreSQL,数据链路闭环
- 将 fetch_openrouter.go 的 summarize() 实现为 PostgreSQL upsert - 新增 -db 参数和 DATABASE_URL 环境变量支持 - 打通 models + model_prices 表的最小可运行链路 - 创建 llm_intelligence 数据库并运行 migration - 前端 Explorer 验证 T-3.2~T-3.5 全部通过 - 日报生成器正常产出 Markdown 和 latest_models.json
This commit is contained in:
40
scripts/verify_t34.sh
Executable file
40
scripts/verify_t34.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# verify_t34.sh — 验收 T-3.4:Explorer 接入真实 Schema JSON
|
||||
set -e
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
FILE="$PROJECT_ROOT/frontend/src/pages/Explorer.tsx"
|
||||
JSON="$PROJECT_ROOT/frontend/src/data/models.json"
|
||||
|
||||
echo "=== T-3.4 验收检查 ==="
|
||||
|
||||
# T-3.4.1: JSON schema 验证
|
||||
python3 -c "
|
||||
import json
|
||||
d=json.load(open('$JSON'))
|
||||
assert all(k in d for k in ['generated_at','total','free','paid','models']), 'missing top keys'
|
||||
assert all('pricing' in m and 'input' in m['pricing'] and 'output' in m['pricing'] for m in d['models']), 'missing pricing fields'
|
||||
print('json-schema OK')
|
||||
" && echo "json-schema PASS — JSON 含 generated_at/total/free/paid/models,且 models 含 pricing.input/output" \
|
||||
|| { echo "json-schema FAIL"; exit 1; }
|
||||
|
||||
# T-3.4.2: mapAPIResponseToModels 映射函数存在
|
||||
if grep -q 'mapAPIResponseToModels' "$FILE"; then
|
||||
echo "mapping PASS — mapAPIResponseToModels 函数存在"
|
||||
else
|
||||
echo "mapping FAIL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# T-3.4.3: getMockModels 改为从 JSON 加载
|
||||
if grep -q "models.json" "$FILE" && \
|
||||
! grep -q "provider.*OpenAI\|provider.*Anthropic\|provider.*DeepSeek" "$FILE"; then
|
||||
echo "import PASS — getMockModels 引用 models.json,无硬编码 provider"
|
||||
else
|
||||
echo "import FAIL — 仍有硬编码 mock 数据"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "all PASS"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user