From 6a98cd89ec5a6ac3e3e18a7a29589232a2bc062a Mon Sep 17 00:00:00 2001 From: caohuipeng Date: Mon, 18 May 2026 15:53:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?npm=20run=20build=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/services/schedule/scheduler_service.py | 17 ++++++++++++++++- frontend/dist/index.html | 9 ++------- frontend/src/views/AdminView.vue | 12 ++++++------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/backend/app/services/schedule/scheduler_service.py b/backend/app/services/schedule/scheduler_service.py index 1a24f751..8fe14e29 100644 --- a/backend/app/services/schedule/scheduler_service.py +++ b/backend/app/services/schedule/scheduler_service.py @@ -119,6 +119,14 @@ def run_task_now(task: ScheduleTask, *, trigger_type: str, triggered_by_user_id: db.session.add(run) db.session.commit() + if task.cron_expr and trigger_type == "cron": + try: + iter = croniter(task.cron_expr, datetime.utcnow()) + task.next_run_at = iter.get_next(datetime) + except Exception: + task.next_run_at = None + db.session.commit() + start_ts = time.time() try: executor = resolve_schedule_executor(task) @@ -216,6 +224,13 @@ def start_scheduler(app): if not bool(app.config.get("SCHEDULE_WORKER_ENABLED", True)): return + import os + if os.environ.get('WERKZEUG_RUN_MAIN') == 'true' or not app.debug: + pass + else: + _worker_started = False + return + def _loop(): with app.app_context(): while True: @@ -225,7 +240,7 @@ def start_scheduler(app): ScheduleTask.enabled.is_(True), ScheduleTask.next_run_at.isnot(None), ScheduleTask.next_run_at <= now, - ).limit(5).all() + ).limit(5).with_for_update(skip_locked=True).all() for task in due_tasks: try: run_task_now(task, trigger_type="cron", triggered_by_user_id=None) diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 5efd4cf6..cf2f4555 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -10,13 +10,8 @@ AI工作台 -<<<<<<< Updated upstream - - -======= - - ->>>>>>> Stashed changes + +
diff --git a/frontend/src/views/AdminView.vue b/frontend/src/views/AdminView.vue index 864cff5b..2d621f9c 100644 --- a/frontend/src/views/AdminView.vue +++ b/frontend/src/views/AdminView.vue @@ -20,7 +20,7 @@ import { loadReportLayoutPref, saveReportLayoutPref } from '../composables/useRe import { useGlobalMessageDialog } from '../composables/useGlobalMessageDialog'; import { buildWecomAuditMeta, formatWecomAuditReason } from '../utils/wecom'; import { getAuthHeaders } from '../utils/auth'; -import { listAdminSchedules, createAdminSchedule, updateAdminSchedule, deleteAdminSchedule, toggleAdminSchedule, runAdminSchedule, listAdminScheduleRuns, adminRunExcelUrl, type ScheduleTask, type ScheduleRun } from '../api/schedule'; +import { listAdminSchedules, createAdminSchedule, updateAdminSchedule, deleteAdminSchedule, toggleAdminSchedule, runAdminSchedule, listAdminScheduleRuns, type ScheduleTask, type ScheduleRun } from '../api/schedule'; import { ArrowLeft, // Save, @@ -489,11 +489,11 @@ const scheduleNextRunPreview = computed(() => { const parts = expr.trim().split(/\s+/); if (parts.length !== 5) return null; const now = new Date(); - const minuteRaw = parts[0]; - const hourRaw = parts[1]; - const dayOfMonth = parts[2]; - const month = parts[3]; - const dayOfWeek = parts[4]; + const minuteRaw = parts[0]!; + const hourRaw = parts[1]!; + const dayOfMonth = parts[2]!; + const month = parts[3]!; + const dayOfWeek = parts[4]!; if (month !== '*') return null; if (dayOfMonth !== '*' && dayOfWeek !== '*') return null; const minute = minuteRaw.startsWith('*/') ? undefined : parseInt(minuteRaw, 10); From bd453e408cb5723373a69f132bf8b467fc599232 Mon Sep 17 00:00:00 2001 From: sophie <16087569+sophie_liang@user.noreply.gitee.com> Date: Mon, 18 May 2026 15:58:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9HR=20SQL=20Server?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.shared b/.env.shared index 5bd20005..54a87a42 100644 --- a/.env.shared +++ b/.env.shared @@ -58,7 +58,7 @@ HR_SQLSERVER_PORT=1433 HR_SQLSERVER_DATABASE=NH_N8_HEXIN HR_SQLSERVER_USERNAME=AI_Knowledge_Base_Hr HR_SQLSERVER_PASSWORD=hoo-thai@123_AI_HR -HR_SQLSERVER_DRIVER=SQL Server +HR_SQLSERVER_DRIVER=ODBC Driver 18 for SQL Server HR_SQLSERVER_ENCRYPT=no HR_SQLSERVER_TRUST_CERT=yes HR_SQLSERVER_TIMEOUT=10 From 655d7e3d7dc3cf5a744d814b84741f432a0907cd Mon Sep 17 00:00:00 2001 From: sophie <16087569+sophie_liang@user.noreply.gitee.com> Date: Mon, 18 May 2026 16:33:37 +0800 Subject: [PATCH 3/3] fix: merge chatlog and schedule heads for db migration --- ...2bd24e_merge_chatlog_and_schedule_heads.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 backend/migrations/versions/c0ae052bd24e_merge_chatlog_and_schedule_heads.py diff --git a/backend/migrations/versions/c0ae052bd24e_merge_chatlog_and_schedule_heads.py b/backend/migrations/versions/c0ae052bd24e_merge_chatlog_and_schedule_heads.py new file mode 100644 index 00000000..01cb6528 --- /dev/null +++ b/backend/migrations/versions/c0ae052bd24e_merge_chatlog_and_schedule_heads.py @@ -0,0 +1,24 @@ +"""merge chatlog and schedule heads + +Revision ID: c0ae052bd24e +Revises: 1ebc0253f9f6, f6d4e5f6a7b8 +Create Date: 2026-05-18 16:32:50.696073 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'c0ae052bd24e' +down_revision = ('1ebc0253f9f6', 'f6d4e5f6a7b8') +branch_labels = None +depends_on = None + + +def upgrade(): + pass + + +def downgrade(): + pass