Skip to content

Replace JUST-OS iframe with native API chat client#702

Merged
LukasWallrich merged 2 commits intomasterfrom
feature/native-just-os-chat
Mar 18, 2026
Merged

Replace JUST-OS iframe with native API chat client#702
LukasWallrich merged 2 commits intomasterfrom
feature/native-just-os-chat

Conversation

@LukasWallrich
Copy link
Copy Markdown
Contributor

@LukasWallrich LukasWallrich commented Mar 17, 2026

Summary

  • Replaces the iframe-based JUST-OS chatbot with a native chat client that communicates directly with the public API at bot.just-os.org/chat
  • Fixes conversation loss when switching between widget/large/resizable modes (previously each mode created a new iframe session)
  • Adds session persistence via sessionStorage so conversation survives same-tab page navigations
  • Two display modes: docked right panel (default, 1/3 screen width, full height) and floating centered panel (resizable via drag handle)

What changed

File Change
layouts/partials/chatbot.html Rewritten — iframe replaced with native chat UI (messages area, input bar, styled bubbles)
layouts/shortcodes/just_os_chat.html Rewritten — iframe replaced with full-page chat container
static/js/just-os-chat.js New — chat client JS: API streaming, state management, UI rendering

Features

  • Streaming responses: Shows real-time status updates ("Classifying question", "Finding relevant sources", etc.) while the API processes
  • Welcome message on first open
  • References: Inline citations displayed as plain text with a collapsible reference list below each bot response (with linked source titles)
  • Copy button: Clipboard icon on bot messages (visible on hover)
  • New Chat: Resets conversation with fresh chat_id
  • Docked ↔ floating toggle: ⤢ button switches between right panel and centered floating window
  • Custom resize handle: Bottom-left drag handle in floating mode for resizing
  • Responsive: Full-width on mobile; floating mode adapts to smaller screens

Architecture

  • Singleton IIFE (JustOSChat) — no global state pollution beyond toggle functions
  • API: POST https://bot.just-os.org/chat with { message, chat_id }, streams newline-delimited JSON
  • Bot responses rendered as innerHTML (API returns HTML with citation links); user messages as textContent
  • sessionStorage persistence keyed by just-os-chat-state
  • Widget mode (#just-os-window) on all pages except /just_os_chatbot/; full-page mode (#just-os-fullpage) on the dedicated page

Test plan

  • Widget: open/close via icon, send message, receive streaming response
  • Docked → floating toggle: verify messages preserved, resize handle appears
  • Floating mode: drag bottom-left handle to resize in both directions
  • Copy button: hover over bot message, click clipboard icon, verify clipboard
  • References: verify collapsible list appears below bot responses with working links
  • New Chat: clears conversation, shows welcome message
  • Page navigation: navigate away and back in same tab, verify conversation restored
  • Dedicated page (/just_os_chatbot/): full-page mode works independently
  • Mobile: responsive layout, input visible

Relates to #521

🤖 Generated with Claude Code

Replace the iframe-based JUST-OS chatbot integration with a native chat
client that communicates directly with the JUST-OS API at
bot.just-os.org/chat. This resolves several UX issues with the iframe
approach: conversation loss when switching between widget sizes, no
control over styling, and hacky negative margins to hide the JUST-OS
page header.

Key changes:
- New JS chat client (static/js/just-os-chat.js) that streams responses
  via newline-delimited JSON from the JUST-OS API
- Two display modes: docked right panel (default, 1/3 width) and
  floating centered panel (pop-out, resizable via drag handle)
- Session persistence via sessionStorage - conversation survives
  same-tab page navigations
- Welcome message on first open
- Bot responses rendered as HTML with inline citations shown as plain
  text and a collapsible reference list below each response
- Copy-to-clipboard button on bot messages
- New Chat button to reset conversation
- Full-page mode on /just_os_chatbot/ page works independently

Relates to #521

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@LukasWallrich LukasWallrich requested a review from a team as a code owner March 17, 2026 16:09
@github-actions
Copy link
Copy Markdown
Contributor

👍 All image files/references (if any) are in webp format, in line with our policy.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 17, 2026

✅ Spell Check Passed

No spelling issues found when checking 3 changed file(s)! 🎉

@LukasWallrich
Copy link
Copy Markdown
Contributor Author

LukasWallrich commented Mar 17, 2026

Staging Deployment Status

This PR has been successfully deployed to staging as part of an aggregated deployment.

Deployed at: 2026-03-17 16:58:40 UTC
Staging URL: https://staging.forrt.org

The staging site shows the combined state of all compatible open PRs.

@LukasWallrich
Copy link
Copy Markdown
Contributor Author

@richarddushime please review - happy to discuss tomorrow

Copy link
Copy Markdown
Contributor

@richarddushime richarddushime left a comment

Choose a reason for hiding this comment

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

LGTM 🥇

@LukasWallrich LukasWallrich merged commit 1cb02dd into master Mar 18, 2026
5 checks passed
@LukasWallrich LukasWallrich deleted the feature/native-just-os-chat branch March 18, 2026 16:05
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.

2 participants