Prof-Reza commited on
Commit
7fca00d
·
verified ·
1 Parent(s): b52cc70

Remove search query and domain filter fields; trigger web searches from chat.

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -187,20 +187,14 @@ def generate_package(plan, sources):
187
  with gr.Blocks() as demo:
188
  gr.Markdown(
189
  """# Course Creator Agent
190
- Chat with the assistant to brainstorm your course idea. Use web search to collect resources. When you're ready, click **Finalize Outline** to generate a course plan. Then generate the final course package (ZIP)."""
191
  )
192
  # Chat interface components
193
  # Use 'messages' type for Chatbot. The Chatbot expects a list of message dictionaries
194
  # (e.g. {"role": "user", "content": "..."}) when type="messages".
195
  chatbot = gr.Chatbot(label="Conversation", type="messages")
196
  msg_input = gr.Textbox(label="Your message", placeholder="Type your message and press Enter", lines=1)
197
- # Search controls
198
- search_query = gr.Textbox(label="Search query", placeholder="Enter search keywords")
199
- domain_filter = gr.Textbox(
200
- label="Domain filter (comma-separated)", placeholder=".edu,.gov,acm.org", value=""
201
- )
202
- search_results = gr.Textbox(label="Search results", interactive=False)
203
- # Buttons and outputs
204
  finalize_btn = gr.Button("Finalize Outline")
205
  plan_output = gr.Textbox(label="Course outline", interactive=False)
206
  generate_btn = gr.Button("Generate Course Package")
@@ -217,14 +211,6 @@ Chat with the assistant to brainstorm your course idea. Use web search to collec
217
  # First output goes to the Chatbot; we return the updated chat history (list of messages)
218
  outputs=[chatbot, state_chat_history, state_chat_pairs, state_sources, state_plan],
219
  )
220
- # Handle search submission: update search results and sources; maintain other states unchanged
221
- search_query.submit(
222
- lambda q, domain, chat_hist, chat_pairs, srcs, pl: run_search(
223
- q, chat_hist, chat_pairs, srcs, pl, num_results=5, domain_filter=domain
224
- ),
225
- inputs=[search_query, domain_filter, state_chat_history, state_chat_pairs, state_sources, state_plan],
226
- outputs=[search_results, state_chat_history, state_chat_pairs, state_sources, state_plan],
227
- )
228
  # Finalize outline button: generate course plan and store it
229
  finalize_btn.click(
230
  finalize_outline,
 
187
  with gr.Blocks() as demo:
188
  gr.Markdown(
189
  """# Course Creator Agent
190
+ Chat with the assistant to brainstorm your course idea. You can ask the assistant to search the internet directly in the chat. When you're ready, click **Finalize Outline** to generate a course plan. Then generate the final course package (ZIP)."""
191
  )
192
  # Chat interface components
193
  # Use 'messages' type for Chatbot. The Chatbot expects a list of message dictionaries
194
  # (e.g. {"role": "user", "content": "..."}) when type="messages".
195
  chatbot = gr.Chatbot(label="Conversation", type="messages")
196
  msg_input = gr.Textbox(label="Your message", placeholder="Type your message and press Enter", lines=1)
197
+ # Buttons and outputs (search is triggered via chat; no separate search controls)
 
 
 
 
 
 
198
  finalize_btn = gr.Button("Finalize Outline")
199
  plan_output = gr.Textbox(label="Course outline", interactive=False)
200
  generate_btn = gr.Button("Generate Course Package")
 
211
  # First output goes to the Chatbot; we return the updated chat history (list of messages)
212
  outputs=[chatbot, state_chat_history, state_chat_pairs, state_sources, state_plan],
213
  )
 
 
 
 
 
 
 
 
214
  # Finalize outline button: generate course plan and store it
215
  finalize_btn.click(
216
  finalize_outline,