diff --git a/app/src/components/app.tsx b/app/src/components/app.tsx index 1a9ffa6c..81c81c6c 100644 --- a/app/src/components/app.tsx +++ b/app/src/components/app.tsx @@ -6,16 +6,18 @@ import { createContext } from "preact"; type Props = { appName: string; }; -const convoUUID = window.crypto.randomUUID(); -export const ConvoCtx = createContext(convoUUID); +const tempArray = new Uint32Array(10); +const convoUUID = window.crypto.getRandomValues(tempArray); + +export const ConvoCtx = createContext(""); export const App = registerCustomElement("app-root", (props: Props) => { props.appName = "Generative AI JET UI"; return (
- - {console.log("UUID: ", convoUUID)} + + {console.log("UUID: ", convoUUID[0].toString())}
diff --git a/app/src/components/content/stomp-interface.tsx b/app/src/components/content/stomp-interface.tsx index cd77256a..ac50a43a 100644 --- a/app/src/components/content/stomp-interface.tsx +++ b/app/src/components/content/stomp-interface.tsx @@ -9,7 +9,6 @@ export const InitStomp = ( chatData: any, serviceType: any ) => { - //const [test, setTest] = useState(); const protocol = window.location.protocol === "http:" ? "ws://" : "wss://"; const hostname = window.location.hostname === "localhost" @@ -47,7 +46,6 @@ export const InitStomp = ( const onMessage = (msg: any) => { let aiAnswer = JSON.parse(msg.body).content; - //console.log("answer: ", aiAnswer); if (msg.data !== "connected") { let tempArray = [...chatData.current]; // remove the animation item before adding answer diff --git a/app/src/components/content/summary.tsx b/app/src/components/content/summary.tsx index 960bd67e..9ea09edb 100644 --- a/app/src/components/content/summary.tsx +++ b/app/src/components/content/summary.tsx @@ -1,5 +1,5 @@ import "preact"; -import { useState, useRef, useEffect } from "preact/hooks"; +import { useState, useRef, useEffect, useContext } from "preact/hooks"; import "md-wrapper/loader"; import "ojs/ojtoolbar"; import "oj-c/file-picker"; @@ -13,6 +13,7 @@ import { CFilePickerElement } from "oj-c/file-picker"; import { CInputTextElement } from "oj-c/input-text"; import { CButtonElement } from "oj-c/button"; import MutableArrayDataProvider = require("ojs/ojmutablearraydataprovider"); +import { ConvoCtx } from "../app"; declare global { namespace preact.JSX { @@ -47,6 +48,7 @@ export const Summary = ({ summary, backendType, }: Props) => { + const conversationId = useContext(ConvoCtx); const [invalidMessage, setInvalidMessage] = useState(null); const [summaryPrompt, setSummaryPrompt] = useState(""); const [summaryResults, setSummaryResults] = useState(summary); @@ -89,6 +91,7 @@ export const Summary = ({ mode: "cors", referrerPolicy: "strict-origin-when-cross-origin", body: formData, + headers: { conversationID: conversationId, modelId: "" }, }); console.log("Response: ", res); const responseData = await res.json(); @@ -330,7 +333,11 @@ export const Summary = ({ )} {invalidFiles.current.length !== 1 && fileNames && summary && ( -
+