cwadayi commited on
Commit
a8372d5
·
verified ·
1 Parent(s): 071beff

Update config.py

Browse files
Files changed (1) hide show
  1. config.py +4 -16
config.py CHANGED
@@ -15,11 +15,7 @@ CHANNEL_SECRET = os.getenv("CHANNEL_SECRET")
15
 
16
  # --- Hugging Face Space URL ---
17
  HF_SPACE_URL = os.getenv("SPACEURL")
18
- if not HF_SPACE_URL:
19
- sid = os.getenv("SPACE_ID")
20
- if sid and "/" in sid:
21
- author, name = sid.split("/", 1)
22
- HF_SPACE_URL = f"https://{author.replace('_', '-')}-{name.replace('_', '-')}.hf.space"
23
  else:
24
  HF_SPACE_URL = ""
25
 
@@ -27,19 +23,11 @@ if not HF_SPACE_URL:
27
  STATIC_DIR = os.getenv("STATIC_DIR", os.path.join(tempfile.gettempdir(), "static"))
28
  os.makedirs(STATIC_DIR, exist_ok=True)
29
 
30
- # --- API 端點 ---
 
31
  CWA_ALARM_API = "https://app-2.cwa.gov.tw/api/v1/earthquake/alarm/list"
32
  USGS_API_BASE_URL = "https://earthquake.usgs.gov/fdsnws/event/1/query"
33
 
34
  # --- AI 模型設定 ---
35
  HUGGING_FACE_TOKEN = os.getenv("HUGGING_FACE_TOKEN")
36
-
37
- # [修改] 將模型更換為指令微調過的 bloomz-560m
38
- LLM_MODEL = os.getenv("LLM_MODEL", "bigscience/bloomz-560m")
39
-
40
- LLM_MAX_NEW_TOKENS = int(os.getenv("LLM_MAX_NEW_TOKENS", "120"))
41
- LLM_TOP_K = int(os.getenv("LLM_TOP_K", "50"))
42
- LLM_TEMPERATURE = float(os.getenv("LLM_TEMPERATURE", "0.7"))
43
-
44
- # --- 顯示用當年年份 ---
45
- CURRENT_YEAR = datetime.now().year
 
15
 
16
  # --- Hugging Face Space URL ---
17
  HF_SPACE_URL = os.getenv("SPACEURL")
18
+ # ... (中間部分程式碼不變) ...
 
 
 
 
19
  else:
20
  HF_SPACE_URL = ""
21
 
 
23
  STATIC_DIR = os.getenv("STATIC_DIR", os.path.join(tempfile.gettempdir(), "static"))
24
  os.makedirs(STATIC_DIR, exist_ok=True)
25
 
26
+ # --- API 端點與金鑰 ---
27
+ CWA_AUTH_KEY = os.getenv("CWA_AUTH_KEY") # [新增] 從環境變數讀取 CWA 金鑰
28
  CWA_ALARM_API = "https://app-2.cwa.gov.tw/api/v1/earthquake/alarm/list"
29
  USGS_API_BASE_URL = "https://earthquake.usgs.gov/fdsnws/event/1/query"
30
 
31
  # --- AI 模型設定 ---
32
  HUGGING_FACE_TOKEN = os.getenv("HUGGING_FACE_TOKEN")
33
+ # ... (以下程式碼不變) ...