Chris Alexiuk commited on
Commit
bddc163
·
1 Parent(s): 86064f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -53,6 +53,8 @@ async def start_chat():
53
  ]
54
  ).send()
55
 
 
 
56
  @cl.on_settings_update # marks a function that "logs" settings update
57
  async def setup_agent(settings):
58
  print("on_settings_update", settings)
@@ -60,6 +62,8 @@ async def setup_agent(settings):
60
  @cl.on_message # marks a function that should be run each time the chatbot receives a message from a user
61
  async def main(message: str):
62
 
 
 
63
  prompt = Prompt(
64
  provider=ChatOpenAI.id,
65
  messages=[
@@ -73,7 +77,8 @@ async def main(message: str):
73
  formatted=user_template.format(input=message)
74
  )
75
  ],
76
- inputs = {"input" : message}
 
77
  )
78
 
79
  msg = cl.Message(content="")
 
53
  ]
54
  ).send()
55
 
56
+ cl.user_session.set("settings", settings)
57
+
58
  @cl.on_settings_update # marks a function that "logs" settings update
59
  async def setup_agent(settings):
60
  print("on_settings_update", settings)
 
62
  @cl.on_message # marks a function that should be run each time the chatbot receives a message from a user
63
  async def main(message: str):
64
 
65
+ settings = cl.user_session.get("settings")
66
+
67
  prompt = Prompt(
68
  provider=ChatOpenAI.id,
69
  messages=[
 
77
  formatted=user_template.format(input=message)
78
  )
79
  ],
80
+ inputs = {"input" : message},
81
+ settings=settings
82
  )
83
 
84
  msg = cl.Message(content="")