Lenson commited on
Commit
1f4967a
·
1 Parent(s): 1b0f5be

Fix data directory download URL prefix

Browse files
Files changed (1) hide show
  1. .hf/setup.sh +21 -7
.hf/setup.sh CHANGED
@@ -65,22 +65,26 @@ download_from_supabase() {
65
  local local_path=""
66
  if [[ "$remote_path" == config/prompts/* ]]; then
67
  local_path="/app/config/prompts/$filename"
 
68
  elif [[ "$remote_path" == config/* ]]; then
69
  local_path="/app/config/$filename"
 
70
  elif [[ "$remote_path" == prompts/* ]]; then
71
  # prompts folder files without "config/" prefix
72
  local_path="/app/config/prompts/$filename"
 
73
  else
74
  # config folder files without "config/" prefix
75
  local_path="/app/config/$filename"
 
76
  fi
77
-
78
  mkdir -p "$(dirname "$local_path")"
79
- echo "DEBUG: Downloading $remote_path to $local_path"
80
  if curl -s -L \
81
  -H "Authorization: Bearer $SUPABASE_KEY" \
82
  -o "$local_path" \
83
- "$SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$remote_path"; then
84
  echo "Downloaded: $remote_path"
85
  else
86
  echo "Failed: $remote_path (curl exit code: $?)"
@@ -105,13 +109,14 @@ download_from_supabase() {
105
 
106
  local filename=$(basename "$remote_path")
107
  local local_path="/app/config/prompts/$filename"
 
108
 
109
- echo "DEBUG: Downloading $remote_path to $local_path"
110
  mkdir -p "$(dirname "$local_path")"
111
  if curl -s -L \
112
  -H "Authorization: Bearer $SUPABASE_KEY" \
113
  -o "$local_path" \
114
- "$SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$remote_path"; then
115
  echo "Downloaded: $remote_path"
116
  else
117
  echo "Failed: $remote_path (curl exit code: $?)"
@@ -145,15 +150,15 @@ download_from_supabase() {
145
  continue
146
  fi
147
 
148
- # Download to /app/data/
149
  local local_path="/app/data/$filename"
 
150
 
151
  echo "DEBUG: Downloading $remote_path to $local_path"
152
  mkdir -p "$(dirname "$local_path")"
153
  if curl -s -L \
154
  -H "Authorization: Bearer $SUPABASE_KEY" \
155
  -o "$local_path" \
156
- "$SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$remote_path"; then
157
  echo "Downloaded: $remote_path"
158
  else
159
  echo "Failed: $remote_path (curl exit code: $?)"
@@ -164,6 +169,15 @@ download_from_supabase() {
164
  fi
165
 
166
  echo "Download complete"
 
 
 
 
 
 
 
 
 
167
  }
168
 
169
  start_supabase_upload() {
 
65
  local local_path=""
66
  if [[ "$remote_path" == config/prompts/* ]]; then
67
  local_path="/app/config/prompts/$filename"
68
+ download_prefix="config/prompts/"
69
  elif [[ "$remote_path" == config/* ]]; then
70
  local_path="/app/config/$filename"
71
+ download_prefix="config/"
72
  elif [[ "$remote_path" == prompts/* ]]; then
73
  # prompts folder files without "config/" prefix
74
  local_path="/app/config/prompts/$filename"
75
+ download_prefix="config/prompts/"
76
  else
77
  # config folder files without "config/" prefix
78
  local_path="/app/config/$filename"
79
+ download_prefix="config/"
80
  fi
81
+
82
  mkdir -p "$(dirname "$local_path")"
83
+ echo "DEBUG: Downloading $remote_path to $local_path (URL: $SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$download_prefix$filename)"
84
  if curl -s -L \
85
  -H "Authorization: Bearer $SUPABASE_KEY" \
86
  -o "$local_path" \
87
+ "$SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$download_prefix$filename"; then
88
  echo "Downloaded: $remote_path"
89
  else
90
  echo "Failed: $remote_path (curl exit code: $?)"
 
109
 
110
  local filename=$(basename "$remote_path")
111
  local local_path="/app/config/prompts/$filename"
112
+ local download_prefix="config/prompts/"
113
 
114
+ echo "DEBUG: Downloading $remote_path to $local_path (URL: $SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$download_prefix$filename)"
115
  mkdir -p "$(dirname "$local_path")"
116
  if curl -s -L \
117
  -H "Authorization: Bearer $SUPABASE_KEY" \
118
  -o "$local_path" \
119
+ "$SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$download_prefix$filename"; then
120
  echo "Downloaded: $remote_path"
121
  else
122
  echo "Failed: $remote_path (curl exit code: $?)"
 
150
  continue
151
  fi
152
 
 
153
  local local_path="/app/data/$filename"
154
+ local download_prefix="data/"
155
 
156
  echo "DEBUG: Downloading $remote_path to $local_path"
157
  mkdir -p "$(dirname "$local_path")"
158
  if curl -s -L \
159
  -H "Authorization: Bearer $SUPABASE_KEY" \
160
  -o "$local_path" \
161
+ "$SUPABASE_URL/storage/v1/object/$SUPABASE_BUCKET/$download_prefix$filename"; then
162
  echo "Downloaded: $remote_path"
163
  else
164
  echo "Failed: $remote_path (curl exit code: $?)"
 
169
  fi
170
 
171
  echo "Download complete"
172
+
173
+ echo ""
174
+ echo "=== Verification: Checking downloaded files ==="
175
+ echo "--- Config files ---"
176
+ ls -la /app/config/ 2>/dev/null || echo "No config files"
177
+ echo "--- Prompt files ---"
178
+ ls -la /app/config/prompts/ 2>/dev/null || echo "No prompt files"
179
+ echo "--- Data files ---"
180
+ ls -la /app/data/ 2>/dev/null || echo "No data files"
181
  }
182
 
183
  start_supabase_upload() {