ofermend commited on
Commit
ee297d5
1 Parent(s): b5252fe
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -160,6 +160,9 @@ def create_tools(cfg):
160
  )
161
 
162
  def initialize_agent(_cfg):
 
 
 
163
  bot_instructions = """
164
  - You are a helpful assistant, with expertise in answering user questions about Hacker News stories and comments.
165
  - Never discuss politics, and always respond politely.
@@ -171,6 +174,8 @@ def initialize_agent(_cfg):
171
  output = f"{status_type.value} - {msg}"
172
  st.session_state.log_messages.append(output)
173
 
 
 
174
  agent = Agent(
175
  tools=create_tools(_cfg),
176
  topic="hacker news",
 
160
  )
161
 
162
  def initialize_agent(_cfg):
163
+ if 'agent' in st.session_state:
164
+ return st.session_state.agent
165
+
166
  bot_instructions = """
167
  - You are a helpful assistant, with expertise in answering user questions about Hacker News stories and comments.
168
  - Never discuss politics, and always respond politely.
 
174
  output = f"{status_type.value} - {msg}"
175
  st.session_state.log_messages.append(output)
176
 
177
+ print(f"init_agent, with cfg={_cfg}")
178
+
179
  agent = Agent(
180
  tools=create_tools(_cfg),
181
  topic="hacker news",