fix agent scene slot prompt dedupe
This commit is contained in:
parent
c16862bd90
commit
bd1dbc4406
@ -2983,6 +2983,29 @@ function getPromptSemanticLabel(label: string) {
|
||||
return AGENT_PROMPT_LABEL_SEMANTIC_ALIASES.get(normalized) || normalized;
|
||||
}
|
||||
|
||||
function collectPromptSemanticLabelsFromText(text: string) {
|
||||
const semanticLabels = new Set<string>();
|
||||
const normalizedText = String(text || "").replace(/\s+/g, " ").trim();
|
||||
if (!normalizedText) {
|
||||
return semanticLabels;
|
||||
}
|
||||
|
||||
for (const [label, semantic] of AGENT_PROMPT_LABEL_SEMANTIC_ALIASES.entries()) {
|
||||
if (!label) {
|
||||
continue;
|
||||
}
|
||||
if (normalizedText.includes(`${label}:`) || normalizedText.includes(`${label}:`)) {
|
||||
semanticLabels.add(semantic);
|
||||
continue;
|
||||
}
|
||||
if (normalizedText.includes(`${label} `) || normalizedText.includes(label)) {
|
||||
semanticLabels.add(semantic);
|
||||
}
|
||||
}
|
||||
|
||||
return semanticLabels;
|
||||
}
|
||||
|
||||
function shouldDropSceneSlotSemanticLine(
|
||||
slotSemanticLabel: string,
|
||||
workflowSemanticLabels: Set<string>,
|
||||
@ -3034,6 +3057,12 @@ function dedupeAgentSlotPromptAgainstWorkflow(params: {
|
||||
if (parsed.label) {
|
||||
workflowSemanticLabels.add(getPromptSemanticLabel(parsed.label));
|
||||
}
|
||||
collectPromptSemanticLabelsFromText(line).forEach((semantic) => {
|
||||
workflowSemanticLabels.add(semantic);
|
||||
});
|
||||
collectPromptSemanticLabelsFromText(parsed.value || "").forEach((semantic) => {
|
||||
workflowSemanticLabels.add(semantic);
|
||||
});
|
||||
if (parsed.label && AGENT_PROMPT_STRUCTURAL_LABELS.has(parsed.label)) {
|
||||
workflowStructuralValues.set(
|
||||
parsed.label,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user