Files
image-gen-custom-skill/skill/image-gen-custom/scripts/configure.sh
T
2026-09-05 21:08:13 +08:00

29 lines
919 B
Bash

#!/usr/bin/env bash
set -euo pipefail
script_dir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
python_cmd="${CODEX_IMAGEGEN_PYTHON:-}"
if [[ -z "$python_cmd" ]]; then
embedded_python="$HOME/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe"
if [[ -x "$embedded_python" ]]; then
python_cmd="$embedded_python"
else
python_cmd="$(command -v python3 || command -v python || true)"
fi
fi
if [[ -z "$python_cmd" ]]; then
printf '%s\n' "Python 3 not found; install Python or set CODEX_IMAGEGEN_PYTHON." >&2
exit 1
fi
runtime="$($python_cmd "$script_dir/runtime.py" --keyring)"
read -r -p "OpenAI-compatible API base URL: " base_url
if [[ -z "${base_url// }" ]]; then
printf '%s\n' "API base URL cannot be empty." >&2
exit 1
fi
"$runtime" "$script_dir/configure_key.py" --base-url "$base_url"
printf '%s\n' "Now enter the API key."
"$runtime" "$script_dir/configure_key.py"