Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chatbot in dark mode #67

Merged
merged 2 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions components/chat/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import {
HStack,
Icon,
IconButton,
Stack,
Textarea,
useColorModeValue,
} from "@chakra-ui/react";
import { TbSend } from "react-icons/tb";
import autosize from "autosize";
import { BeatLoader } from "react-spinners";

export default function ChatInput({ isLoading, onSubmit, ...properties }) {
const backgroundColor = useColorModeValue("gray.100", "#2F3239");
const backgroundColor = useColorModeValue("gray.100", "gray.600");
const loaderColor = useColorModeValue("gray.100", "white");
const iconColor = useColorModeValue("gray.500", "white");
const [message, setMessage] = useState();
const textareaReference = useRef();
Expand Down Expand Up @@ -64,14 +67,24 @@ export default function ChatInput({ isLoading, onSubmit, ...properties }) {
outline="none"
resize="none"
/>
<IconButton
alignSelf="flex-end"
variant="ghost"
size="sm"
isLoading={isLoading}
onClick={() => onSubmit(message)}
icon={<Icon as={TbSend} color={iconColor} fontSize="lg" />}
/>
{isLoading ? (
<Stack
alignSelf="flex-end"
alignItems="center"
jusityContent="center"
height="20px"
>
<BeatLoader color={loaderColor} size={5} />
</Stack>
) : (
<IconButton
alignSelf="flex-end"
variant="ghost"
size="sm"
onClick={() => onSubmit(message)}
icon={<Icon as={TbSend} color={iconColor} fontSize="lg" />}
/>
)}
</HStack>
</Container>
);
Expand Down
2 changes: 1 addition & 1 deletion components/chat/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { TbCopy } from "react-icons/tb";

export default function ChatOuput({ messages, isLoading, ...properties }) {
const loaderColor = useColorModeValue("gray.100", "white");
const unevenBackgroundColor = useColorModeValue("gray.100", "#2F3239");
const unevenBackgroundColor = useColorModeValue("gray.100", "gray.600");
const lastMessageReference = useRef();

useEffect(() => {
Expand Down
181 changes: 70 additions & 111 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "langchain-ui",
"version": "0.0.1",
"engines": {
"node": ">=18"
},
"node": ">=18"
},
"private": true,
"scripts": {
"dev": "next dev",
Expand Down Expand Up @@ -34,7 +34,7 @@
"install": "^0.13.0",
"ky": "^0.33.3",
"langchain": "^0.0.48",
"next": "13.2.4",
"next": "^13.3.0",
"next-auth": "^4.20.1",
"npm": "^9.6.3",
"react": "18.2.0",
Expand Down