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:
parent
f45ca81dda
commit
09a65f6f41
5 changed files with 308 additions and 133 deletions
35
docs/src/components/ChatWidget/index.tsx
Normal file
35
docs/src/components/ChatWidget/index.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue