Liss, Alex (NYC-HUG) commited on
Commit
af031a0
Β·
1 Parent(s): 3ab0381

added radio button, no functionality yet

Browse files
docs/Phase 1/Task 1.3 Memory & Persona Implementation.md CHANGED
@@ -100,7 +100,7 @@ The user will execute **one step at a time** and confirm each works before proce
100
  - "Successfully loaded message history from Zep"
101
  βœ… Agent now has access to the pre-existing context in Zep, and the application works without errors
102
 
103
- **TODO:**
104
  - Implement persona-specific behavior based on user context
105
  - Currently we're loading conversation history successfully, but the agent's responses aren't explicitly personalized based on the casual/super fan persona context
106
  - We should update agent system prompts to explicitly use facts from Zep memory when responding to questions
@@ -113,6 +113,21 @@ The user will execute **one step at a time** and confirm each works before proce
113
  * Insert a Gradio **Radio** with options **Casual Fan** / **Super Fan**.
114
  * Initially the button **does nothing**β€”just proves the UI renders.
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  ---
117
 
118
  ### 5 β”‚ Wire Radio β†’ Session ID
@@ -161,7 +176,18 @@ The user will execute **one step at a time** and confirm each works before proce
161
  | 5 | Missing env variables | At startup, assert `ZEP_API_KEY` is set; show clear error if not. |
162
  | 6 | Session ID mismatch | Verify that session IDs in code match those actually created in Zep Cloud. |
163
  | 7 | Message history creation | Ensure messages follow proper format for Zep; implement fallbacks if message history retrieval fails. |
164
- | 8 | Library compatibility issues | Use direct API calls to workaround parameter inconsistencies; maintain fallbacks for memory initialization to avoid breaking the application when parameters change. |
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  ---
167
 
 
100
  - "Successfully loaded message history from Zep"
101
  βœ… Agent now has access to the pre-existing context in Zep, and the application works without errors
102
 
103
+ **TODO for later / backlog:**
104
  - Implement persona-specific behavior based on user context
105
  - Currently we're loading conversation history successfully, but the agent's responses aren't explicitly personalized based on the casual/super fan persona context
106
  - We should update agent system prompts to explicitly use facts from Zep memory when responding to questions
 
113
  * Insert a Gradio **Radio** with options **Casual Fan** / **Super Fan**.
114
  * Initially the button **does nothing**β€”just proves the UI renders.
115
 
116
+ **Status Update:**
117
+ βœ… Successfully added a Radio button component to the UI with "Casual Fan" and "Super Fan" options
118
+ βœ… Placed the component in the input row alongside the text input and send button
119
+ βœ… Added an event handler function that logs selection changes but doesn't modify functionality yet
120
+ βœ… Ensured the component is interactive and clickable by connecting the change event
121
+ βœ… Verified the implementation works without affecting existing functionality
122
+ βœ… Followed the principle of keeping related code together (implementing handler function immediately after component definition)
123
+
124
+ **Implementation Approach:**
125
+ 1. Added the radio button to the existing input row with appropriate scaling
126
+ 2. Created a simple event handler function directly after the component definition
127
+ 3. Connected the handler to the radio button's change event
128
+ 4. Tested to ensure the radio component is interactive and logs selections
129
+ 5. Confirmed no impact to existing features
130
+
131
  ---
132
 
133
  ### 5 β”‚ Wire Radio β†’ Session ID
 
176
  | 5 | Missing env variables | At startup, assert `ZEP_API_KEY` is set; show clear error if not. |
177
  | 6 | Session ID mismatch | Verify that session IDs in code match those actually created in Zep Cloud. |
178
  | 7 | Message history creation | Ensure messages follow proper format for Zep; implement fallbacks if message history retrieval fails. |
179
+ | 8 | Library compatibility issues | Use direct API calls to workaround LangChain <-> Zep parameter inconsistencies; maintain fallbacks for memory initialization to avoid breaking the application when parameters change. |
180
+
181
+ ---
182
+
183
+ ## First Principles for AI Development
184
+
185
+ | Principle | Description | Example |
186
+ |-----------|-------------|---------|
187
+ | Code Locality | Keep related code together for improved readability and maintenance | Placing event handlers immediately after their components |
188
+ | Development Workflow | Follow a structured pattern: read instructions β†’ develop plan β†’ review with user β†’ execute after approval | Presented radio button implementation plan before making changes |
189
+ | Minimal Surgical Changes | Make the smallest possible changes to achieve the goal with minimal risk | Added only the necessary code for the radio button without modifying existing functionality |
190
+ | Rigorous Testing | Test changes immediately after implementation to catch issues early | Ran the application after adding the radio button to verify it works |
191
 
192
  ---
193
 
gradio_app.py CHANGED
@@ -309,13 +309,30 @@ with gr.Blocks(title="49ers FanAI Hub", css=css) as demo:
309
 
310
  # Input components
311
  with gr.Row():
 
 
 
 
 
 
 
312
  msg = gr.Textbox(
313
  placeholder="Ask me about the 49ers...",
314
  show_label=False,
315
- scale=9
316
  )
317
  submit_btn = gr.Button("Send", scale=1) # Renamed for clarity
318
 
 
 
 
 
 
 
 
 
 
 
319
  # Define a combined function for user input and bot response
320
  async def process_and_respond(message, history):
321
  """Process user input, get agent response, check for components, and update history."""
 
309
 
310
  # Input components
311
  with gr.Row():
312
+ # Add persona selection radio button (Step 4) - initially doesn't do anything
313
+ persona_radio = gr.Radio(
314
+ choices=["Casual Fan", "Super Fan"],
315
+ value="Casual Fan", # Default to Casual Fan
316
+ label="Select Persona",
317
+ scale=3
318
+ )
319
  msg = gr.Textbox(
320
  placeholder="Ask me about the 49ers...",
321
  show_label=False,
322
+ scale=6
323
  )
324
  submit_btn = gr.Button("Send", scale=1) # Renamed for clarity
325
 
326
+ # Handle persona selection changes - Step 4 (skeleton only)
327
+ def on_persona_change(persona_choice):
328
+ """Handle changes to the persona selection radio button - Step 4 (skeleton only)"""
329
+ print(f"Persona changed to: {persona_choice}")
330
+ # In Step 4, this doesn't actually do anything yet, just logs the selection
331
+ return persona_choice
332
+
333
+ # Set up persona change event listener
334
+ persona_radio.change(on_persona_change, inputs=[persona_radio], outputs=[])
335
+
336
  # Define a combined function for user input and bot response
337
  async def process_and_respond(message, history):
338
  """Process user input, get agent response, check for components, and update history."""