Skip to content
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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
"@fortawesome/free-solid-svg-icons": "^7.0.1",
"@fortawesome/react-fontawesome": "^3.0.2",
"@mistralai/mistralai": "^1.10.0",
"dompurify": "^3.2.7",
"lucide-react": "^0.544.0",
"next": "15.5.3",
"react": "19.1.0",
"react-dom": "19.1.0",
"supertest": "^7.1.4"
"supertest": "^7.1.4",
"zod": "^4.1.12"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
Expand Down
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

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

2 changes: 2 additions & 0 deletions src/components/ui/chat/ChatInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useRef, useLayoutEffect } from "react";
import { Mic, Plus } from "lucide-react";
import DOMPurify from "dompurify";

/**
* Hook: auto-resize a textarea ref to its content.
Expand Down Expand Up @@ -37,6 +38,7 @@ export function ChatInput({
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
prompt = DOMPurify.sanitize(prompt);
onSend();
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/chat/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ChatMessage } from "@/lib/types";

export function Message({ message }: { message: ChatMessage }) {
const isUser = message.role === "user";

// State for translation
const [translation, settranslation] = useState<string | null>(null);
const [showTranslation, setShowTranslation] = useState(false);
Expand Down Expand Up @@ -122,6 +122,7 @@ export function Message({ message }: { message: ChatMessage }) {
}
};


return (
<div className={`group flex ${isUser ? "justify-end" : "justify-start"} ${isDeleted ? 'hidden' : ''}`}>
{!isUser && (
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ export async function fetchWithRetry(url: string, options: RequestInit, maxRetri
}
}
}

throw new Error(`Failed after ${maxRetries} attempts: ${lastError?.message || 'Unknown error'}`);
throw new Error(`Failed after ${maxRetries} attempts: ${lastError ? lastError.message : 'Unknown error'}`);
}
Loading