Song commited on
Commit
4968d3d
·
1 Parent(s): 2083b0b
Files changed (2) hide show
  1. app.py +21 -7
  2. stripe_service.py +1 -1
app.py CHANGED
@@ -272,6 +272,17 @@ async def delete_user_profile(
272
  )
273
 
274
 
 
 
 
 
 
 
 
 
 
 
 
275
  # ====== Chat Endpoints ======
276
 
277
  class ChatRequestWithProfile(ChatRequest):
@@ -279,6 +290,15 @@ class ChatRequestWithProfile(ChatRequest):
279
  profile_id: Optional[str] = None
280
 
281
 
 
 
 
 
 
 
 
 
 
282
  @app.post("/api/chat")
283
  async def chat_with_assistant(
284
  request: ChatRequestWithProfile,
@@ -609,13 +629,7 @@ with gr.Blocks(title="銀髮餐桌助手") as gradio_demo:
609
  fn=gradio_chat,
610
  title="營養飲食諮詢",
611
  description="請輸入您的問題,例如:",
612
- examples=[
613
- "請問銀髮族應該如何補充蛋白質?",
614
- "我爸爸有糖尿病,飲食上有什麼需要注意的?",
615
- "推薦一些適合銀髮族的早餐選項",
616
- "什麼食物對骨骼健康有好處?",
617
- "如何製作軟嫩的料理?"
618
- ]
619
  )
620
 
621
  gr.Markdown(
 
272
  )
273
 
274
 
275
+ # ====== Chat Examples Configuration ======
276
+
277
+ CHAT_EXAMPLES = [
278
+ "請問銀髮族應該如何補充蛋白質?",
279
+ "我爸爸有糖尿病,飲食上有什麼需要注意的?",
280
+ "推薦一些適合銀髮族的早餐選項",
281
+ "什麼食物對骨骼健康有好處?",
282
+ "如何製作軟嫩的料理?"
283
+ ]
284
+
285
+
286
  # ====== Chat Endpoints ======
287
 
288
  class ChatRequestWithProfile(ChatRequest):
 
290
  profile_id: Optional[str] = None
291
 
292
 
293
+ @app.get("/api/chat/examples", response_model=List[str])
294
+ async def get_chat_examples():
295
+ """
296
+ Get the list of default example questions for the chat interface.
297
+ These examples are also used in the Gradio interface.
298
+ """
299
+ return CHAT_EXAMPLES
300
+
301
+
302
  @app.post("/api/chat")
303
  async def chat_with_assistant(
304
  request: ChatRequestWithProfile,
 
629
  fn=gradio_chat,
630
  title="營養飲食諮詢",
631
  description="請輸入您的問題,例如:",
632
+ examples=CHAT_EXAMPLES
 
 
 
 
 
 
633
  )
634
 
635
  gr.Markdown(
stripe_service.py CHANGED
@@ -91,7 +91,7 @@ def create_checkout_session_for_order(order, customer_email: str = None) -> str:
91
 
92
  # Create Stripe checkout session
93
  session_params = {
94
- payment_method_types=['card'],
95
  line_items=line_items,
96
  mode='payment',
97
  success_url=f"{settings.frontend_url}/order/success?session_id={{CHECKOUT_SESSION_ID}}",
 
91
 
92
  # Create Stripe checkout session
93
  session_params = {
94
+ 'payment_method_types': ['card'],
95
  line_items=line_items,
96
  mode='payment',
97
  success_url=f"{settings.frontend_url}/order/success?session_id={{CHECKOUT_SESSION_ID}}",