Skip to content

feat(lingbot): add selectable WebRTC presets#375

Open
gtong-nv wants to merge 1 commit into
mainfrom
dev/gtong/lingbot_presets
Open

feat(lingbot): add selectable WebRTC presets#375
gtong-nv wants to merge 1 commit into
mainfrom
dev/gtong/lingbot_presets

Conversation

@gtong-nv

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Gangzheng Tong <gtong@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@gtong-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 3b4fbfe

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds selectable preset scenes to the LingBot WebRTC flow. The main changes are:

  • Bundled preset assets with prompts, first frames, and text events.
  • Server routes for preset metadata, preview images, and preset-backed session input.
  • Runtime metadata for active preset tracking.
  • A browser preset picker and disconnect/reconnect button flow.
  • Tests for preset assets, routes, and runtime scene metadata.

Confidence Score: 4/5

The preset flow has a contained state bug in pending session metadata.

  • Preset assets, routes, and package data look consistent.
  • Later manual scene updates can keep an old preset id.
  • The UI can show the wrong preset as active after that update.

integrations/lingbot/lingbot/webrtc/session.py

Important Files Changed

Filename Overview
integrations/lingbot/lingbot/webrtc/server.py Adds preset loading, preset preview routing, initial-scene preset metadata, and preset selection handling.
integrations/lingbot/lingbot/webrtc/session.py Adds preset identifiers to runtime and pending session state, with a sticky merge issue for later manual updates.
integrations/lingbot/lingbot/webrtc/web/request_session.js Adds preset picker behavior and updates connect/disconnect UI state.
integrations/lingbot/pyproject.toml Adds bundled preset files to package data.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
  participant UI as WebRTC UI
  participant API as Server
  participant Manager as Session manager
  UI->>API: POST /api/session/input preset_id
  API->>Manager: Store preset prompt, frame, events
  Manager-->>API: active_preset_id
  API-->>UI: Initial scene metadata
  UI->>API: POST /api/session/input custom edit without preset_id
  API->>Manager: Merge custom edit with pending input
  Manager-->>UI: Old active_preset_id can remain
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
  participant UI as WebRTC UI
  participant API as Server
  participant Manager as Session manager
  UI->>API: POST /api/session/input preset_id
  API->>Manager: Store preset prompt, frame, events
  Manager-->>API: active_preset_id
  API-->>UI: Initial scene metadata
  UI->>API: POST /api/session/input custom edit without preset_id
  API->>Manager: Merge custom edit with pending input
  Manager-->>UI: Old active_preset_id can remain
Loading

Reviews (1): Last reviewed commit: "feat(lingbot): add selectable WebRTC pre..." | Re-trigger Greptile

Comment on lines 1331 to +1338
else (current.text_events if current is not None else None)
)
self._pending_session_input = LingbotSessionInput(
preset_id=(
session_input.preset_id
if session_input.preset_id is not None
else (current.preset_id if current is not None else None)
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Preset State Stays Sticky

After a user selects a preset, this merge keeps the old preset_id on later /api/session/input updates that omit preset_id, such as a manual prompt, image, or event-catalog edit. The scene can then return input_source: "preset" and the old active_preset_id even though the active inputs are now user-provided, so the picker marks the wrong preset as selected and the session metadata no longer describes the scene.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant