Skip to content

Commit a996e28

Browse files
committed
added white labeling/ history view22
1 parent 467cff7 commit a996e28

File tree

3 files changed

+101
-15
lines changed

3 files changed

+101
-15
lines changed

web/src/app/auth/login/LoginText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { SettingsContext } from "@/components/settings/SettingsProvider";
55
import Loader from "@/components/Loader";
66

77
export const LoginText = ({ configs }: any) => {
8-
if(!configs?.company_name) return <Loader/>
98
const settings = useContext(SettingsContext);
9+
if(!configs?.company_name) return <Loader/>
1010
return (
1111
<>
1212
Log In to{" "}

web/src/app/chat/hooks/useChatController.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,10 @@ export function useChatController({
272272
// contain a STOP. This makes AIMessage behave as if a STOP packet arrived.
273273
if (lastMessage && lastMessage.type === "assistant") {
274274
const packets = lastMessage.packets || [];
275-
const hasStop = packets.some((p) => p.obj.type === PacketType.STOP);
275+
const hasStop = packets.some((p:any) => p.obj.type === PacketType.STOP);
276276
if (!hasStop) {
277277
const maxInd =
278-
packets.length > 0 ? Math.max(...packets.map((p) => p.ind)) : 0;
278+
packets.length > 0 ? Math.max(...packets.map((p:any) => p.ind)) : 0;
279279
const stopPacket: Packet = {
280280
ind: maxInd + 1,
281281
obj: { type: PacketType.STOP },
@@ -614,7 +614,7 @@ export function useChatController({
614614
if (!packet) {
615615
continue;
616616
}
617-
console.debug("Packet:", JSON.stringify(packet));
617+
console.debug("Packet: - useChatController.ts:617", JSON.stringify(packet));
618618

619619
// We've processed initial packets and are starting to stream content.
620620
// Transition from 'loading' to 'streaming'.
@@ -671,7 +671,7 @@ export function useChatController({
671671
updateCanContinue(true, frozenSessionId);
672672
}
673673
} else if (Object.hasOwn(packet, "obj")) {
674-
console.debug("Object packet:", JSON.stringify(packet));
674+
console.debug("Object packet: - useChatController.ts:674", JSON.stringify(packet));
675675
packets.push(packet as Packet);
676676

677677
// Check if the packet contains document information
@@ -698,7 +698,7 @@ export function useChatController({
698698
}
699699
}
700700
} else {
701-
console.warn("Unknown packet:", JSON.stringify(packet));
701+
console.warn("Unknown packet: - useChatController.ts:701", JSON.stringify(packet));
702702
}
703703

704704
// on initial message send, we insert a dummy system message
@@ -738,7 +738,7 @@ export function useChatController({
738738
}
739739
}
740740
} catch (e: any) {
741-
console.log("Error:", e);
741+
console.log("Error: - useChatController.ts:741", e);
742742
const errorMsg = e.message;
743743
const newMessageDetails = upsertToCompleteMessageTree({
744744
messages: [
@@ -939,7 +939,7 @@ export function useChatController({
939939

940940
router.push(data.redirect_url);
941941
} catch (error) {
942-
console.error("Error seeding chat from Slack:", error);
942+
console.error("Error seeding chat from Slack: - useChatController.ts:942", error);
943943
setPopup({
944944
message: "Failed to load chat from Slack",
945945
type: "error",
@@ -990,11 +990,11 @@ export function useChatController({
990990
);
991991

992992
if (!response.ok) {
993-
console.error("Failed to fetch token estimate");
993+
console.error("Failed to fetch token estimate - useChatController.ts:993");
994994
return;
995995
}
996996
} catch (error) {
997-
console.error("Error calculating tokens:", error);
997+
console.error("Error calculating tokens: - useChatController.ts:997", error);
998998
}
999999
}
10001000
};

web/src/components/admin/connectors/AdminSidebar.tsx

Lines changed: 91 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,106 @@ interface Collection {
2121
items: Item[];
2222
}
2323

24+
// export function AdminSidebar({ collections }: { collections: Collection[] }) {
25+
// const combinedSettings = useContext(SettingsContext);
26+
// const pathname = usePathname() ?? "";
27+
// if (!combinedSettings) {
28+
// return null;
29+
// }
30+
// const enterpriseSettings = combinedSettings.enterpriseSettings;
31+
// const { configs, fetchConfigs }: any = useBrandingStore();
32+
33+
// useEffect(() => {
34+
// fetchConfigs(configs?.company_name, configs?.id);
35+
// }, []);
36+
// useApplyBrandingTheme();
37+
// if (!configs?.company_name) return <Loader />;
38+
// return (
39+
// <div className="text-text-settings-sidebar pl-0">
40+
// <nav className="space-y-2">
41+
// <div className="w-full ml-4 mt-1 h-8 justify-start mb-4 flex">
42+
// <LogoComponent
43+
// show={true}
44+
// enterpriseSettings={enterpriseSettings!}
45+
// backgroundToggled={false}
46+
// isAdmin={true}
47+
// />
48+
// </div>
49+
// <div className="flex w-full justify-center">
50+
// <Link href="/chat">
51+
// <button className="text-sm text-text-700 hover:bg-background-settings-hover dark:hover:bg-neutral-800 flex items-center block w-52 py-2.5 flex px-2 text-left hover:bg-opacity-80 cursor-pointer rounded">
52+
// <CgArrowsExpandUpLeft className="my-auto" size={18} />
53+
// <p className="ml-1 break-words line-clamp-2 ellipsis leading-none">
54+
// Exit Admin
55+
// </p>
56+
// </button>
57+
// </Link>
58+
// </div>
59+
// {collections.map((collection, collectionInd) => (
60+
// <div
61+
// className="flex flex-col items-center justify-center w-full"
62+
// key={collectionInd}
63+
// >
64+
// <h2 className="text-xs text-text-800 w-52 font-bold pb-2">
65+
// <div>{collection.name}</div>
66+
// </h2>
67+
// {collection.items.map((item) => (
68+
// <Link key={item.link} href={item.link}>
69+
// <button
70+
// className={`text-sm text-text-700 block flex gap-x-2 items-center w-52 py-2.5 px-2 text-left hover:bg-background-settings-hover dark:hover:bg-neutral-800 rounded
71+
// ${
72+
// pathname.startsWith(item.link)
73+
// ? "bg-background-settings-hover dark:bg-neutral-700"
74+
// : ""
75+
// }`}
76+
// >
77+
// {item.name}
78+
// </button>
79+
// </Link>
80+
// ))}
81+
// </div>
82+
// ))}
83+
// </nav>
84+
// {combinedSettings.webVersion && (
85+
// <div
86+
// className="flex flex-col mt-12 items-center justify-center w-full"
87+
// key={"onyxVersion"}
88+
// >
89+
// <h2 className="text-xs text-text/40 w-52 font-medium">
90+
// {`${
91+
// configs?.company_name && configs?.white_label_enabled === true
92+
// ? configs?.company_name
93+
// : "Cortex AI "
94+
// }${combinedSettings?.webVersion}`}
95+
// </h2>
96+
// </div>
97+
// )}
98+
// </div>
99+
// );
100+
// }
101+
102+
24103
export function AdminSidebar({ collections }: { collections: Collection[] }) {
104+
const { configs, fetchConfigs }: any = useBrandingStore(); // ⬅️ moved up
25105
const combinedSettings = useContext(SettingsContext);
26106
const pathname = usePathname() ?? "";
107+
108+
useApplyBrandingTheme();
109+
110+
useEffect(() => {
111+
if (configs?.company_name && configs?.id) {
112+
fetchConfigs(configs.company_name, configs.id);
113+
}
114+
}, [configs?.company_name, configs?.id, fetchConfigs]);
115+
27116
if (!combinedSettings) {
28117
return null;
29118
}
119+
30120
const enterpriseSettings = combinedSettings.enterpriseSettings;
31-
const { configs, fetchConfigs }: any = useBrandingStore();
32121

33-
useEffect(() => {
34-
fetchConfigs(configs?.company_name, configs?.id);
35-
}, []);
36-
useApplyBrandingTheme();
37122
if (!configs?.company_name) return <Loader />;
123+
38124
return (
39125
<div className="text-text-settings-sidebar pl-0">
40126
<nav className="space-y-2">

0 commit comments

Comments
 (0)