8
This commit is contained in:
@@ -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="*"
|
||||
|
||||
Reference in New Issue
Block a user