gupta-sahil01 commented on code in PR #6437:
URL: https://github.com/apache/texera/pull/6437#discussion_r3628078570
##########
frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts:
##########
@@ -1712,6 +1728,146 @@ export class WorkflowEditorComponent implements OnInit,
AfterViewInit, OnDestroy
return
this.operatorSummaries.get(operatorId)?.sampleRecords?.[0]?.["__is_visualization__"]
=== true;
}
+ /**
+ * Ambient operator recommender (apache/texera#5240). When an operator is
+ * added, ask the recommender for likely next operators and float them as
+ * suggestion chips on the operator's output port; clicking one materializes
+ * it. The whole feature is opt-in and self-effacing: if it is disabled or
the
+ * backend returns nothing, the canvas is untouched.
+ */
+ private handleOperatorRecommendation(): void {
+ if (!this.operatorRecommendationService.isEnabled()) {
+ return;
+ }
+
+ // Trigger: an operator was just added to the canvas.
+ this.workflowActionService
+ .getTexeraGraph()
+ .getOperatorAddStream()
+ .pipe(untilDestroyed(this))
+ .subscribe(operator => this.showRecommendationsFor(operator));
Review Comment:
You're right, thanks for catching this. getOperatorAddStream() is driven by
the shared-model change handler, so it fires not only on interactive placement
but also on workflow load, undo/redo, paste, and remote co-editor adds — each
triggering a /api/recommend call and a suggestion popup. Not intended. So I'll
gate the recommender the same way — switching the trigger to the drag-drop drop
event (local, single, interactive) so load/undo/redo/paste/remote no longer
fire it, plus a small debounce. One question: should a single-operator paste
also surface suggestions, or only drag-drop placement?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]