Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import aiohttp
|
|
4 |
import asyncio
|
5 |
import json
|
6 |
import urllib.parse
|
|
|
|
|
7 |
|
8 |
LLM_API = os.environ.get("LLM_API")
|
9 |
LLM_URL = os.environ.get("LLM_URL")
|
@@ -54,7 +56,9 @@ async def send_chat_message(LLM_URL, LLM_API, user_input):
|
|
54 |
else:
|
55 |
return "Error: No response found in the response"
|
56 |
except Exception as e:
|
57 |
-
|
|
|
|
|
58 |
return f"Exception: {e}"
|
59 |
|
60 |
async def handle_input(user_input):
|
|
|
4 |
import asyncio
|
5 |
import json
|
6 |
import urllib.parse
|
7 |
+
import traceback # 新增此行以便捕捉完整的異常堆疊
|
8 |
+
|
9 |
|
10 |
LLM_API = os.environ.get("LLM_API")
|
11 |
LLM_URL = os.environ.get("LLM_URL")
|
|
|
56 |
else:
|
57 |
return "Error: No response found in the response"
|
58 |
except Exception as e:
|
59 |
+
# 捕捉完整的異常訊息並打印出堆疊資訊
|
60 |
+
print("Exception occurred in send_chat_message:")
|
61 |
+
print(traceback.format_exc()) # 使用 traceback 輸出完整的錯誤堆疊
|
62 |
return f"Exception: {e}"
|
63 |
|
64 |
async def handle_input(user_input):
|