Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ import datetime
|
|
9 |
from zoneinfo import ZoneInfo
|
10 |
import gspread
|
11 |
from google.oauth2.service_account import Credentials
|
|
|
12 |
from agno.tools import tool
|
13 |
import os
|
14 |
|
@@ -67,6 +68,7 @@ agent = Agent(
|
|
67 |
),
|
68 |
tools=[GoogleCalendarTools(credentials_path="./credentials.json",token_path="./token.json"),
|
69 |
add_appointment],
|
|
|
70 |
show_tool_calls=True,
|
71 |
instructions=[
|
72 |
f"""
|
@@ -120,7 +122,6 @@ agent = Agent(
|
|
120 |
add_history_to_messages=True,
|
121 |
markdown=True,
|
122 |
num_history_responses=20,
|
123 |
-
session_id=str(From),
|
124 |
description="You are a friendly and professional virtual assistant, dedicated to helping users book appointments with doctors. As a representative of the hospital, you always respond with politeness, positivity, and enthusiasm. Before finalizing any appointment, you ensure to ask the user for confirmation, making sure everything is clear and agreed upon.",
|
125 |
)
|
126 |
|
@@ -130,7 +131,7 @@ async def sms_reply(Body: str = Form(...), From: str = Form(...)):
|
|
130 |
print(f"Received message: {Body}")
|
131 |
|
132 |
try:
|
133 |
-
bot_response = agent.run(Body, markdown=True).content
|
134 |
print(f"Received sent: {bot_response}")
|
135 |
except Exception as e:
|
136 |
bot_response = f"Oops! Something went wrong: {str(e)}"
|
|
|
9 |
from zoneinfo import ZoneInfo
|
10 |
import gspread
|
11 |
from google.oauth2.service_account import Credentials
|
12 |
+
from agno.storage.sqlite import SqliteStorage
|
13 |
from agno.tools import tool
|
14 |
import os
|
15 |
|
|
|
68 |
),
|
69 |
tools=[GoogleCalendarTools(credentials_path="./credentials.json",token_path="./token.json"),
|
70 |
add_appointment],
|
71 |
+
storage=SqliteStorage(table_name="agent_sessions", db_file="./agent_storage.db"),
|
72 |
show_tool_calls=True,
|
73 |
instructions=[
|
74 |
f"""
|
|
|
122 |
add_history_to_messages=True,
|
123 |
markdown=True,
|
124 |
num_history_responses=20,
|
|
|
125 |
description="You are a friendly and professional virtual assistant, dedicated to helping users book appointments with doctors. As a representative of the hospital, you always respond with politeness, positivity, and enthusiasm. Before finalizing any appointment, you ensure to ask the user for confirmation, making sure everything is clear and agreed upon.",
|
126 |
)
|
127 |
|
|
|
131 |
print(f"Received message: {Body}")
|
132 |
|
133 |
try:
|
134 |
+
bot_response = agent.run(Body, markdown=True, session_id=From).content
|
135 |
print(f"Received sent: {bot_response}")
|
136 |
except Exception as e:
|
137 |
bot_response = f"Oops! Something went wrong: {str(e)}"
|