8
Some checks failed
Builder / Build addons (localai-p2p-master, amd64) (push) Failing after 8s
Builder / Build addons (localai-p2p-worker, amd64) (push) Failing after 8s
Validate / validate (push) Failing after 2s
Builder / Create release (push) Has been skipped

This commit is contained in:
2025-05-30 15:11:13 +02:00
parent 60a325bb74
commit 10a8425bb7
5 changed files with 59 additions and 27 deletions

View File

@@ -1,18 +1,17 @@
#!/bin/bash
# Configuration par défaut si bashio n'est pas disponible
if command -v bashio >/dev/null 2>&1; then
echo "Using Home Assistant configuration"
GPU_LAYERS="$(bashio::config 'gpu_layers')"
TOKEN="$(bashio::config 'master_token')"
MODELS_PATH="$(bashio::config 'models_path')"
else
echo "Using environment variables"
GPU_LAYERS="${GPU_LAYERS:-0}"
TOKEN="${LOCALAI_P2P_TOKEN:-}"
MODELS_PATH="${LOCALAI_MODELS_PATH:-/share/localai/models}"
# Forcer l'utilisation de la configuration Home Assistant
echo "Using Home Assistant configuration"
# Source bashio si disponible
if [ -f /usr/bin/bashio ]; then
source /usr/bin/bashio
fi
GPU_LAYERS="$(bashio::config 'gpu_layers' 2>/dev/null || echo '0')"
TOKEN="$(bashio::config 'master_token' 2>/dev/null || echo '')"
MODELS_PATH="$(bashio::config 'models_path' 2>/dev/null || echo '/share/localai/models')"
echo "DEBUG: GPU_LAYERS=$GPU_LAYERS"
echo "DEBUG: TOKEN from config: '$TOKEN'"
echo "DEBUG: MODELS_PATH=$MODELS_PATH"
@@ -39,6 +38,10 @@ find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio
rm -f "$file"
done 2>/dev/null || true
# Définir les variables d'environnement pour LocalAI
export THREADS="${THREADS:-8}"
export OMP_NUM_THREADS="${OMP_NUM_THREADS:-8}"
# Lancer LocalAI avec nos paramètres
echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, gpu-layers=$GPU_LAYERS"
exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"
echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, threads=$THREADS"
exec /build/local-ai run --models-path="$MODELS_PATH" --threads="$THREADS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"