mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-15 20:08:18 +08:00
fix(cron): rename conversation id prefix from 'cron:' to 'cron_' (issue #36)
This commit is contained in:
parent
0a5b1989f3
commit
7cfb511948
@ -60,7 +60,7 @@ public class CronJobLifecycleService {
|
|||||||
public CronJobRunEntity startRun(CronJobEntity job, String userMessage, String triggerType) {
|
public CronJobRunEntity startRun(CronJobEntity job, String userMessage, String triggerType) {
|
||||||
CronJobRunEntity run = new CronJobRunEntity();
|
CronJobRunEntity run = new CronJobRunEntity();
|
||||||
run.setCronJobId(job.getId());
|
run.setCronJobId(job.getId());
|
||||||
run.setConversationId("cron:" + job.getId());
|
run.setConversationId("cron_" + job.getId());
|
||||||
run.setStatus("running");
|
run.setStatus("running");
|
||||||
run.setTriggerType(triggerType != null ? triggerType : "scheduled");
|
run.setTriggerType(triggerType != null ? triggerType : "scheduled");
|
||||||
run.setStartedAt(LocalDateTime.now());
|
run.setStartedAt(LocalDateTime.now());
|
||||||
@ -101,7 +101,7 @@ public class CronJobLifecycleService {
|
|||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
public void finishRunAndPublish(CronJobEntity job, CronJobRunEntity run,
|
public void finishRunAndPublish(CronJobEntity job, CronJobRunEntity run,
|
||||||
String userMessage, AssistantMessage result) {
|
String userMessage, AssistantMessage result) {
|
||||||
String convId = "cron:" + job.getId();
|
String convId = "cron_" + job.getId();
|
||||||
String text = result != null && result.getText() != null ? result.getText() : "";
|
String text = result != null && result.getText() != null ? result.getText() : "";
|
||||||
|
|
||||||
runMapper.update(null, new LambdaUpdateWrapper<CronJobRunEntity>()
|
runMapper.update(null, new LambdaUpdateWrapper<CronJobRunEntity>()
|
||||||
|
|||||||
@ -82,7 +82,7 @@ public class CronJobRunner {
|
|||||||
// any DB connection during this call.
|
// any DB connection during this call.
|
||||||
AssistantMessage result;
|
AssistantMessage result;
|
||||||
try {
|
try {
|
||||||
ChatOrigin origin = originFactory.from(job, "cron:" + job.getId());
|
ChatOrigin origin = originFactory.from(job, "cron_" + job.getId());
|
||||||
result = runAgent(job, userMessage, origin);
|
result = runAgent(job, userMessage, origin);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[CronRunner] runAgent failed for job {}: {}", job.getId(), e.getMessage(), 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) {
|
private AssistantMessage runAgent(CronJobEntity job, String userMessage, ChatOrigin origin) {
|
||||||
String guarded = wrapWithDeliveryGuard(userMessage, origin);
|
String guarded = wrapWithDeliveryGuard(userMessage, origin);
|
||||||
String text = "agent".equals(job.getTaskType())
|
String text = "agent".equals(job.getTaskType())
|
||||||
? agentService.execute(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);
|
: agentService.chat(job.getAgentId(), guarded, "cron_" + job.getId(), origin);
|
||||||
return new AssistantMessage(text != null ? text : "");
|
return new AssistantMessage(text != null ? text : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1494,7 +1494,7 @@ export default {
|
|||||||
updateSuccess: 'Cron job updated',
|
updateSuccess: 'Cron job updated',
|
||||||
deleteSuccess: 'Cron job deleted',
|
deleteSuccess: 'Cron job deleted',
|
||||||
deleteConfirm: 'Delete job "{name}"? This cannot be undone.',
|
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',
|
enableSuccess: 'Job enabled',
|
||||||
disableSuccess: 'Job disabled',
|
disableSuccess: 'Job disabled',
|
||||||
invalidCron: 'Invalid cron expression. Use 5-field format (min hour day month weekday).',
|
invalidCron: 'Invalid cron expression. Use 5-field format (min hour day month weekday).',
|
||||||
|
|||||||
@ -1504,7 +1504,7 @@ export default {
|
|||||||
updateSuccess: '定时任务更新成功',
|
updateSuccess: '定时任务更新成功',
|
||||||
deleteSuccess: '定时任务删除成功',
|
deleteSuccess: '定时任务删除成功',
|
||||||
deleteConfirm: '确定删除任务「{name}」?删除后不可恢复。',
|
deleteConfirm: '确定删除任务「{name}」?删除后不可恢复。',
|
||||||
runTriggered: '任务已触发,请到会话列表查看「cron:{id}」对应对话',
|
runTriggered: '任务已触发,请到会话列表查看「cron_{id}」对应对话',
|
||||||
enableSuccess: '任务已启用',
|
enableSuccess: '任务已启用',
|
||||||
disableSuccess: '任务已停用',
|
disableSuccess: '任务已停用',
|
||||||
invalidCron: 'Cron 表达式格式不正确,请使用 5 字段格式(分 时 日 月 周)',
|
invalidCron: 'Cron 表达式格式不正确,请使用 5 字段格式(分 时 日 月 周)',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user