Skip to content

Commit 63b07fa

Browse files
committed
chore: Update Langflow Chat bundle to v1.0.4
1 parent 5fd5c1e commit 63b07fa

5 files changed

Lines changed: 36 additions & 10 deletions

File tree

package-lock.json

Lines changed: 26 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
"react": "^18.2.0",
1717
"react-dom": "^18.2.0",
1818
"react-markdown": "^8.0.7",
19-
"rehype-mathjax": "^4.0.3",
20-
"remark-gfm": "3.0.1",
2119
"react-scripts": "5.0.1",
2220
"react-shadow": "^20.3.0",
21+
"rehype-mathjax": "^4.0.3",
22+
"remark-gfm": "3.0.1",
2323
"typescript": "^4.9.5",
2424
"uglifyjs-webpack-plugin": "^2.2.0",
25+
"uuid": "^10.0.0",
2526
"web-vitals": "^2.1.4"
2627
},
2728
"scripts": {

public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
</head>
88
<body style="width: 100vh; height: 100vh; ">
99
<langflow-chat window_title="Langflow Chat"
10-
flow_id="f351267a-f3b3-44ad-a9a4-a18a505dd0ec"
10+
flow_id="be1e92a7-b194-4b03-a36e-a95c94995bcc"
11+
session_id="123456"
1112
host_url="http://localhost:7860"
1213
width="700"
1314
></langflow-chat>

src/chatWidget/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useRef, useState } from "react";
22
import ChatTrigger from "./chatTrigger";
33
import ChatWindow from "./chatWindow";
44
import { ChatMessageType } from "../types/chatWidget";
5+
const { v4: uuidv4 } = require('uuid');
56

67
export default function ChatWidget({
78
api_key,
@@ -30,6 +31,7 @@ export default function ChatWidget({
3031
placeholder_sending,
3132
input_container_style,
3233
additional_headers,
34+
session_id,
3335
}: {
3436
api_key?: string;
3537
input_value: string,
@@ -58,10 +60,11 @@ export default function ChatWidget({
5860
flow_id: string;
5961
tweaks?: { [key: string]: any };
6062
additional_headers?: { [key: string]: string };
63+
session_id?: string;
6164
}) {
6265
const [open, setOpen] = useState(false);
6366
const [messages, setMessages] = useState<ChatMessageType[]>([]);
64-
const sessionId = useRef("");
67+
const sessionId = useRef(session_id ?? uuidv4());
6568
function updateLastMessage(message: ChatMessageType) {
6669
setMessages((prev) => {
6770
prev[prev.length - 1] = message;

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ customElements.define('langflow-chat', r2wc(ChatWidget, {
2020
chat_window_style:"json",
2121
height:"number",
2222
width:"number",
23+
session_id:"string",
2324
chat_output_key:"string",
2425
error_message_style:"json",
2526
send_button_style:"json",

0 commit comments

Comments
 (0)