Raiff1982 commited on
Commit
ece888b
·
verified ·
1 Parent(s): 363bdce

Delete main.py

Browse files
Files changed (1) hide show
  1. main.py +0 -70
main.py DELETED
@@ -1,70 +0,0 @@
1
- import os
2
- import logging
3
- from aiohttp import web
4
- from botbuilder.core import (
5
- BotFrameworkAdapterSettings,
6
- ConversationState,
7
- MemoryStorage,
8
- UserState,
9
- )
10
- from botbuilder.integration.aiohttp import BotFrameworkHttpAdapter
11
- from botbuilder.schema import Activity
12
- from dotenv import load_dotenv
13
- from utils import show_privacy_consent
14
- from universal_reasoning import UniversalReasoning, load_json_config
15
- from mybot import MyBot # Import updated MyBot class
16
- from main_dialog import MainDialog
17
-
18
- # Load environment variables from .env file
19
- load_dotenv()
20
-
21
- # Configure logging
22
- logging.basicConfig(
23
- level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
24
- )
25
-
26
- # Show privacy consent dialog and check user response
27
- if not show_privacy_consent():
28
- logging.info("User declined data collection and privacy policy. Exiting application.")
29
- exit()
30
-
31
- # Load configuration
32
- config = load_json_config("config.json")
33
- config["azure_openai_api_key"] = os.getenv("AZURE_OPENAI_API_KEY")
34
- config["azure_openai_endpoint"] = os.getenv("AZURE_OPENAI_ENDPOINT")
35
-
36
- # Initialize UniversalReasoning
37
- universal_reasoning = UniversalReasoning(config)
38
-
39
- # Create adapter
40
- settings = BotFrameworkAdapterSettings(
41
- app_id=os.getenv("MICROSOFT_APP_ID"),
42
- app_password=os.getenv("MICROSOFT_APP_PASSWORD"),
43
- )
44
- adapter = BotFrameworkHttpAdapter(settings)
45
-
46
- # Create MemoryStorage, ConversationState, and UserState
47
- memory_storage = MemoryStorage()
48
- conversation_state = ConversationState(memory_storage)
49
- user_state = UserState(memory_storage)
50
-
51
- # Create the main dialog
52
- main_dialog = MainDialog("MainDialog")
53
-
54
- # Create the bot and pass the universal_reasoning instance
55
- bot = MyBot(conversation_state, user_state, main_dialog, universal_reasoning)
56
-
57
- # Listen for incoming requests on /api/messages
58
- async def messages(req):
59
- body = await req.json()
60
- activity = Activity().deserialize(body)
61
- auth_header = req.headers.get("Authorization", "")
62
-
63
- response = await adapter.process_activity(activity, auth_header, bot.on_turn)
64
- return web.Response(status=response.status)
65
-
66
- app = web.Application()
67
- app.router.add_post("/api/messages", messages)
68
-
69
- if __name__ == "__main__":
70
- web.run_app(app, host="localhost", port=3978)