anhkhoiphan commited on
Commit
e95b84e
·
verified ·
1 Parent(s): 3e11cbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -317,6 +317,12 @@ class UIService:
317
  cl.Action(name="show_packages", value="packages", label="📦 Gói sản phẩm", payload={"action": "packages"}),
318
  cl.Action(name="change_model", value="model", label="🔄 Đổi model", payload={"action": "model"}),
319
  ]
 
 
 
 
 
 
320
 
321
  @staticmethod
322
  async def send_message_with_buttons(content: str, actions=None, author="assistant"):
@@ -338,7 +344,7 @@ class UIService:
338
  # Typing animation frames
339
  typing_frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
340
 
341
- for i in range(8): # Show animation for ~2 seconds
342
  frame = typing_frames[i % len(typing_frames)]
343
  msg.content = f"{frame} Đang suy nghĩ..."
344
  await msg.update()
@@ -361,9 +367,9 @@ async def on_chat_start():
361
  ).send()
362
 
363
  # Create initial action buttons
364
- actions = UIService.create_action_buttons()
365
  await cl.Message(
366
- content="Sử dụng các nút bên dưới để:",
367
  actions=actions,
368
  author="assistant"
369
  ).send()
 
317
  cl.Action(name="show_packages", value="packages", label="📦 Gói sản phẩm", payload={"action": "packages"}),
318
  cl.Action(name="change_model", value="model", label="🔄 Đổi model", payload={"action": "model"}),
319
  ]
320
+
321
+ def create_start_buttons():
322
+ """Create start buttons"""
323
+ return [
324
+ cl.Action(name="change_model", value="model", label="🔄 Đổi model", payload={"action": "model"}),
325
+ ]
326
 
327
  @staticmethod
328
  async def send_message_with_buttons(content: str, actions=None, author="assistant"):
 
344
  # Typing animation frames
345
  typing_frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
346
 
347
+ for i in range(27): # Show animation for ~2 seconds
348
  frame = typing_frames[i % len(typing_frames)]
349
  msg.content = f"{frame} Đang suy nghĩ..."
350
  await msg.update()
 
367
  ).send()
368
 
369
  # Create initial action buttons
370
+ actions = UIService.create_start_buttons()
371
  await cl.Message(
372
+ content="Sử dụng nút bên dưới để đổi mô hình:",
373
  actions=actions,
374
  author="assistant"
375
  ).send()