Ma77Ball commented on code in PR #6437:
URL: https://github.com/apache/texera/pull/6437#discussion_r3610274873
##########
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:
Optional performance fix: getOperatorAddStream triggers a POST
/api/recommend on every add, including loading a saved workflow, pasting, and
undo/redo. I recommend gating this to interactive ads or suppressing while a
workflow is being restored.
--
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]