feat(markdown): made gemini render in markdown

This commit is contained in:
JK-le-dev 2025-10-18 23:48:04 -05:00
commit 6fd667edb2
3 changed files with 9000 additions and 7846 deletions

16744
web-app/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,49 +1,50 @@
{ {
"name": "codered-astra", "name": "codered-astra",
"type": "module", "type": "module",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "vite build", "build": "vite build",
"dev": "vite", "dev": "vite",
"host": "vite host", "host": "vite host",
"format": "prettier --write \"**/*.{ts,tsx,md}\"", "format": "prettier --write \"**/*.{ts,tsx,md}\"",
"clean-dist": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r", "clean-dist": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r",
"clean-all": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r && find . -path ./node_modules -prune -o -name 'node_modules' | xargs rm -rf " "clean-all": "find apps/ -type d -name 'dist' -print0 | xargs -r0 -- rm -r && find . -path ./node_modules -prune -o -name 'node_modules' | xargs rm -rf "
}, },
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@google/genai": "^1.25.0", "@google/genai": "^1.25.0",
"@tailwindcss/postcss": "^4.1.14", "@tailwindcss/postcss": "^4.1.14",
"@tailwindcss/vite": "^4.1.14", "@tailwindcss/vite": "^4.1.14",
"@vitejs/plugin-react": "^5.0.4", "@vitejs/plugin-react": "^5.0.4",
"bootstrap": "^5.3.8", "bootstrap": "^5.3.8",
"bootstrap-icons": "^1.13.1", "bootstrap-icons": "^1.13.1",
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"express": "^5.1.0", "express": "^5.1.0",
"helmet": "^8.1.0", "helmet": "^8.1.0",
"lucide-react": "^0.546.0", "lucide-react": "^0.546.0",
"motion": "^12.23.24", "motion": "^12.23.24",
"pg": "^8.16.3", "pg": "^8.16.3",
"react": "^19.2.0", "react": "^19.2.0",
"react-bootstrap": "^2.10.10", "react-bootstrap": "^2.10.10",
"react-dom": "^19.2.0", "react-dom": "^19.2.0",
"react-router": "^7.9.4", "react-markdown": "^10.1.0",
"react-router-dom": "^7.9.4", "react-router": "^7.9.4",
"vite-jsconfig-paths": "^2.0.1" "react-router-dom": "^7.9.4",
}, "vite-jsconfig-paths": "^2.0.1"
"packageManager": ">=npm@10.9.0", },
"devDependencies": { "packageManager": ">=npm@10.9.0",
"@eslint/js": "^9.38.0", "devDependencies": {
"eslint": "^9.38.0", "@eslint/js": "^9.38.0",
"eslint-plugin-import": "^2.32.0", "eslint": "^9.38.0",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-import": "^2.32.0",
"eslint-plugin-react-hooks": "^7.0.0", "eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-refresh": "^0.4.24", "eslint-plugin-react-hooks": "^7.0.0",
"globals": "^16.4.0", "eslint-plugin-react-refresh": "^0.4.24",
"nodemon": "^3.1.10", "globals": "^16.4.0",
"prettier": "^3.6.2", "nodemon": "^3.1.10",
"tailwindcss": "^4.1.14", "prettier": "^3.6.2",
"vite": "^7.1.10" "tailwindcss": "^4.1.14",
} "vite": "^7.1.10"
}
} }

View file

@ -1,4 +1,5 @@
import React, { useRef, useEffect } from "react"; import React, { useRef, useEffect } from "react";
import ReactMarkdown from "react-markdown";
function MessageBubble({ message }) { function MessageBubble({ message }) {
const isUser = message.role === "user"; const isUser = message.role === "user";
@ -7,7 +8,11 @@ function MessageBubble({ message }) {
<div <div
className={`p-3 rounded-xl ${isUser ? "bg-indigo-600 text-white rounded-tr-sm" : "bg-gray-700 text-slate-100 rounded-tl-sm"}`} className={`p-3 rounded-xl ${isUser ? "bg-indigo-600 text-white rounded-tr-sm" : "bg-gray-700 text-slate-100 rounded-tl-sm"}`}
> >
<div className="text-sm">{message.content}</div> {isUser ? (
<div className="text-sm">{message.content}</div>
) : (
<ReactMarkdown>{message.content}</ReactMarkdown>
)}
</div> </div>
</div> </div>
); );