cygon commited on
Commit
48e767e
Β·
1 Parent(s): 7e4d893

intial commit

Browse files
Files changed (1) hide show
  1. start.sh +42 -12
start.sh CHANGED
@@ -2,35 +2,65 @@
2
  set -e
3
 
4
  echo "πŸš€ Starting LLM API Backend..."
 
 
5
 
6
  # Change to backend directory
7
  cd /app/backend
8
 
9
  # Verify Encore CLI is available
10
  if ! command -v encore &> /dev/null; then
11
- echo "❌ ERROR: Encore CLI not found"
 
 
 
12
  exit 1
13
  fi
14
 
15
- echo "βœ… Encore version: $(encore version)"
 
16
 
17
  # Configure secrets from environment variables
18
- if [ -n "$LLMProvider" ]; then
19
- encore secret set --type=local LLMProvider "$LLMProvider" 2>/dev/null || true
20
- fi
21
 
22
- if [ -n "$HuggingFaceAPIKey" ]; then
23
- encore secret set --type=local HuggingFaceAPIKey "$HuggingFaceAPIKey" 2>/dev/null || true
 
 
 
 
24
  fi
25
 
26
- if [ -n "$OllamaBaseURL" ]; then
27
- encore secret set --type=local OllamaBaseURL "$OllamaBaseURL" 2>/dev/null || true
 
 
 
 
 
 
 
 
 
 
 
28
  fi
29
 
30
- if [ -n "$DefaultModel" ]; then
31
- encore secret set --type=local DefaultModel "$DefaultModel" 2>/dev/null || true
 
 
 
 
 
 
32
  fi
33
 
34
  # Start the application
35
- echo "✨ Starting on port ${PORT:-7860}..."
 
 
 
 
 
36
  exec encore run --port="${PORT:-7860}"
 
2
  set -e
3
 
4
  echo "πŸš€ Starting LLM API Backend..."
5
+ echo "πŸ“ Working directory: $(pwd)"
6
+ echo "πŸ”’ Node version: $(node --version)"
7
 
8
  # Change to backend directory
9
  cd /app/backend
10
 
11
  # Verify Encore CLI is available
12
  if ! command -v encore &> /dev/null; then
13
+ echo "❌ ERROR: Encore CLI not found in PATH"
14
+ echo "Available binaries:"
15
+ ls -la /usr/local/bin/ | grep encore || echo "No encore binary found"
16
+ ls -la /root/.encore/bin/ 2>/dev/null | grep encore || echo "No encore binary in home"
17
  exit 1
18
  fi
19
 
20
+ echo "βœ… Encore CLI found: $(which encore)"
21
+ echo "πŸ“¦ Encore version: $(encore version)"
22
 
23
  # Configure secrets from environment variables
24
+ echo "πŸ” Configuring secrets from environment..."
 
 
25
 
26
+ if [ -z "$LLMProvider" ]; then
27
+ echo "⚠️ Warning: LLMProvider not set. Please configure in Space settings."
28
+ echo " Add: LLMProvider = 'huggingface' or 'ollama'"
29
+ else
30
+ echo "βœ… LLMProvider: $LLMProvider"
31
+ encore secret set --type=local LLMProvider "$LLMProvider" 2>/dev/null || echo " Note: Secret may already be set"
32
  fi
33
 
34
+ if [ "$LLMProvider" = "huggingface" ]; then
35
+ if [ -z "$HuggingFaceAPIKey" ]; then
36
+ echo "❌ ERROR: HuggingFaceAPIKey required for Hugging Face provider"
37
+ exit 1
38
+ else
39
+ echo "βœ… HuggingFaceAPIKey configured"
40
+ encore secret set --type=local HuggingFaceAPIKey "$HuggingFaceAPIKey" 2>/dev/null || echo " Note: Secret may already be set"
41
+ fi
42
+
43
+ if [ -n "$DefaultModel" ]; then
44
+ echo "βœ… DefaultModel: $DefaultModel"
45
+ encore secret set --type=local DefaultModel "$DefaultModel" 2>/dev/null || echo " Note: Secret may already be set"
46
+ fi
47
  fi
48
 
49
+ if [ "$LLMProvider" = "ollama" ]; then
50
+ if [ -z "$OllamaBaseURL" ]; then
51
+ echo "⚠️ Warning: OllamaBaseURL not set for Ollama provider"
52
+ echo " Add: OllamaBaseURL = 'http://localhost:11434'"
53
+ else
54
+ echo "βœ… OllamaBaseURL: $OllamaBaseURL"
55
+ encore secret set --type=local OllamaBaseURL "$OllamaBaseURL" 2>/dev/null || echo " Note: Secret may already be set"
56
+ fi
57
  fi
58
 
59
  # Start the application
60
+ echo ""
61
+ echo "✨ Starting Encore application on port ${PORT:-7860}..."
62
+ echo "πŸ“‘ Health endpoint: http://localhost:${PORT:-7860}/health"
63
+ echo "πŸ’¬ Chat endpoint: http://localhost:${PORT:-7860}/chat"
64
+ echo ""
65
+
66
  exec encore run --port="${PORT:-7860}"