fix(cron): rename conversation id prefix from 'cron:' to 'cron_' (issue #36)

This commit is contained in:
matevip 2026-04-29 15:58:43 +08:00
parent 0a5b1989f3
commit 7cfb511948
4 changed files with 7 additions and 7 deletions

View File

@ -60,7 +60,7 @@ public class CronJobLifecycleService {
public CronJobRunEntity startRun(CronJobEntity job, String userMessage, String triggerType) {
CronJobRunEntity run = new CronJobRunEntity();
run.setCronJobId(job.getId());
run.setConversationId("cron:" + job.getId());
run.setConversationId("cron_" + job.getId());
run.setStatus("running");
run.setTriggerType(triggerType != null ? triggerType : "scheduled");
run.setStartedAt(LocalDateTime.now());
@ -101,7 +101,7 @@ public class CronJobLifecycleService {
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void finishRunAndPublish(CronJobEntity job, CronJobRunEntity run,
String userMessage, AssistantMessage result) {
String convId = "cron:" + job.getId();
String convId = "cron_" + job.getId();
String text = result != null && result.getText() != null ? result.getText() : "";
runMapper.update(null, new LambdaUpdateWrapper<CronJobRunEntity>()

View File

@ -82,7 +82,7 @@ public class CronJobRunner {
// any DB connection during this call.
AssistantMessage result;
try {
ChatOrigin origin = originFactory.from(job, "cron:" + job.getId());
ChatOrigin origin = originFactory.from(job, "cron_" + job.getId());
result = runAgent(job, userMessage, origin);
} catch (Exception e) {
log.error("[CronRunner] runAgent failed for job {}: {}", job.getId(), e.getMessage(), e);
@ -120,8 +120,8 @@ public class CronJobRunner {
private AssistantMessage runAgent(CronJobEntity job, String userMessage, ChatOrigin origin) {
String guarded = wrapWithDeliveryGuard(userMessage, origin);
String text = "agent".equals(job.getTaskType())
? agentService.execute(job.getAgentId(), guarded, "cron:" + job.getId(), origin)
: agentService.chat(job.getAgentId(), guarded, "cron:" + job.getId(), origin);
? agentService.execute(job.getAgentId(), guarded, "cron_" + job.getId(), origin)
: agentService.chat(job.getAgentId(), guarded, "cron_" + job.getId(), origin);
return new AssistantMessage(text != null ? text : "");
}

View File

@ -1494,7 +1494,7 @@ export default {
updateSuccess: 'Cron job updated',
deleteSuccess: 'Cron job deleted',
deleteConfirm: 'Delete job "{name}"? This cannot be undone.',
runTriggered: 'Job triggered. Check conversation "cron:{id}" for results.',
runTriggered: 'Job triggered. Check conversation "cron_{id}" for results.',
enableSuccess: 'Job enabled',
disableSuccess: 'Job disabled',
invalidCron: 'Invalid cron expression. Use 5-field format (min hour day month weekday).',

View File

@ -1504,7 +1504,7 @@ export default {
updateSuccess: '定时任务更新成功',
deleteSuccess: '定时任务删除成功',
deleteConfirm: '确定删除任务「{name}」?删除后不可恢复。',
runTriggered: '任务已触发请到会话列表查看「cron:{id}」对应对话',
runTriggered: '任务已触发请到会话列表查看「cron_{id}」对应对话',
enableSuccess: '任务已启用',
disableSuccess: '任务已停用',
invalidCron: 'Cron 表达式格式不正确,请使用 5 字段格式(分 时 日 月 周)',