mengw15 commented on code in PR #7601:
URL: https://github.com/apache/texera/pull/7601#discussion_r3780099872
##########
frontend/src/app/workspace/service/notebook-migration/migration-llm.ts:
##########
@@ -79,6 +79,8 @@ interface CombinedMapping {
* Terminal UDFs (no outgoing edge) declare their outputs as `string` so the
result panel
* renders viewable values rather than opaque binary blobs.
*/
+export const LLM_REQUEST_TIMEOUT_MS = 10 * 60 * 1000;
Review Comment:
A fixed bound can't tell "stalled" from "slow": a conversion that would have
finished at 11 minutes now fails, and retrying hits the same wall, so the tool
is permanently unusable for that notebook rather than just slow. The cost is
lopsided — too generous only means waiting longer on a real stall, too tight
discards work that would have succeeded.
Worth making this configurable rather than compiled in, so a deployment can
match it to its own models and notebook sizes.
##########
frontend/src/app/dashboard/component/user/user-workflow/user-workflow.component.ts:
##########
@@ -312,6 +328,112 @@ export class UserWorkflowComponent implements
AfterViewInit {
});
}
+ public get pythonNotebookMigrationEnabled(): boolean {
+ return this.config.env.pythonNotebookMigrationEnabled;
+ }
+
+ /** Open the AI-generate import modal, wiring its submit to
generateWorkflowFromNotebook. */
+ public openAiGenerateModal(): void {
+ this.modalService.create<NotebookImportModalComponent,
NotebookImportModalData>({
+ nzTitle: "AI Generate Workflow from Python Notebook",
+ nzContent: NotebookImportModalComponent,
+ nzWidth: 700,
+ nzFooter: null,
+ nzCentered: true,
+ nzData: {
+ requestImport: (file, model) =>
this.generateWorkflowFromNotebook(file, model),
+ },
+ });
+ }
+
+ /**
+ * Parse the notebook, generate a workflow via the LLM, save it, store the
cell mapping, and open it.
+ * Resolves true on success (modal closes), false to keep the modal open on
a bad file or a failure.
+ */
+ private async generateWorkflowFromNotebook(file: NzUploadFile, model:
string): Promise<boolean> {
+ const fileExtension = file.name.split(".").pop()?.toLowerCase();
+ if (fileExtension !== "ipynb") {
+ this.notificationService.error("Please upload a valid Jupyter Notebook
(.ipynb) file.");
+ return false;
+ }
+ let notebook: Notebook;
+ try {
+ notebook = await this.notebookMigrationService.parseAndTagNotebook(file
as unknown as File);
+ } catch (error) {
+ this.notificationService.error("Failed to read the notebook file. Please
upload a valid .ipynb file.");
+ console.error("Notebook parse failed:", error);
+ return false;
+ }
+
+ let generated: { workflowContent: WorkflowContent; mappingContent:
MappingContent };
+ try {
+ generated = await
this.notebookMigrationService.sendToAIGenerateWorkflow(notebook, model);
+ } catch (error) {
+ this.notificationService.error("Error while communicating with the LLM,
check console for details.");
Review Comment:
A timeout lands here too, and "Error while communicating with the LLM"
points at the network when the request was fine and just slow — the real reason
only reaches the console, so the user spends the full limit waiting and then
goes off debugging connectivity.
This is the half of my earlier comment that's still open: the hang is
bounded now, but the user still can't tell what happened. A distinct message on
the timeout rejection would close it.
--
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]