Spaces:
Configuration error
Configuration error
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>RAG Chatbot Interface</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
<style href="style.css"></style> | |
</head> | |
<body class="bg-gray-50 min-h-screen"> | |
<div class="container mx-auto px-4 py-8 max-w-6xl"> | |
<header class="mb-8"> | |
<h1 class="text-3xl font-bold text-indigo-700">Legal Contract Analyzer</h1> | |
<p class="text-gray-600">Upload contracts, ask and get precise answers.</p> | |
</header> | |
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> | |
<!-- Left sidebar - Upload and Settings --> | |
<div class="lg:col-span-1 space-y-6"> | |
<!-- Document Upload Section --> | |
<div class="bg-white rounded-xl shadow-md p-6"> | |
<h2 class="text-xl font-semibold mb-4 text-gray-800">Upload Documents</h2> | |
<div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-4"> | |
<i class="fas fa-file-pdf text-4xl text-indigo-500 mb-3"></i> | |
<p class="text-gray-600 mb-2">Drag & drop PDF files here</p> | |
<p class="text-sm text-gray-500">or</p> | |
<input type="file" id="fileInput" class="hidden" accept=".pdf" multiple> | |
<button id="selectFilesBtn" class="mt-3 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition"> | |
Select Files | |
</button> | |
</div> | |
<div id="fileList" class="space-y-2 max-h-40 overflow-y-auto"></div> | |
</div> | |
<!-- System Prompt Section --> | |
<div class="bg-white rounded-xl shadow-md p-6"> | |
<h2 class="text-xl font-semibold mb-4 text-gray-800">System Prompt</h2> | |
<textarea id="systemPrompt" rows="5" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-indigo-500 focus:border-indigo-500" placeholder="You are an assistant who analyses legal contracts and provides precise answers without making up new information...">You are an assistant who analyses documents and provides precise answers based strictly on the provided content without making up new information.</textarea> | |
<button id="savePromptBtn" class="mt-3 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition w-full"> | |
Save Prompt | |
</button> | |
</div> | |
<!-- Status Section --> | |
<div class="bg-white rounded-xl shadow-md p-6"> | |
<h2 class="text-xl font-semibold mb-4 text-gray-800">System Status</h2> | |
<div id="statusMessage" class="flex items-center p-3 rounded-lg bg-gray-100"> | |
<div id="statusIndicator" class="w-3 h-3 rounded-full mr-2 bg-gray-400 status-pulse"></div> | |
<span id="statusText" class="text-sm">Ready to upload documents</span> | |
</div> | |
<div class="mt-4 grid grid-cols-2 gap-2"> | |
<div class="bg-indigo-50 p-3 rounded-lg"> | |
<p class="text-xs text-indigo-600">Documents</p> | |
<p id="docCount" class="font-bold">0</p> | |
</div> | |
<div class="bg-indigo-50 p-3 rounded-lg"> | |
<p class="text-xs text-indigo-600">Embeddings</p> | |
<p id="embeddingStatus" class="font-bold">None</p> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Main Chat Area --> | |
<div class="lg:col-span-2"> | |
<div class="bg-white rounded-xl shadow-md overflow-hidden h-full flex flex-col"> | |
<!-- Chat Header --> | |
<div class="border-b p-4 bg-indigo-50"> | |
<h2 class="text-xl font-semibold text-gray-800">Chat Dashboard</h2> | |
</div> | |
<!-- Chat Messages --> | |
<div id="chatContainer" class="flex-1 p-4 overflow-y-auto space-y-4"> | |
<div class="flex justify-center"> | |
<div class="bg-indigo-100 text-indigo-800 px-4 py-2 rounded-full text-sm"> | |
Upload documents and start chatting | |
</div> | |
</div> | |
<!-- Messages will be inserted here dynamically --> | |
</div> | |
<!-- Input Area --> | |
<div class="border-t p-4 bg-gray-50"> | |
<div class="flex items-center space-x-2"> | |
<input id="userInput" type="text" placeholder="Type your question here..." class="flex-1 px-4 py-3 border border-gray-300 rounded-full focus:ring-indigo-500 focus:border-indigo-500" disabled> | |
<button id="sendBtn" class="w-12 h-12 bg-indigo-600 text-white rounded-full flex items-center justify-center hover:bg-indigo-700 transition disabled:opacity-50" disabled> | |
<i class="fas fa-paper-plane"></i> | |
</button> | |
</div> | |
<p class="text-xs text-gray-500 mt-2 text-center">Press Enter to send</p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script src="https://cdn.jsdelivr.net/npm/showdown@2.1.0/dist/showdown.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.6/dist/purify.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script> | |
<script src="get_api_keys.js"></script> | |
<script src="file_manager.js"></script> | |
<script src="chat.js"></script> | |
<script src="script.js"></script> | |
</body> | |
</html> |