Update app.py
Browse files
app.py
CHANGED
|
@@ -93,7 +93,15 @@ class AIAssistant:
|
|
| 93 |
"""AI Assistant with MCP integration"""
|
| 94 |
|
| 95 |
def __init__(self, openai_api_key: str, mcp_client: MCPClient):
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
self.mcp_client = mcp_client
|
| 98 |
self.available_tools = []
|
| 99 |
|
|
|
|
| 93 |
"""AI Assistant with MCP integration"""
|
| 94 |
|
| 95 |
def __init__(self, openai_api_key: str, mcp_client: MCPClient):
|
| 96 |
+
try:
|
| 97 |
+
self.openai_client = openai.OpenAI(
|
| 98 |
+
api_key=openai_api_key,
|
| 99 |
+
timeout=30.0
|
| 100 |
+
)
|
| 101 |
+
except Exception as e:
|
| 102 |
+
# Fallback for older OpenAI versions
|
| 103 |
+
openai.api_key = openai_api_key
|
| 104 |
+
self.openai_client = openai
|
| 105 |
self.mcp_client = mcp_client
|
| 106 |
self.available_tools = []
|
| 107 |
|