Files
hass-addons/localai-p2p-master/run.sh
alex feb7c8214e
Some checks failed
Builder / Build addons (localai-p2p-master, amd64) (push) Failing after 9s
Builder / Build addons (localai-p2p-worker, amd64) (push) Failing after 9s
Validate / validate (push) Failing after 2s
Builder / Create release (push) Has been skipped
4
2025-05-30 15:23:24 +02:00

28 lines
1.0 KiB
Bash

#!/usr/bin/with-contenv bashio
# Les variables d'environnement sont automatiquement disponibles depuis les options
echo "Starting LocalAI P2P Master"
echo "GPU Layers: $(bashio::config 'gpu_layers')"
echo "Models Path: $(bashio::config 'models_path')"
# Créer le répertoire des modèles
MODELS_PATH="$(bashio::config 'models_path')"
mkdir -p "$MODELS_PATH"
# Nettoyer les fichiers corrompus
find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio\|mapping values are not allowed in this context" {} \; 2>/dev/null | xargs rm -f 2>/dev/null || true
# Configurer les threads
export THREADS="$(bashio::config 'threads' || echo '8')"
export OMP_NUM_THREADS="$THREADS"
# Lancer LocalAI (master génère automatiquement un token)
echo "Starting LocalAI Master with models path: $MODELS_PATH"
echo "P2P Token will be generated automatically"
exec /usr/local/bin/local-ai run \
--models-path="$MODELS_PATH" \
--threads="$THREADS" \
--address="0.0.0.0:8080" \
--cors \
--cors-allow-origins="*"