docs: chat widget refresh (#8162)

* pause-at-angular

* text-io-works-but-no-context

* chat-widget-tsx

* split-out-page

* angular-section

* mikes-edits-for-indentation

* cleanup

* indentation

* Apply suggestions from code review

Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>

* remove-widget-causing-scroll-problems

---------

Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>
This commit is contained in:
Mendon Kissling 2025-05-28 11:44:37 -04:00 committed by GitHub
commit 09a65f6f41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 308 additions and 133 deletions

View file

@ -0,0 +1,35 @@
import React, { useEffect } from 'react';
// Component to load the chat widget script
const ChatScriptLoader = () => {
useEffect(() => {
if (!document.querySelector('script[src*="langflow-embedded-chat"]')) {
const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/gh/langflow-ai/langflow-embedded-chat@main/dist/build/static/js/bundle.min.js';
script.async = true;
document.body.appendChild(script);
}
}, []);
return null;
};
declare global {
namespace JSX {
interface IntrinsicElements {
"langflow-chat": any;
}
}
}
export default function ChatWidget({ className }) {
return (
<div className={className}>
<ChatScriptLoader />
<langflow-chat
host_url="http://localhost:7860"
flow_id="YOUR_FLOW_ID"
></langflow-chat>
</div>
);
}