Files
hass-addons/localai-p2p-worker/run.sh
alex cca21d9c3b
Some checks failed
Builder / Build addons (localai-p2p-master, amd64) (push) Failing after 9s
Builder / Build addons (localai-p2p-worker, amd64) (push) Failing after 7s
Validate / validate (push) Failing after 2s
Builder / Create release (push) Has been skipped
debug
2025-05-30 14:47:25 +02:00

26 lines
934 B
Bash

#!/usr/bin/with-contenv bashio
CONFIG_PATH=/data/options.json
GPU_LAYERS="$(bashio::config 'gpu_layers')"
TOKEN="$(bashio::config 'master_token' || echo '')"
MODELS_PATH="$(bashio::config 'models_path')"
echo "DEBUG: TOKEN from config: '$TOKEN'"
if [ -n "$TOKEN" ] && [ "$TOKEN" != "" ]; then
echo "DEBUG: Setting LOCALAI_P2P_TOKEN to: $TOKEN"
export LOCALAI_P2P_TOKEN="$TOKEN"
else
echo "DEBUG: No token provided in configuration"
fi
echo "DEBUG: LOCALAI_P2P_TOKEN is set to: '$LOCALAI_P2P_TOKEN'"
# Créer le répertoire des modèles s'il n'existe pas
mkdir -p "$MODELS_PATH"
# Nettoyer les fichiers de configuration corrompus (contenant du code shell)
find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio" {} \; | xargs rm -f 2>/dev/null || true
exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"