fix hotbug🚀

This commit is contained in:
cvcat
2025-04-21 14:25:20 +08:00
parent fd67032f01
commit df07e54cd8
3 changed files with 4 additions and 12 deletions

View File

@ -175,5 +175,4 @@ def send_message(user: str, content: str) -> str:
return f"成功向 {user} 发送了私信: '{content}'" return f"成功向 {user} 发送了私信: '{content}'"
if __name__ == "__main__": if __name__ == "__main__":
print(get_weather("北京"))
mcp.run(transport="stdio") mcp.run(transport="stdio")

View File

@ -31,7 +31,8 @@ def get_city_weather(city):
'locale': 'zh_CN', 'locale': 'zh_CN',
'days': '1' 'days': '1'
} }
response = requests.get(URL, params=params, verify=False) response = requests.get(URL, params=params)
print(111, response)
data = response.json() data = response.json()
current = data['current'] current = data['current']
temperature = current['temperature'] temperature = current['temperature']

12
main.py
View File

@ -58,16 +58,8 @@ async def main():
except KeyboardInterrupt: except KeyboardInterrupt:
logger.info("程序被用户中断.") logger.info("程序被用户中断.")
except Exception as e: except Exception as e:
logger.error(f"连接到 Lark WebSocket 失败: {str(e)}") logger.error(f"Error: {str(e)}")
sys.exit(1)
finally:
message_service.close()
logger.info("消息服务关闭.")
if mcp_process.is_alive():
logger.info("Shutting down MCP server...")
mcp_process.terminate()
mcp_process.join()
logger.info("MCP server shut down.")
if __name__ == "__main__": if __name__ == "__main__":
asyncio.run(main()) asyncio.run(main())