Skip to content

Commit

Permalink
Add uuid dep to support running without https
Browse files Browse the repository at this point in the history
  • Loading branch information
nfcampos committed Jan 30, 2024
1 parent 9743da5 commit 174b6eb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"tailwind-merge": "^2.0.0"
"tailwind-merge": "^2.0.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/dompurify": "^3.0.4",
"@types/lodash": "^4.14.201",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/hooks/useChatList.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useReducer, useState } from "react";
import orderBy from "lodash/orderBy";
import { v4 as uuidv4 } from "uuid";

export interface Message {
type: string;
Expand Down Expand Up @@ -78,7 +79,7 @@ export function useChatList(): ChatListProps {
async (
name: string,
assistant_id: string,
thread_id: string = crypto.randomUUID()
thread_id: string = uuidv4()
) => {
const saved = await fetch(`/threads/${thread_id}`, {
method: "PUT",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/hooks/useConfigList.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useReducer, useState } from "react";
import orderBy from "lodash/orderBy";
import { v4 as uuidv4 } from "uuid";

export interface Config {
assistant_id: string;
Expand Down Expand Up @@ -87,7 +88,7 @@ export function useConfigList(): ConfigListProps {
config: Config["config"],
files: File[],
isPublic: boolean,
assistant_id: string = crypto.randomUUID()
assistant_id: string = uuidv4()
) => {
const formData = files.reduce((formData, file) => {
formData.append("files", file);
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import ReactDOM from "react-dom/client";
import { v4 as uuidv4 } from "uuid";
import App from "./App.tsx";
import "./index.css";

if (document.cookie.indexOf("user_id") === -1) {
document.cookie = `opengpts_user_id=${crypto.randomUUID()}`;
document.cookie = `opengpts_user_id=${uuidv4()}`;
}

ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
10 changes: 10 additions & 0 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,11 @@
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.5.tgz#5cac7e7df3275bb95f79594f192d97da3b4fd5fe"
integrity sha512-I3pkr8j/6tmQtKV/ZzHtuaqYSQvyjGRKH4go60Rr0IDLlFxuRT5V32uvB1mecM5G1EVAUyF/4r4QZ1GHgz+mxA==

"@types/uuid@^9.0.8":
version "9.0.8"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.8.tgz#7545ba4fc3c003d6c756f651f3bf163d8f0f29ba"
integrity sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==

"@typescript-eslint/eslint-plugin@^6.0.0":
version "6.9.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.1.tgz#d8ce497dc0ed42066e195c8ecc40d45c7b1254f4"
Expand Down Expand Up @@ -2005,6 +2010,11 @@ util-deprecate@^1.0.2:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==

uuid@^9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==

vite@^4.4.5:
version "4.5.0"
resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.0.tgz#ec406295b4167ac3bc23e26f9c8ff559287cff26"
Expand Down

0 comments on commit 174b6eb

Please sign in to comment.