diff --git a/frontend/src/views/scheduled-tasks/index.vue b/frontend/src/views/scheduled-tasks/index.vue index 9f57dba..a0074d9 100644 --- a/frontend/src/views/scheduled-tasks/index.vue +++ b/frontend/src/views/scheduled-tasks/index.vue @@ -36,14 +36,19 @@ const form = reactive({ webhook_method: 'POST', webhook_headers: {}, script_content: `# 示例脚本 -# 可用函数: log, print, ai, dingtalk, wecom, http_get, http_post, db_query -# 可用函数: get_var, set_var, del_var, get_param, get_params -# 可用函数: get_tenants, get_tenant_config, get_all_tenant_configs, get_secret -# 可用变量: task_id, tenant_id, trace_id -# 可用库: json, re, math, random, datetime, timedelta +# 注意:不需要 import!以下模块已内置可直接使用 +# 内置函数: log, print, ai, dingtalk, wecom, http_get, http_post, db_query +# 内置函数: get_var, set_var, del_var, get_param, get_params +# 内置函数: get_tenants, get_tenant_config, get_all_tenant_configs, get_secret +# 内置变量: task_id, tenant_id, trace_id +# 内置模块: json, re, math, random, hashlib, base64, datetime, date, timedelta log('任务开始执行') +# 获取当前时间(datetime 已内置,无需 import) +now = datetime.now().strftime('%Y-%m-%d %H:%M:%S') +log(f'执行时间: {now}') + # 获取参数 prompt = get_param('prompt', '默认提示词') log(f'参数: {prompt}') @@ -173,9 +178,13 @@ function handleCreate() { webhook_url: '', webhook_method: 'POST', webhook_headers: {}, - script_content: `# 示例脚本 + script_content: `# 示例脚本(无需 import,模块已内置) log('任务开始执行') +# 获取当前时间 +now = datetime.now().strftime('%H:%M:%S') +log(f'执行时间: {now}') + # 获取参数 prompt = get_param('prompt', '默认提示词')