Yash030 commited on
Commit
05c81af
·
1 Parent(s): d3f76b5

Fixed Display issues

Browse files
Files changed (2) hide show
  1. Caddyfile +9 -3
  2. start.sh +17 -0
Caddyfile CHANGED
@@ -1,16 +1,22 @@
1
  :7860 {
2
  # Route WebSocket streams (iii-stream on 3112)
3
  handle /stream/* {
4
- reverse_proxy localhost:3112
 
 
5
  }
6
 
7
  # Route REST API endpoints (iii-http on 3111)
8
  handle /agentmemory/* {
9
- reverse_proxy localhost:3111
 
 
10
  }
11
 
12
  # Route Viewer dashboard (on 3113)
13
  handle {
14
- reverse_proxy localhost:3113
 
 
15
  }
16
  }
 
1
  :7860 {
2
  # Route WebSocket streams (iii-stream on 3112)
3
  handle /stream/* {
4
+ reverse_proxy localhost:3112 {
5
+ header_up Host localhost:3112
6
+ }
7
  }
8
 
9
  # Route REST API endpoints (iii-http on 3111)
10
  handle /agentmemory/* {
11
+ reverse_proxy localhost:3111 {
12
+ header_up Host localhost:3111
13
+ }
14
  }
15
 
16
  # Route Viewer dashboard (on 3113)
17
  handle {
18
+ reverse_proxy localhost:3113 {
19
+ header_up Host localhost:3113
20
+ }
21
  }
22
  }
start.sh CHANGED
@@ -3,17 +3,34 @@
3
  # Create config folder
4
  mkdir -p ~/.agentmemory
5
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # Dynamically write env config from environment variables
7
  cat <<EOF > ~/.agentmemory/.env
8
  # =============================================================================
9
  # agentmemory configuration (Hugging Face Spaces)
10
  # =============================================================================
11
  GEMINI_API_KEY=${GEMINI_API_KEY}
 
 
 
12
  GEMINI_MODEL=gemini-2.5-flash
13
  EMBEDDING_PROVIDER=gemini
14
  CONSOLIDATION_ENABLED=true
15
  GRAPH_EXTRACTION_ENABLED=true
16
  AGENTMEMORY_REFLECT=true
 
 
17
  EOF
18
 
19
  # Start agentmemory daemon in the background
 
3
  # Create config folder
4
  mkdir -p ~/.agentmemory
5
 
6
+ # The daemon runs inside the Space and must talk to its own services on local
7
+ # container ports. Use the public hf.space URL only from your local machine.
8
+ export AGENTMEMORY_URL=http://localhost:3111
9
+ export III_ENGINE_URL=ws://localhost:49134
10
+
11
+ # Hugging Face proxies requests with the public *.hf.space host. agentmemory's
12
+ # viewer rejects unknown Host headers unless they are explicitly allowed.
13
+ if [ -n "${SPACE_HOST}" ]; then
14
+ export VIEWER_ALLOWED_HOSTS="${VIEWER_ALLOWED_HOSTS:-${SPACE_HOST},${SPACE_HOST}:443,${SPACE_HOST}:7860}"
15
+ export VIEWER_ALLOWED_ORIGINS="${VIEWER_ALLOWED_ORIGINS:-https://${SPACE_HOST},http://${SPACE_HOST},http://localhost:3111,http://localhost:3113,http://127.0.0.1:3111,http://127.0.0.1:3113}"
16
+ fi
17
+
18
  # Dynamically write env config from environment variables
19
  cat <<EOF > ~/.agentmemory/.env
20
  # =============================================================================
21
  # agentmemory configuration (Hugging Face Spaces)
22
  # =============================================================================
23
  GEMINI_API_KEY=${GEMINI_API_KEY}
24
+ AGENTMEMORY_SECRET=${AGENTMEMORY_SECRET}
25
+ AGENTMEMORY_URL=${AGENTMEMORY_URL}
26
+ III_ENGINE_URL=${III_ENGINE_URL}
27
  GEMINI_MODEL=gemini-2.5-flash
28
  EMBEDDING_PROVIDER=gemini
29
  CONSOLIDATION_ENABLED=true
30
  GRAPH_EXTRACTION_ENABLED=true
31
  AGENTMEMORY_REFLECT=true
32
+ VIEWER_ALLOWED_HOSTS=${VIEWER_ALLOWED_HOSTS}
33
+ VIEWER_ALLOWED_ORIGINS=${VIEWER_ALLOWED_ORIGINS}
34
  EOF
35
 
36
  # Start agentmemory daemon in the background