zyratlo opened a new pull request, #5262:
URL: https://github.com/apache/texera/pull/5262
### What changes were proposed in this PR?
Introduces `NotebookMigrationService`, the frontend orchestration service
that sits between the migration-tool UI and the lower layers: the LLM client
(`migration-tool-llm-client`) and the backend notebook-migration microservice
(`migration-tool-backend-notebook-migration-service`).
**`notebook-migration.service.ts`**
- `getAvailableModels()` — `GET /api/models` against the existing LiteLLM
proxy, returns the model dropdown options.
- `sendToAIGenerateWorkflow(notebook, modelType, apiKey)` — drives the
full `NotebookMigrationLLM` lifecycle (initialize → verify connection → convert
→ close in `finally`) and returns `{ workflowContent, mappingContent }`.
Surfaces API-key
validation failures by throwing.
- `sendNotebookToJupyter(notebookData)` — `POST
/api/notebook-migration/set-notebook`; surfaces a `NotificationService` toast
on success and failure; returns `1` / `0`.
- `getJupyterURL()`, `getJupyterIframeURL()` — calls the matching
microservice endpoints to retrieve URLs to embed.
- `storeNotebookAndMapping(wid, vid, mappingContent, notebookContent)` —
`POST /api/notebook-migration/store-notebook-and-mapping`; returns the
`HttpClient` observable directly so callers can compose with `switchMap`.
- Mapping cache — small in-memory dictionary `{ [key: string]:
MappingContent }` keyed by `mapping_wid_<workflowId>`, with `hasMapping`,
`getMapping`, `setMapping`, `deleteMapping`.
**`notebook-migration.service.spec.ts`**
- `getAvailableModels`: maps the LiteLLM `data[].id` array correctly;
falls back to an empty array on HTTP error.
- `sendNotebookToJupyter`: success → returns `1`; error → returns `0` and
toasts.
- `getJupyterURL` / `getJupyterIframeURL`: success → returns the URL;
non-OK response or thrown error → returns `null`.
- Mapping cache: `setMapping` then `getMapping` round-trips;
`deleteMapping` removes the entry.
- `storeNotebookAndMapping`: makes the expected `POST` to the persistence
endpoint.
### Any related issues, documentation, discussions?
Closes #5261
Parent issue #4301
### How was this PR tested?
The new `notebook-migration.service.spec.ts` adds 11
`HttpClientTestingModule`-driven test cases
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)
--
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]