rajkstats commited on
Commit
90e4b7e
·
1 Parent(s): de5b839

user session

Browse files
Files changed (1) hide show
  1. app.py +23 -19
app.py CHANGED
@@ -249,20 +249,7 @@ async def on_question_selected(action: cl.Action):
249
  related_papers_content = "**Related Papers from PubMed:**\n" + "\n".join(f"- {paper}" for paper in related_papers)
250
  await cl.Message(content=related_papers_content, author="").send()
251
 
252
-
253
- potential_questions = [
254
- "What should I be careful of when taking Metformin?",
255
- "What are the contraindications of Aspirin?",
256
- "Are there low-cost alternatives to branded Aspirin available over-the-counter?",
257
- "What precautions should I take if I'm pregnant or nursing while on Lipitor?",
258
- "Should Lipitor be taken at a specific time of day, and does it need to be taken with food?",
259
- "What is the recommended dose of Aspirin?",
260
- "Can older people take beta blockers?",
261
- "How do beta blockers work?",
262
- "Can beta blockers be used for anxiety?",
263
- "I am taking Aspirin, is it ok to take Glipizide?",
264
- "Explain in simple terms how Metformin works?"
265
- ]
266
 
267
  # Callback for chat start event
268
  @cl.on_chat_start
@@ -367,12 +354,29 @@ async def on_chat_start():
367
  api_key=QDRANT_API_KEY,
368
  collection_name="fda_drugs" # Name of the collection in Qdrant
369
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
-
372
- await cl.Message(
373
- content="**Welcome to PharmAssistAI ! Here are some potential questions you can ask:**",
374
- actions=[cl.Action(name="ask_question", value=question, label=question) for question in potential_questions]
375
- ).send()
376
 
377
 
378
 
 
249
  related_papers_content = "**Related Papers from PubMed:**\n" + "\n".join(f"- {paper}" for paper in related_papers)
250
  await cl.Message(content=related_papers_content, author="").send()
251
 
252
+
 
 
 
 
 
 
 
 
 
 
 
 
 
253
 
254
  # Callback for chat start event
255
  @cl.on_chat_start
 
354
  api_key=QDRANT_API_KEY,
355
  collection_name="fda_drugs" # Name of the collection in Qdrant
356
  )
357
+
358
+ if not cl.user_session.get("potential_questions_shown", False):
359
+
360
+ potential_questions = [
361
+ "What should I be careful of when taking Metformin?",
362
+ "What are the contraindications of Aspirin?",
363
+ "Are there low-cost alternatives to branded Aspirin available over-the-counter?",
364
+ "What precautions should I take if I'm pregnant or nursing while on Lipitor?",
365
+ "Should Lipitor be taken at a specific time of day, and does it need to be taken with food?",
366
+ "What is the recommended dose of Aspirin?",
367
+ "Can older people take beta blockers?",
368
+ "How do beta blockers work?",
369
+ "Can beta blockers be used for anxiety?",
370
+ "I am taking Aspirin, is it ok to take Glipizide?",
371
+ "Explain in simple terms how Metformin works?"
372
+ ]
373
+ await cl.Message(
374
+ content="**Welcome to PharmAssistAI ! Here are some potential questions you can ask:**",
375
+ actions=[cl.Action(name="ask_question", value=question, label=question) for question in potential_questions]
376
+ ).send()
377
+ cl.user_session.set("potential_questions_shown", True)
378
 
379
+
 
 
 
 
380
 
381
 
382