ChienChung commited on
Commit
2dd7dec
·
verified ·
1 Parent(s): e4c9a4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -499,18 +499,24 @@ def get_time_tool2(query: str) -> datetime:
499
  ]
500
 
501
  # 加入 local time 說明在 Examples 區段
502
- examples_header = f"### Examples (based on current local time: {now.strftime('%Y-%m-%d %H:%M:%S')} in {location}):"
 
 
 
 
503
  examples_str = "\n".join([f'User Query: "{q}" → {dt.strftime("%Y-%m-%d %H:%M:%S")}' for q, dt in examples])
504
 
 
505
  # Step 4: 构建完整 prompt
506
  time_query_prompt = f"""
507
  You are a timezone-aware time reasoner. Based on the user's query, calculate the **exact target time** they are referring to.
508
- The current local time in {location} is: {now.strftime('%A')}, {now.strftime('%Y-%m-%d %H:%M:%S')} (timezone: {tz_str})
 
509
 
510
  Please return the result in this **exact format**: `YYYY-MM-DD HH:MM:SS` (24-hour clock, no timezone info).
511
  Only return the time string — no explanation, no extra words.
512
 
513
- {examples_header}
514
  {examples_str}
515
 
516
  ### Now process:
 
499
  ]
500
 
501
  # 加入 local time 說明在 Examples 區段
502
+ examples_header = f"""Assume the current local time in {location} is exactly:
503
+ **{now.strftime('%Y-%m-%d %H:%M:%S')}** (timezone: {tz_str})
504
+
505
+ Use this exact time to reason all examples below.
506
+ """
507
  examples_str = "\n".join([f'User Query: "{q}" → {dt.strftime("%Y-%m-%d %H:%M:%S")}' for q, dt in examples])
508
 
509
+ # Step 4: 构建完整 prompt
510
  # Step 4: 构建完整 prompt
511
  time_query_prompt = f"""
512
  You are a timezone-aware time reasoner. Based on the user's query, calculate the **exact target time** they are referring to.
513
+ Remember: all relative expressions like "later", "in 2 hours", "tomorrow" must be strictly calculated based on the current local time above.
514
+ {examples_header}
515
 
516
  Please return the result in this **exact format**: `YYYY-MM-DD HH:MM:SS` (24-hour clock, no timezone info).
517
  Only return the time string — no explanation, no extra words.
518
 
519
+ ### Examples:
520
  {examples_str}
521
 
522
  ### Now process: