diff --git a/package.json b/package.json index ef2d2bf..3a059b9 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,14 @@ "axios": "^1.9.0", "code-editor": "file:", "framer-motion": "^12.12.2", + "groq-sdk": "^0.37.0", "install": "^0.13.0", "npm": "^11.4.1", "react": "^19.0.0", "react-dom": "^19.0.0", - "react-icons": "^5.5.0" + "react-icons": "^5.5.0", + "react-markdown": "^10.1.0", + "react-syntax-highlighter": "^16.1.0" }, "devDependencies": { "@eslint/js": "^9.21.0", diff --git a/src/components/ChatBot/ChatBubble.jsx b/src/components/ChatBot/ChatBubble.jsx new file mode 100644 index 0000000..4a5c17b --- /dev/null +++ b/src/components/ChatBot/ChatBubble.jsx @@ -0,0 +1,40 @@ +// src/components/ChatBot/ChatBubble.jsx +import React from "react"; +import ReactMarkdown from "react-markdown"; +import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; +import { materialDark } from "react-syntax-highlighter/dist/esm/styles/prism"; + +export default function ChatBubble({ message }) { + return ( +
+ + {children} + + ) : ( + + {children} + + ); + }, + }} + > + {message.content} + +
+ ); +} diff --git a/src/components/ChatBot/ChatInput.jsx b/src/components/ChatBot/ChatInput.jsx new file mode 100644 index 0000000..b788116 --- /dev/null +++ b/src/components/ChatBot/ChatInput.jsx @@ -0,0 +1,32 @@ +// src/components/ChatBot/ChatInput.jsx +import React, { useState } from "react"; + +export default function ChatInput({ onSend }) { + const [text, setText] = useState(""); + + const handleSend = () => { + if (text.trim()) { + onSend(text); + setText(""); + } + }; + + const handleKeyDown = (e) => { + if (e.key === "Enter" && !e.shiftKey) { + e.preventDefault(); + handleSend(); + } + }; + + return ( +
+