fix: add missing spaces in cron prompt and replace deprecated utcnow() (#6192)
1. Fix missing spaces in cron job wake prompt string concatenation. Python implicit string concatenation produced: "...scheduled taskProceed..." and "...conversation.After..." which sent garbled instructions to the LLM agent, causing unreliable cron job execution. 2. Replace deprecated datetime.utcnow() with datetime.now(datetime.timezone.utc) in JWT generation. utcnow() is deprecated since Python 3.12 and returns naive datetime which can cause incorrect token expiry on non-UTC systems. Closes #6103 Closes #6165 Co-authored-by: easonysliu <easonysliu@tencent.com>
This commit is contained in:
@@ -332,9 +332,9 @@ class CronJobManager:
|
||||
cron_job=cron_job_str
|
||||
)
|
||||
req.prompt = (
|
||||
"You are now responding to a scheduled task"
|
||||
"You are now responding to a scheduled task. "
|
||||
"Proceed according to your system instructions. "
|
||||
"Output using same language as previous conversation."
|
||||
"Output using same language as previous conversation. "
|
||||
"After completing your task, summarize and output your actions and results."
|
||||
)
|
||||
if not req.func_tool:
|
||||
|
||||
@@ -82,7 +82,7 @@ class AuthRoute(Route):
|
||||
def generate_jwt(self, username):
|
||||
payload = {
|
||||
"username": username,
|
||||
"exp": datetime.datetime.utcnow() + datetime.timedelta(days=7),
|
||||
"exp": datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=7),
|
||||
}
|
||||
jwt_token = self.config["dashboard"].get("jwt_secret", None)
|
||||
if not jwt_token:
|
||||
|
||||
Reference in New Issue
Block a user