69 lines
3.3 KiB
Bash
69 lines
3.3 KiB
Bash
#!/bin/bash
|
|
# API-Tests für Pipeline-System (Issue #28)
|
|
# Ausführen auf Server oder lokal: bash test-pipeline-api.sh
|
|
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo "Pipeline-System API Tests"
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo ""
|
|
|
|
# Configuration
|
|
API_URL="https://dev.mitai.jinkendo.de"
|
|
TOKEN="" # <-- Füge deinen Admin-Token hier ein
|
|
|
|
if [ -z "$TOKEN" ]; then
|
|
echo "❌ Bitte TOKEN in Zeile 11 eintragen (Admin-Token von dev.mitai.jinkendo.de)"
|
|
echo ""
|
|
echo "1. In Browser einloggen: https://dev.mitai.jinkendo.de"
|
|
echo "2. Developer Tools öffnen (F12)"
|
|
echo "3. Application/Storage → localStorage → auth_token kopieren"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Test 1: GET /api/prompts/pipeline-configs"
|
|
echo "─────────────────────────────────────────────────────────"
|
|
curl -s "$API_URL/api/prompts/pipeline-configs" \
|
|
-H "X-Auth-Token: $TOKEN" | jq -r '.[] | "\(.name) (default: \(.is_default), active: \(.active))"'
|
|
echo ""
|
|
|
|
echo "Test 2: GET /api/prompts/pipeline-configs - Full JSON"
|
|
echo "─────────────────────────────────────────────────────────"
|
|
curl -s "$API_URL/api/prompts/pipeline-configs" \
|
|
-H "X-Auth-Token: $TOKEN" | jq '.[0] | {name, is_default, modules, stage1_prompts, stage2_prompt}'
|
|
echo ""
|
|
|
|
echo "Test 3: POST /api/insights/pipeline (default config)"
|
|
echo "─────────────────────────────────────────────────────────"
|
|
echo "Hinweis: Dies startet eine echte KI-Analyse (kann 30-60s dauern)"
|
|
read -p "Fortfahren? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
RESULT=$(curl -s -X POST "$API_URL/api/insights/pipeline" \
|
|
-H "X-Auth-Token: $TOKEN" \
|
|
-H "Content-Type: application/json")
|
|
|
|
echo "$RESULT" | jq '{
|
|
scope,
|
|
config: .config,
|
|
stage1_results: (.stage1 | keys),
|
|
content_length: (.content | length)
|
|
}'
|
|
echo ""
|
|
echo "Full content (first 500 chars):"
|
|
echo "$RESULT" | jq -r '.content' | head -c 500
|
|
echo "..."
|
|
else
|
|
echo "Übersprungen."
|
|
fi
|
|
echo ""
|
|
|
|
echo "Test 4: GET /api/prompts - Prüfe auf is_system_default"
|
|
echo "─────────────────────────────────────────────────────────"
|
|
curl -s "$API_URL/api/prompts" \
|
|
-H "X-Auth-Token: $TOKEN" | jq -r '.[] | select(.slug | startswith("pipeline_")) | "\(.slug): is_system_default=\(.is_system_default // false)"' | head -6
|
|
echo ""
|
|
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo "API-Tests abgeschlossen!"
|
|
echo "═══════════════════════════════════════════════════════════"
|