Add markdown

This commit is contained in:
Nicolas Mowen 2026-02-12 19:19:22 -07:00
parent 56b3ebe791
commit cc941ab2db
4 changed files with 1168 additions and 6 deletions

1164
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -71,6 +71,7 @@
"react-icons": "^5.5.0", "react-icons": "^5.5.0",
"react-konva": "^18.2.10", "react-konva": "^18.2.10",
"react-router-dom": "^6.30.3", "react-router-dom": "^6.30.3",
"react-markdown": "^9.0.1",
"react-swipeable": "^7.0.2", "react-swipeable": "^7.0.2",
"react-tracked": "^2.0.1", "react-tracked": "^2.0.1",
"react-transition-group": "^4.4.5", "react-transition-group": "^4.4.5",

View File

@ -4,6 +4,7 @@ import { FaArrowUpLong } from "react-icons/fa6";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useState, useCallback } from "react"; import { useState, useCallback } from "react";
import axios from "axios"; import axios from "axios";
import ReactMarkdown from "react-markdown";
type ChatMessage = { role: "user" | "assistant"; content: string }; type ChatMessage = { role: "user" | "assistant"; content: string };
@ -57,7 +58,11 @@ export default function ChatPage() {
: "self-start rounded-lg bg-muted px-3 py-2" : "self-start rounded-lg bg-muted px-3 py-2"
} }
> >
{msg.content} {msg.role === "assistant" ? (
<ReactMarkdown>{msg.content}</ReactMarkdown>
) : (
msg.content
)}
</div> </div>
))} ))}
{isLoading && ( {isLoading && (

View File

@ -4,7 +4,7 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc"; import react from "@vitejs/plugin-react-swc";
import monacoEditorPlugin from "vite-plugin-monaco-editor"; import monacoEditorPlugin from "vite-plugin-monaco-editor";
const proxyHost = process.env.PROXY_HOST || "192.168.50.106:5002"; const proxyHost = process.env.PROXY_HOST || "1ocalhost:5000";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({