alex4cip Claude commited on
Commit
0155077
Β·
1 Parent(s): c3dd276

feat: Add thinking indicator during bot response generation

Browse files

UX improvement: Show loading state while generating response

✨ Enhancement:
- Display "πŸ€” 응닡 생성 쀑..." message immediately after user input
- Replaced by actual bot response when generation completes
- Improves user feedback during wait time

🎯 User Experience Flow:
1. User sends message β†’ Message displays instantly
2. "πŸ€” 응닡 생성 쀑..." appears β†’ User knows bot is working
3. Bot response ready β†’ Thinking indicator replaced with response

πŸ“ Implementation:
- Added intermediate yield with thinking indicator
- Three-stage generator: user message β†’ thinking β†’ response
- Clear visual feedback throughout entire process

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -226,9 +226,12 @@ with gr.Blocks(title="πŸ€– Llama-2-Ko Chatbot") as demo:
226
  def submit(message, history):
227
  # Immediately show user message
228
  updated_history = history + [{"role": "user", "content": message}]
229
- # Return updated history first (shows user message immediately)
230
- # Then generate bot response
231
  yield updated_history, ""
 
 
 
 
 
232
  # Generate and add bot response
233
  final_history = chat_wrapper(message, history)
234
  yield final_history, ""
 
226
  def submit(message, history):
227
  # Immediately show user message
228
  updated_history = history + [{"role": "user", "content": message}]
 
 
229
  yield updated_history, ""
230
+
231
+ # Show "thinking" indicator
232
+ thinking_history = updated_history + [{"role": "assistant", "content": "πŸ€” 응닡 생성 쀑..."}]
233
+ yield thinking_history, ""
234
+
235
  # Generate and add bot response
236
  final_history = chat_wrapper(message, history)
237
  yield final_history, ""