Deadmon commited on
Commit
38f85af
·
verified ·
1 Parent(s): acaea79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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('app.log'),
22
  logging.StreamHandler()
23
  ]
24
  )
@@ -49,7 +49,7 @@ class ConversationMemory:
49
  )
50
  """)
51
  self.conn.commit()
52
- logger.info("Created conversation_chunks table")
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
- async def process_stream(sync_stream):
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("app.log", "r") as f:
370
  logs = f.read()
371
- logger.info("Retrieved logs from app.log")
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)}")