International Rice Research Institute commited on
Commit
1b2e59d
·
verified ·
1 Parent(s): 13edc59

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +12 -3
app.R CHANGED
@@ -20,16 +20,25 @@ for (pkg in required_packages) {
20
  # ============================================================
21
  # TOKEN DEBUG
22
  # ============================================================
 
 
23
 
24
- HF_API_TOKEN <- Sys.getenv("GROQ_API_KEY")
25
- HF_API_URL <- "https://api.groq.com/openai/v1/chat/completions"
26
- default_model <- "llama-3.1-8b-instant"
 
 
27
  print("=== HUGGING FACE API TOKEN DEBUG ===")
28
  print(paste("Token exists:", token_exists))
29
  print(paste("Token length:", token_length))
30
  if(token_exists) print(paste("Token starts with:", substr(token, 1, 10)))
31
  print("===================================")
32
 
 
 
 
 
 
33
  # ============================================================
34
  # AVAILABLE MODELS CONFIGURATION
35
  # ============================================================
 
20
  # ============================================================
21
  # TOKEN DEBUG
22
  # ============================================================
23
+ # STEP 1 - Get token
24
+ token <- Sys.getenv("GROQ_API_KEY")
25
 
26
+ # STEP 2 - Check token (must come right after)
27
+ token_exists <- token != ""
28
+ token_length <- if(token_exists) nchar(token) else 0
29
+
30
+ # STEP 3 - Debug print
31
  print("=== HUGGING FACE API TOKEN DEBUG ===")
32
  print(paste("Token exists:", token_exists))
33
  print(paste("Token length:", token_length))
34
  if(token_exists) print(paste("Token starts with:", substr(token, 1, 10)))
35
  print("===================================")
36
 
37
+ # STEP 4 - API config
38
+ HF_API_TOKEN <- token
39
+ HF_API_URL <- "https://api.groq.com/openai/v1/chat/completions"
40
+ default_model <- "llama-3.1-8b-instant"
41
+
42
  # ============================================================
43
  # AVAILABLE MODELS CONFIGURATION
44
  # ============================================================