Update app.py
Browse files
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('
|
| 17 |
c = conn.cursor()
|
| 18 |
-
c.execute('''CREATE TABLE
|
| 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
|