mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-10-21 01:22:54 +00:00
🤝 fix: Normalize Empty Handoff Fields to Restore Default Fallback (#12707)
* fix(agents): normalize handoff prompt and parameter values to ensure default instructions * fix(agents): address lint errors and codex review comments
This commit is contained in:
parent
b579390287
commit
8f39f31c87
2 changed files with 14 additions and 6 deletions
|
|
@ -206,7 +206,9 @@ const AgentHandoffs: React.FC<AgentHandoffsProps> = ({ field, currentAgentId })
|
|||
placeholder={localize('com_ui_agent_handoff_description_placeholder')}
|
||||
value={edge.description || ''}
|
||||
onChange={(e) =>
|
||||
updateHandoffDetailsAt(idx, { description: e.target.value })
|
||||
updateHandoffDetailsAt(idx, {
|
||||
description: e.target.value === '' ? undefined : e.target.value,
|
||||
})
|
||||
}
|
||||
className="mt-1 h-8 text-sm"
|
||||
/>
|
||||
|
|
@ -223,7 +225,11 @@ const AgentHandoffs: React.FC<AgentHandoffsProps> = ({ field, currentAgentId })
|
|||
id={`handoff-prompt-${idx}`}
|
||||
placeholder={localize('com_ui_agent_handoff_prompt_placeholder')}
|
||||
value={typeof edge.prompt === 'string' ? edge.prompt : ''}
|
||||
onChange={(e) => updateHandoffDetailsAt(idx, { prompt: e.target.value })}
|
||||
onChange={(e) =>
|
||||
updateHandoffDetailsAt(idx, {
|
||||
prompt: e.target.value === '' ? undefined : e.target.value,
|
||||
})
|
||||
}
|
||||
className="mt-1 h-20 resize-none text-sm"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -241,7 +247,9 @@ const AgentHandoffs: React.FC<AgentHandoffsProps> = ({ field, currentAgentId })
|
|||
placeholder={localize('com_ui_agent_handoff_prompt_key_placeholder')}
|
||||
value={edge.promptKey || ''}
|
||||
onChange={(e) =>
|
||||
updateHandoffDetailsAt(idx, { promptKey: e.target.value })
|
||||
updateHandoffDetailsAt(idx, {
|
||||
promptKey: e.target.value === '' ? undefined : e.target.value,
|
||||
})
|
||||
}
|
||||
className="mt-1 h-8 text-sm"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ export const agentSupportContactSchema = z
|
|||
export const graphEdgeSchema = z.object({
|
||||
from: z.union([z.string(), z.array(z.string())]),
|
||||
to: z.union([z.string(), z.array(z.string())]),
|
||||
description: z.string().optional(),
|
||||
description: z.string().optional().transform((v) => (v === '' ? undefined : v)),
|
||||
edgeType: z.enum(['handoff', 'direct']).optional(),
|
||||
prompt: z.union([z.string(), z.function()]).optional(),
|
||||
prompt: z.union([z.string(), z.function()]).optional().transform((v) => (v === '' ? undefined : v)),
|
||||
excludeResults: z.boolean().optional(),
|
||||
promptKey: z.string().optional(),
|
||||
promptKey: z.string().optional().transform((v) => (v === '' ? undefined : v)),
|
||||
});
|
||||
|
||||
/** Per-tool options schema (defer_loading, allowed_callers) */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue