Skip to content

Commit 6a44196

Browse files
committed
added powered by
1 parent 9e23b94 commit 6a44196

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+15
-4598
lines changed

components/chatbot/(chat)/chat/[id]/page.tsx

-60
This file was deleted.

components/chatbot/(chat)/layout.tsx

-14
This file was deleted.

components/chatbot/(chat)/page.tsx

-31
This file was deleted.

components/chatbot/ChatBot.tsx

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useState, useRef } from "react";
22
import { Button } from "@/components/ui/button";
33
import { Card, CardHeader, CardContent, CardFooter } from "@/components/ui/card";
4-
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
4+
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
55
import { Input } from "@/components/ui/input";
66

77
import { v4 as uuidv4 } from "uuid";
@@ -13,12 +13,13 @@ import { useToast } from "@/components/ui/use-toast";
1313
export default function Chatbot() {
1414
const [isOpen, setIsOpen] = useState(false);
1515
const [input, setInput] = useState("");
16+
const [aiModelName, setAiModelName] = useState("");
1617
const startArray: object[] = [];
1718
const [messages, setMessages] = useState(startArray);
1819
const [isLoading, setIsLoading] = useState(false);
1920
const client = useLDClient();
2021
const { toast } = useToast();
21-
const flags = useFlags();
22+
const aiChatbotFlag = useFlags()["ai-chatbot"];
2223

2324
const handleInputChange = (e: any) => {
2425
setInput(e.target.value);
@@ -83,8 +84,14 @@ export default function Chatbot() {
8384
}
8485

8586
useEffect(() => {
86-
console.log("aiChatBot", flags["ai-chatbot"]);
87-
}, [messages]);
87+
if (aiChatbotFlag.modelId.includes("cohere")) {
88+
setAiModelName("Cohere Coral");
89+
} else if (aiChatbotFlag.modelId.includes("meta")) {
90+
setAiModelName("Meta Llama");
91+
} else if (aiChatbotFlag.modelId.includes("anthropic")) {
92+
setAiModelName("Anthropic Claude");
93+
}
94+
}, [aiChatbotFlag]);
8895

8996
const surveyResponseNotification = (surveyResponse: string) => {
9097
client?.track(surveyResponse, client.getContext());
@@ -103,7 +110,6 @@ export default function Chatbot() {
103110
}
104111
}, [messages]);
105112

106-
//powered by
107113
return (
108114
<>
109115
<div className="fixed bottom-4 right-4 z-50">
@@ -117,7 +123,7 @@ export default function Chatbot() {
117123
<span className="sr-only">Open Chatbot</span>
118124
</Button>
119125
</div>
120-
{/* "fixed top-[calc(50%-150px)] left-[calc(90%-100px)] transform -translate-x-1/2 z-50" */}
126+
121127
{isOpen && (
122128
<div className="fixed inset-0 z-50 flex items-end justify-end p-4 sm:p-6 bottom-[50px]">
123129
<Card className="w-full max-w-md border-2 border-grey-400">
@@ -129,7 +135,9 @@ export default function Chatbot() {
129135
</Avatar>
130136
<div>
131137
<p className="text-sm font-medium leading-none">Chatbot Assistant</p>
132-
<p className="text-sm text-gray-500 dark:text-gray-400">Here to help!</p>
138+
<p className="text-sm text-gray-500 dark:text-gray-400">
139+
Powered by {aiModelName}
140+
</p>
133141
</div>
134142
</div>
135143
<div className="ml-auto flex items-center space-x-2">

components/chatbot/actions.js

-29
This file was deleted.

components/chatbot/actions.ts

-156
This file was deleted.

0 commit comments

Comments
 (0)