File size: 754 Bytes
3e7bb00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
set -e

export ORCHESTRATOR_MODEL="${ORCHESTRATOR_MODEL:-$OPENAI_MODEL}"
export WEBSURFER_MODEL="${WEBSURFER_MODEL:-$OPENAI_MODEL}"

if [ -z "$OPENAI_BASE_URL" ]; then
    echo "ERROR: OPENAI_BASE_URL is not set. Configure it as a Space secret." >&2
    exit 1
fi

envsubst < /app/config.template.yaml > /app/config.yaml

# nginx (0.0.0.0:7860, HF's exposed port) rewrites the Host header to
# localhost before forwarding to magentic-ui (127.0.0.1:8081, internal
# only) - magentic-ui hardcodes a localhost/127.0.0.1-only Host allowlist
# with no override, which would otherwise reject HF's proxy Host header.
nginx -c /app/nginx.conf

exec magentic-ui --host 127.0.0.1 --port 8081 --appdir /home/appuser/.magentic_ui --config /app/config.yaml