Weitere Tools eingebaut. Damit ist die SQL AI einsatzbereit.

This commit is contained in:
2026-01-28 22:27:34 +01:00
parent fa0a7c3b1e
commit 9b2573ebb8
5 changed files with 414 additions and 102 deletions

View File

@@ -2,11 +2,7 @@
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# Create .env if missing (do not overwrite)
cp -n "${ROOT}/.env.example" "${ROOT}/.env" || true
# shellcheck disable=SC1090
source "${ROOT}/.env"
ts(){ date -Is; }
@@ -14,8 +10,6 @@ ts(){ date -Is; }
log_dir="${ROOT}/logs"
mkdir -p "$log_dir"
log_file="${log_dir}/bootstrap-$(date -Iseconds).log"
# log everything (stdout+stderr)
exec > >(tee -a "$log_file") 2>&1
echo "[$(ts)] bootstrap: starting (ROOT=$ROOT)"
@@ -51,7 +45,6 @@ echo "[$(ts)] bootstrap: building expert model: ${EXPERT_MODEL}"
tmp="$(mktemp)"
sed "s/\${BASE_MODEL}/${BASE_MODEL}/g" "${ROOT}/Modelfile" > "$tmp"
# Copy Modelfile into container and build from explicit path (robust)
docker cp "$tmp" ollama:/tmp/Modelfile.jr-sql-expert
docker exec -it ollama ollama create "${EXPERT_MODEL}" -f /tmp/Modelfile.jr-sql-expert
@@ -61,15 +54,15 @@ echo "[$(ts)] bootstrap: verifying model exists..."
docker exec -it ollama ollama list | grep -F "${EXPERT_MODEL}" >/dev/null && \
echo "[$(ts)] bootstrap: OK: ${EXPERT_MODEL} is available."
# End-to-end test
if [[ ! -x "${ROOT}/bin/sqlai" ]]; then
echo "[$(ts)] bootstrap: ERROR: ${ROOT}/bin/sqlai not found or not executable"
ls -la "${ROOT}/bin" || true
exit 2
# Warmup
if [[ -x "${ROOT}/bin/sqlai" ]]; then
echo "[$(ts)] bootstrap: warmup: sending a short request (no-metrics)..."
"${ROOT}/bin/sqlai" ask --text "Warmup: reply with exactly 'OK'." --no-metrics || {
echo "[$(ts)] bootstrap: WARN: warmup failed (continuing)."
}
echo "[$(ts)] bootstrap: warmup: done"
else
echo "[$(ts)] bootstrap: WARN: ${ROOT}/bin/sqlai not executable; skipping warmup."
fi
echo "[$(ts)] bootstrap: test (running one request)..."
echo "SELECT 1;" | "${ROOT}/bin/sqlai" analyze-tsql
echo "[$(ts)] bootstrap: test done"
echo "[$(ts)] bootstrap: done"