Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ logging.basicConfig(
|
|
18 |
level=logging.INFO,
|
19 |
format='%(asctime)s - %(levelname)s - %(message)s',
|
20 |
handlers=[
|
21 |
-
logging.FileHandler('
|
22 |
logging.StreamHandler()
|
23 |
]
|
24 |
)
|
@@ -49,7 +49,7 @@ class ConversationMemory:
|
|
49 |
)
|
50 |
""")
|
51 |
self.conn.commit()
|
52 |
-
logger.info("Created
|
53 |
|
54 |
def add_chunk(self, text, role, intent="general"):
|
55 |
chunk_id = str(uuid.uuid4())
|
@@ -291,7 +291,7 @@ class OpenAIApi:
|
|
291 |
stream=True
|
292 |
)
|
293 |
|
294 |
-
|
295 |
full_response = ""
|
296 |
tool_calls = []
|
297 |
for chunk in sync_stream:
|
@@ -366,9 +366,9 @@ def get_history():
|
|
366 |
|
367 |
def get_logs():
|
368 |
try:
|
369 |
-
with open("
|
370 |
logs = f.read()
|
371 |
-
logger.info("Retrieved logs from
|
372 |
return logs
|
373 |
except Exception as e:
|
374 |
logger.error(f"Failed to read logs: {str(e)}")
|
|
|
18 |
level=logging.INFO,
|
19 |
format='%(asctime)s - %(levelname)s - %(message)s',
|
20 |
handlers=[
|
21 |
+
logging.FileHandler('aiapp.log'),
|
22 |
logging.StreamHandler()
|
23 |
]
|
24 |
)
|
|
|
49 |
)
|
50 |
""")
|
51 |
self.conn.commit()
|
52 |
+
logger.info("Created conversation table")
|
53 |
|
54 |
def add_chunk(self, text, role, intent="general"):
|
55 |
chunk_id = str(uuid.uuid4())
|
|
|
291 |
stream=True
|
292 |
)
|
293 |
|
294 |
+
def process_stream(sync_stream):
|
295 |
full_response = ""
|
296 |
tool_calls = []
|
297 |
for chunk in sync_stream:
|
|
|
366 |
|
367 |
def get_logs():
|
368 |
try:
|
369 |
+
with open("aiapp.log", "r") as f:
|
370 |
logs = f.read()
|
371 |
+
logger.info("Retrieved logs from aiapp.log")
|
372 |
return logs
|
373 |
except Exception as e:
|
374 |
logger.error(f"Failed to read logs: {str(e)}")
|