DrishtiSharma commited on
Commit
bf19b95
·
verified ·
1 Parent(s): 3f5e35b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -60
app.py CHANGED
@@ -29,66 +29,28 @@ def initialize_session_state_variables() -> None:
29
  """
30
  Initialize all the session state variables.
31
  """
32
-
33
- if "ready" not in st.session_state:
34
- st.session_state.ready = False
35
-
36
- if "bing_subscription_validity" not in st.session_state:
37
- st.session_state.bing_subscription_validity = False
38
-
39
- if "langchain_api_validity" not in st.session_state:
40
- st.session_state.langchain_api_validity = False
41
-
42
- if "model" not in st.session_state:
43
- st.session_state.model = "gpt-4o"
44
-
45
- if "language" not in st.session_state:
46
- st.session_state.language = "English"
47
-
48
- if "topic" not in st.session_state:
49
- st.session_state.topic = ""
50
-
51
- if "positive" not in st.session_state:
52
- st.session_state.positive = ""
53
-
54
- if "negative" not in st.session_state:
55
- st.session_state.negative = ""
56
-
57
- if "agent_descriptions" not in st.session_state:
58
- st.session_state.agent_descriptions = {}
59
-
60
- if "specified_topic" not in st.session_state:
61
- st.session_state.specified_topic = ""
62
-
63
- if "new_debate" not in st.session_state:
64
- st.session_state.new_debate = True
65
-
66
- if "conversations" not in st.session_state:
67
- st.session_state.conversations = []
68
-
69
- if "conversations4print" not in st.session_state:
70
- st.session_state.conversations4print = []
71
-
72
- if "simulator" not in st.session_state:
73
- st.session_state.simulator = None
74
-
75
- if "names" not in st.session_state:
76
- st.session_state.names = {}
77
-
78
- if "tools" not in st.session_state:
79
- st.session_state.tools = []
80
-
81
- if "retriever_tool" not in st.session_state:
82
- st.session_state.retriever_tool = None
83
-
84
- if "vector_store_message" not in st.session_state:
85
- st.session_state.vector_store_message = ""
86
-
87
- if "conclusions" not in st.session_state:
88
- st.session_state.conclusions = ""
89
-
90
- if "comments_key" not in st.session_state:
91
- st.session_state.comments_key = 0
92
 
93
 
94
  def is_openai_api_key_valid(openai_api_key: str) -> bool:
 
29
  """
30
  Initialize all the session state variables.
31
  """
32
+ session_defaults = {
33
+ "ready": False,
34
+ "bing_subscription_validity": False,
35
+ "model": "gpt-4o",
36
+ "language": "English",
37
+ "topic": "",
38
+ "positive": "",
39
+ "negative": "",
40
+ "agent_descriptions": {},
41
+ "new_debate": True,
42
+ "conversations": [],
43
+ "conversations4print": [],
44
+ "simulator": None,
45
+ "tools": [],
46
+ "retriever_tool": None,
47
+ "vector_store_message": "",
48
+ "conclusions": "",
49
+ "comments_key": 0,
50
+ }
51
+ for key, value in session_defaults.items():
52
+ if key not in st.session_state:
53
+ st.session_state[key] = value
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
 
56
  def is_openai_api_key_valid(openai_api_key: str) -> bool: