0Learn commited on
Commit
9b7ed8d
·
verified ·
1 Parent(s): fc7e3b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -12,10 +12,10 @@ app = FastAPI()
12
  # Initialize Groq client
13
  client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
14
 
15
- # Initialize SQLite database
16
- conn = sqlite3.connect('conversations.db')
17
  c = conn.cursor()
18
- c.execute('''CREATE TABLE IF NOT EXISTS conversations
19
  (id TEXT PRIMARY KEY, messages TEXT, last_updated TIMESTAMP)''')
20
  conn.commit()
21
 
@@ -70,7 +70,7 @@ async def get_conversation(conversation_id: str):
70
 
71
  @app.get("/")
72
  async def read_root():
73
- return {"message": "Welcome to the Groq chatbot API with conversation persistence!"}
74
 
75
  if __name__ == "__main__":
76
  import uvicorn
 
12
  # Initialize Groq client
13
  client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
14
 
15
+ # Initialize in-memory SQLite database
16
+ conn = sqlite3.connect(':memory:')
17
  c = conn.cursor()
18
+ c.execute('''CREATE TABLE conversations
19
  (id TEXT PRIMARY KEY, messages TEXT, last_updated TIMESTAMP)''')
20
  conn.commit()
21
 
 
70
 
71
  @app.get("/")
72
  async def read_root():
73
+ return {"message": "Welcome to the Groq chatbot API with in-memory conversation persistence!"}
74
 
75
  if __name__ == "__main__":
76
  import uvicorn