diff --git a/frontend/src/components/DocumentChunks.tsx b/frontend/src/components/DocumentChunks.tsx index b56e1514..f29941d2 100644 --- a/frontend/src/components/DocumentChunks.tsx +++ b/frontend/src/components/DocumentChunks.tsx @@ -154,6 +154,10 @@ const DocumentChunks: React.FC = ({ }; const handleAddChunk = (title: string, text: string) => { + if (!text.trim()) { + return; + } + try { const metadata = { source: path || documentName, @@ -182,6 +186,18 @@ const DocumentChunks: React.FC = ({ }; const handleUpdateChunk = (title: string, text: string, chunk: ChunkType) => { + + if (!text.trim()) { + return; + } + + const originalTitle = chunk.metadata?.title || ''; + const originalText = chunk.text || ''; + + if (title === originalTitle && text === originalText) { + return; + } + try { userService .updateChunk( @@ -326,11 +342,23 @@ const DocumentChunks: React.FC = ({ @@ -349,10 +377,17 @@ const DocumentChunks: React.FC = ({