feat: refine business chat workflow
This commit is contained in:
@@ -68,7 +68,12 @@ describe('handleCronRoutes', () => {
|
||||
expect(handled).toBe(true);
|
||||
expect(rpc).toHaveBeenCalledWith('cron.add', expect.objectContaining({
|
||||
delivery: { mode: 'announce', channel: 'feishu', to: 'user:ou_weather' },
|
||||
payload: {
|
||||
kind: 'agentTurn',
|
||||
message: expect.stringContaining('Summarize today'),
|
||||
},
|
||||
}));
|
||||
expect((rpc.mock.calls[0]?.[1] as { payload: { message: string } }).payload.message).not.toContain('YINIAN_BUSINESS_RESPONSE_GUIDANCE');
|
||||
expect(sendJsonMock).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
200,
|
||||
@@ -114,10 +119,11 @@ describe('handleCronRoutes', () => {
|
||||
expect(rpc).toHaveBeenCalledWith('cron.update', {
|
||||
id: 'job-2',
|
||||
patch: {
|
||||
payload: { kind: 'agentTurn', message: 'Updated prompt' },
|
||||
payload: { kind: 'agentTurn', message: expect.stringContaining('Updated prompt') },
|
||||
delivery: { mode: 'announce', channel: 'feishu', to: 'user:ou_next' },
|
||||
},
|
||||
});
|
||||
expect((rpc.mock.calls[0]?.[1] as { patch: { payload: { message: string } } }).patch.payload.message).not.toContain('YINIAN_BUSINESS_RESPONSE_GUIDANCE');
|
||||
expect(sendJsonMock).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
200,
|
||||
@@ -247,12 +253,13 @@ describe('handleCronRoutes', () => {
|
||||
|
||||
it('builds cron fallback query and running messages as visible chat messages', async () => {
|
||||
const { buildCronSessionFallbackMessages } = await import('@electron/api/routes/cron');
|
||||
const { appendBusinessResponseGuidance } = await import('../../shared/business-guidance');
|
||||
|
||||
const messages = buildCronSessionFallbackMessages({
|
||||
sessionKey: 'agent:main:cron:job-running',
|
||||
job: {
|
||||
name: '写日报',
|
||||
payload: { kind: 'agentTurn', message: '生成今天的经营日报' },
|
||||
payload: { kind: 'agentTurn', message: appendBusinessResponseGuidance('生成今天的经营日报') },
|
||||
state: { runningAtMs: 1778650080011 },
|
||||
},
|
||||
runs: [],
|
||||
|
||||
Reference in New Issue
Block a user