Spaces:
Sleeping
Sleeping
chen commited on
Update command_handler.py
Browse files8 unmodified lines910111213141521 unmodified lines37383940414268 unmodified lines1111121131141151168 unmodified linesfrom usgs_service import fetch_global_last24h_text, fetch_taiwan_df_this_yearfrom ai_service import generate_ai_textfrom config import CURRENT_YEAR, MCP_SERVER_URLfrom pws_service import fetch_cwa_pws_earthquake_info # 匯入新函式def get_help_message() -> TextMessage:"""產生並回傳包含所有指令的說明文字,並附上英文翻譯。"""21 unmodified lines"• 8 - 關於此機器人 (About this Bot)\n""• 9 - 顯示此說明 (Show this Help Message)\n\n""【其他服務 (Other Services)】\n""• 11 - 查詢最近地震PWS訊息\n"" (Recent PWS Earthquake Info)")68 unmodified linesif command_key == '6': return [TextMessage(text=fetch_significant_earthquakes(limit=5))]if command_key == '8': return [get_info_message()]if command_key == '9': return [get_help_message()]if command_key == '11': return [TextMessage(text=fetch_cwa_pws_earthquake_info())]if command_key == '7':8 unmodified lines91011121314151621 unmodified lines383940414243444568 unmodified lines1141151161171181191208 unmodified linesfrom usgs_service import fetch_global_last24h_text, fetch_taiwan_df_this_yearfrom ai_service import generate_ai_textfrom config import CURRENT_YEAR, MCP_SERVER_URLfrom pws_service import fetch_cwa_pws_earthquake_infofrom news_service import fetch_today_news # 匯入新函式def get_help_message() -> TextMessage:"""產生並回傳包含所有指令的說明文字,並附上英文翻譯。"""21 unmodified lines"• 8 - 關於此機器人 (About this Bot)\n""• 9 - 顯示此說明 (Show this Help Message)\n\n""【其他服務 (Other Services)】\n""• 10 - 查詢今日新聞\n"" (Today's News)\n""• 11 - 查詢最近地震PWS訊息\n"" (Recent PWS Earthquake Info)")68 unmodified linesif command_key == '6': return [TextMessage(text=fetch_significant_earthquakes(limit=5))]if command_key == '8': return [get_info_message()]if command_key == '9': return [get_help_message()]if command_key == '10': return [TextMessage(text=fetch_today_news())]if command_key == '11': return [TextMessage(text=fetch_cwa_pws_earthquake_info())]if command_key == '7':
command_handler.py+5-1