georad commited on
Commit
f9f9d77
·
verified ·
1 Parent(s): 389656c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -5
app.py CHANGED
@@ -13,12 +13,37 @@ if 'device_id' not in st.session_state:
13
  if "feedback_key" not in st.session_state:
14
  st.session_state.feedback_key = 0
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  if __name__ == "__main__":
17
  st.set_page_config(page_title="Test Sticky Header", layout="wide")
 
 
18
  st.image("images/SBS_Chapter_Index.png")
19
  for i in range(50):
20
- st.write(f"Settings: Scrollable content line {i+1}")
21
-
22
- nest_asyncio.apply()
23
- sys.stdout.flush()
24
- #asyncio.run(main())
 
13
  if "feedback_key" not in st.session_state:
14
  st.session_state.feedback_key = 0
15
 
16
+
17
+ async def launch_bot():
18
+ def reset():
19
+ st.session_state.messages = [{"role": "assistant", "content": initial_prompt, "avatar": "🦖"}]
20
+ st.session_state.log_messages = []
21
+ st.session_state.prompt = None
22
+ st.session_state.ex_prompt = None
23
+ st.session_state.first_turn = True
24
+ st.session_state.show_logs = False
25
+ if 'agent' not in st.session_state:
26
+ st.session_state.agent = initialize_agent(cfg, agent_progress_callback=agent_progress_callback)
27
+ else:
28
+ st.session_state.agent.clear_memory()
29
+ if 'cfg' not in st.session_state:
30
+ cfg = get_agent_config()
31
+ st.session_state.cfg = cfg
32
+ st.session_state.ex_prompt = None
33
+ example_messages = [example.strip() for example in cfg.examples.split(";")] if cfg.examples else []
34
+ st.session_state.example_messages = [em for em in example_messages if len(em)>0]
35
+ reset()
36
+
37
+ cfg = st.session_state.cfg
38
+ sys.stdout.flush()
39
+
40
+ if "feedback_key" not in st.session_state:
41
+ st.session_state.feedback_key = 0
42
+
43
  if __name__ == "__main__":
44
  st.set_page_config(page_title="Test Sticky Header", layout="wide")
45
+ nest_asyncio.apply()
46
+ asyncio.run(launch_bot())
47
  st.image("images/SBS_Chapter_Index.png")
48
  for i in range(50):
49
+ st.write(f"Settings: Scrollable content line {i+1}")