fix: remove no-agent message that was incorrectly triggering for pipeline start agents (#245)

- Removed 'Hi! To get started with chatting with your Assistant please create an agent first!' message feature
- Pipelines can now be set as start agents without triggering this error message
- Removed checks from emitGreetingTurn() and streamResponse() functions
- System now handles all agent types properly as start agents
This commit is contained in:
Tushar 2025-09-12 18:32:23 +05:30 committed by GitHub
parent 458302fc43
commit 3c4e0473b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -379,20 +379,6 @@ function mapConfig(workflow: z.infer<typeof Workflow>): {
}
async function* emitGreetingTurn(logger: PrefixLogger, workflow: z.infer<typeof Workflow>): AsyncIterable<z.infer<typeof ZOutMessage>> {
// Check if there are no agents or no start agent
if (workflow.agents.length === 0 || !workflow.startAgent) {
logger.log(`no agents available, emitting no-agent message`);
// emit no-agent message
yield* emitEvent(logger, {
role: 'assistant',
content: 'Hi! To get started with chatting with your Assistant please create an agent first!',
agentName: 'System',
responseType: 'external',
});
return;
}
// find the greeting prompt
const prompt = workflow.prompts.find(p => p.type === 'greeting')?.prompt || 'How can I help you today?';
logger.log(`greeting turn: ${prompt}`);
@ -1288,20 +1274,6 @@ export async function* streamResponse(
logger.log(`start agent: ${workflow.startAgent}`);
logger.log(`=== END CONFIGURATION ===`);
// Check if there are no agents or no start agent
if (Object.keys(agentConfig).length === 0 || !workflow.startAgent) {
logger.log(`no agents available, emitting no-agent message`);
// emit no-agent message
yield* emitEvent(logger, {
role: 'assistant',
content: 'Hi! To get started with chatting with your Assistant please create an agent first!',
agentName: 'System',
responseType: 'external',
});
return;
}
const stack: string[] = [];
logger.log(`initialized stack: ${JSON.stringify(stack)}`);
@ -1324,20 +1296,6 @@ export async function* streamResponse(
const startOfTurnAgentName = getStartOfTurnAgentName(logger, messages, agentConfig, pipelineConfig, workflow);
logger.log(`🎯 START AGENT DECISION: ${startOfTurnAgentName}`);
// Additional safety check - if startOfTurnAgentName is empty or invalid, return no-agent message
if (!startOfTurnAgentName || !agentConfig[startOfTurnAgentName]) {
logger.log(`invalid start agent name: ${startOfTurnAgentName}, emitting no-agent message`);
// emit no-agent message
yield* emitEvent(logger, {
role: 'assistant',
content: 'Hi! To get started with chatting with your Assistant please create an agent first!',
agentName: 'System',
responseType: 'external',
});
return;
}
let agentName: string | null = startOfTurnAgentName;
// start the turn loop