feat: refine business chat workflow
This commit is contained in:
@@ -7,6 +7,7 @@ import { getOpenClawConfigDir } from '../../utils/paths';
|
||||
import { resolveAccountIdFromSessionHistory } from '../../utils/session-util';
|
||||
import { toOpenClawChannelType, toUiChannelType } from '../../utils/channel-alias';
|
||||
import { resolveAgentIdFromChannel } from '../../utils/agent-config';
|
||||
import { stripBusinessResponseGuidance } from '../../../shared/business-guidance';
|
||||
|
||||
/**
|
||||
* Find agentId from session history by delivery "to" address.
|
||||
@@ -296,7 +297,7 @@ export function buildCronSessionFallbackMessages(params: {
|
||||
});
|
||||
|
||||
const messages: CronSessionFallbackMessage[] = [];
|
||||
const prompt = params.job?.payload?.message || params.job?.payload?.text || '';
|
||||
const prompt = stripBusinessResponseGuidance(params.job?.payload?.message || params.job?.payload?.text || '');
|
||||
const taskName = params.job?.name?.trim()
|
||||
|| params.sessionEntry?.label?.replace(/^Cron:\s*/, '').trim()
|
||||
|| '';
|
||||
@@ -421,7 +422,7 @@ function buildCronUpdatePatch(input: Record<string, unknown>): Record<string, un
|
||||
}
|
||||
|
||||
if (typeof patch.message === 'string') {
|
||||
patch.payload = { kind: 'agentTurn', message: patch.message };
|
||||
patch.payload = { kind: 'agentTurn', message: stripBusinessResponseGuidance(patch.message) };
|
||||
delete patch.message;
|
||||
}
|
||||
|
||||
@@ -487,7 +488,7 @@ async function resolveRecoveredCronRunAfterError(ctx: HostApiContext, jobId: str
|
||||
}
|
||||
|
||||
function transformCronJob(job: GatewayCronJob, resolvedLastRun?: CronRunLogEntry) {
|
||||
const message = job.payload?.message || job.payload?.text || '';
|
||||
const message = stripBusinessResponseGuidance(job.payload?.message || job.payload?.text || '');
|
||||
const gatewayDelivery = normalizeCronDelivery(job.delivery);
|
||||
const channelType = gatewayDelivery.channel ? toUiChannelType(gatewayDelivery.channel) : undefined;
|
||||
const delivery = channelType
|
||||
@@ -752,7 +753,7 @@ export async function handleCronRoutes(
|
||||
const result = await ctx.gatewayManager.rpc('cron.add', {
|
||||
name: input.name,
|
||||
schedule: { kind: 'cron', expr: input.schedule },
|
||||
payload: { kind: 'agentTurn', message: input.message },
|
||||
payload: { kind: 'agentTurn', message: stripBusinessResponseGuidance(input.message) },
|
||||
enabled: input.enabled ?? true,
|
||||
wakeMode: 'next-heartbeat',
|
||||
sessionTarget: 'isolated',
|
||||
|
||||
Reference in New Issue
Block a user