mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-10 17:00:11 +01:00
unset PFP changes for later PR
This commit is contained in:
parent
9bf6b974a0
commit
91b087b5b2
@ -11,6 +11,7 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@metamask/jazzicon": "^2.0.0",
|
||||||
"@microsoft/fetch-event-source": "^2.0.1",
|
"@microsoft/fetch-event-source": "^2.0.1",
|
||||||
"@phosphor-icons/react": "^2.0.13",
|
"@phosphor-icons/react": "^2.0.13",
|
||||||
"@tremor/react": "^3.15.1",
|
"@tremor/react": "^3.15.1",
|
||||||
|
@ -1,44 +1,35 @@
|
|||||||
import React from "react";
|
import React, { useRef, useEffect } from "react";
|
||||||
|
import JAZZ from "@metamask/jazzicon";
|
||||||
import usePfp from "../../hooks/usePfp";
|
import usePfp from "../../hooks/usePfp";
|
||||||
import WorkspaceDefault from "./workspace.png";
|
|
||||||
|
|
||||||
export default function UserIcon({ user, role }) {
|
export default function UserIcon({ size = 36, user, role }) {
|
||||||
const { pfp } = usePfp();
|
const { pfp } = usePfp();
|
||||||
|
const divRef = useRef(null);
|
||||||
|
const seed = user?.uid
|
||||||
|
? toPseudoRandomInteger(user.uid)
|
||||||
|
: Math.floor(100000 + Math.random() * 900000);
|
||||||
|
|
||||||
if (role === "user") {
|
useEffect(() => {
|
||||||
if (!pfp) {
|
if (!divRef.current || (role === "user" && pfp)) return;
|
||||||
return (
|
|
||||||
<div className="relative w-[36px] h-[36px] rounded-full flex-shrink-0 overflow-hidden">
|
const result = JAZZ(size, seed);
|
||||||
<div className="absolute top-0 left-0 w-full h-full object-cover rounded-full flex items-center justify-center bg-[#2DF4D0] text-black text-lg font-semibold">
|
divRef.current.appendChild(result);
|
||||||
<p className="p-0 !m-0">{user?.username?.slice(0, 2) || "U"}</p>
|
}, [pfp, role, seed, size]);
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div className="relative w-[36px] h-[36px] rounded-full flex-shrink-0 overflow-hidden">
|
|
||||||
<img
|
|
||||||
src={pfp}
|
|
||||||
width={36}
|
|
||||||
height={36}
|
|
||||||
alt="User profile picture"
|
|
||||||
className={`absolute top-0 left-0 w-full h-full object-cover rounded-full ${
|
|
||||||
!!pfp ? "" : "border border-white/40"
|
|
||||||
}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-[36px] h-[36px] rounded-full flex-shrink-0 overflow-hidden">
|
<div className="relative w-[35px] h-[35px] rounded-full flex-shrink-0 overflow-hidden">
|
||||||
<img
|
<div ref={divRef} />
|
||||||
src={pfp ?? WorkspaceDefault}
|
{role === "user" && pfp && (
|
||||||
alt="User profile picture"
|
<img
|
||||||
className={`absolute top-0 left-0 w-full h-full object-cover rounded-full ${
|
src={pfp}
|
||||||
!!pfp ? "" : "border border-white/40"
|
alt="User profile picture"
|
||||||
}`}
|
className="absolute top-0 left-0 w-full h-full object-cover rounded-full bg-white"
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toPseudoRandomInteger(uidString = "") {
|
||||||
|
return uidString.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
||||||
|
}
|
||||||
|
@ -2,7 +2,6 @@ import React, { memo, useState } from "react";
|
|||||||
import useCopyText from "@/hooks/useCopyText";
|
import useCopyText from "@/hooks/useCopyText";
|
||||||
import {
|
import {
|
||||||
Check,
|
Check,
|
||||||
ClipboardText,
|
|
||||||
ThumbsUp,
|
ThumbsUp,
|
||||||
ThumbsDown,
|
ThumbsDown,
|
||||||
ArrowsClockwise,
|
ArrowsClockwise,
|
||||||
|
@ -91,7 +91,6 @@ export default function ChatHistory({
|
|||||||
sendCommand(`${heading} ${message}`, true);
|
sendCommand(`${heading} ${message}`, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Be able to edit both user and system response message.
|
|
||||||
const saveEditedMessage = async ({ editedMessage, chatId, role }) => {
|
const saveEditedMessage = async ({ editedMessage, chatId, role }) => {
|
||||||
if (!editedMessage) return; // Don't save empty edits.
|
if (!editedMessage) return; // Don't save empty edits.
|
||||||
|
|
||||||
|
@ -487,6 +487,14 @@
|
|||||||
"@jridgewell/resolve-uri" "^3.1.0"
|
"@jridgewell/resolve-uri" "^3.1.0"
|
||||||
"@jridgewell/sourcemap-codec" "^1.4.14"
|
"@jridgewell/sourcemap-codec" "^1.4.14"
|
||||||
|
|
||||||
|
"@metamask/jazzicon@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@metamask/jazzicon/-/jazzicon-2.0.0.tgz#5615528e91c0fc5c9d79202d1f0954a7922525a0"
|
||||||
|
integrity sha512-7M+WSZWKcQAo0LEhErKf1z+D3YX0tEDAcGvcKbDyvDg34uvgeKR00mFNIYwAhdAS9t8YXxhxZgsrRBBg6X8UQg==
|
||||||
|
dependencies:
|
||||||
|
color "^0.11.3"
|
||||||
|
mersenne-twister "^1.1.0"
|
||||||
|
|
||||||
"@microsoft/fetch-event-source@^2.0.1":
|
"@microsoft/fetch-event-source@^2.0.1":
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz#9ceecc94b49fbaa15666e38ae8587f64acce007d"
|
resolved "https://registry.yarnpkg.com/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz#9ceecc94b49fbaa15666e38ae8587f64acce007d"
|
||||||
@ -1017,6 +1025,11 @@ cliui@^8.0.1:
|
|||||||
strip-ansi "^6.0.1"
|
strip-ansi "^6.0.1"
|
||||||
wrap-ansi "^7.0.0"
|
wrap-ansi "^7.0.0"
|
||||||
|
|
||||||
|
clone@^1.0.2:
|
||||||
|
version "1.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
|
||||||
|
integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==
|
||||||
|
|
||||||
clsx@^1.1.1:
|
clsx@^1.1.1:
|
||||||
version "1.2.1"
|
version "1.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12"
|
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12"
|
||||||
@ -1027,7 +1040,7 @@ clsx@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.0.tgz#e851283bcb5c80ee7608db18487433f7b23f77cb"
|
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.0.tgz#e851283bcb5c80ee7608db18487433f7b23f77cb"
|
||||||
integrity sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==
|
integrity sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==
|
||||||
|
|
||||||
color-convert@^1.9.0:
|
color-convert@^1.3.0, color-convert@^1.9.0:
|
||||||
version "1.9.3"
|
version "1.9.3"
|
||||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
||||||
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
||||||
@ -1046,11 +1059,27 @@ color-name@1.1.3:
|
|||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||||
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
|
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
|
||||||
|
|
||||||
color-name@~1.1.4:
|
color-name@^1.0.0, color-name@~1.1.4:
|
||||||
version "1.1.4"
|
version "1.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
|
color-string@^0.3.0:
|
||||||
|
version "0.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-string/-/color-string-0.3.0.tgz#27d46fb67025c5c2fa25993bfbf579e47841b991"
|
||||||
|
integrity sha512-sz29j1bmSDfoAxKIEU6zwoIZXN6BrFbAMIhfYCNyiZXBDuU/aiHlN84lp/xDzL2ubyFhLDobHIlU1X70XRrMDA==
|
||||||
|
dependencies:
|
||||||
|
color-name "^1.0.0"
|
||||||
|
|
||||||
|
color@^0.11.3:
|
||||||
|
version "0.11.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/color/-/color-0.11.4.tgz#6d7b5c74fb65e841cd48792ad1ed5e07b904d764"
|
||||||
|
integrity sha512-Ajpjd8asqZ6EdxQeqGzU5WBhhTfJ/0cA4Wlbre7e5vXfmDSmda7Ov6jeKoru+b0vHcb1CqvuroTHp5zIWzhVMA==
|
||||||
|
dependencies:
|
||||||
|
clone "^1.0.2"
|
||||||
|
color-convert "^1.3.0"
|
||||||
|
color-string "^0.3.0"
|
||||||
|
|
||||||
commander@^4.0.0:
|
commander@^4.0.0:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
|
||||||
@ -2372,6 +2401,11 @@ merge2@^1.3.0:
|
|||||||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
||||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||||
|
|
||||||
|
mersenne-twister@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/mersenne-twister/-/mersenne-twister-1.1.0.tgz#f916618ee43d7179efcf641bec4531eb9670978a"
|
||||||
|
integrity sha512-mUYWsMKNrm4lfygPkL3OfGzOPTR2DBlTkBNHM//F6hGp8cLThY897crAlk3/Jo17LEOOjQUrNAx6DvgO77QJkA==
|
||||||
|
|
||||||
micromatch@^4.0.4, micromatch@^4.0.5:
|
micromatch@^4.0.4, micromatch@^4.0.5:
|
||||||
version "4.0.5"
|
version "4.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
|
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
|
||||||
|
Loading…
Reference in New Issue
Block a user