commit 5e4f0064ef7ada5fcb21bb07c9c4e0a93ef2dde5
Author: root <root@hub.scroll.pub>
Date: 2024-12-28 00:25:11 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..a07ff76
--- /dev/null
+++ b/body.html
@@ -0,0 +1,18 @@
+<header>
+ <h1>ChatBotDB</h1>
+ <p>Save your chat responses directly to MongoDB</p>
+</header>
+
+<main>
+ <section id="chat-container">
+ <div id="chat-history"></div>
+ <form id="chat-form">
+ <input type="text" id="user-input" placeholder="Type your message..." required>
+ <button type="submit">Send</button>
+ </form>
+ </section>
+</main>
+
+<footer>
+ <p>Simple, secure, and efficient chat storage</p>
+</footer>
\ No newline at end of file
diff --git a/index.scroll b/index.scroll
new file mode 100644
index 0000000..63de889
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,8 @@
+buildHtml
+baseUrl https://chatbotdb.scroll.pub
+metaTags
+editButton /edit.html
+title ChatBotDB - Save Chat Responses to MongoDB
+style.css
+body.html
+script.js
\ No newline at end of file
diff --git a/prompt.json b/prompt.json
new file mode 100644
index 0000000..71478d4
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,25 @@
+{
+ "id": "fa75b4f4-7e2c-4865-8d36-6ad14b035aef",
+ "object": "chat.completion",
+ "created": 1735345497,
+ "model": "deepseek-chat",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "---domain---\nchatbotdb.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://chatbotdb.scroll.pub\nmetaTags\neditButton /edit.html\ntitle ChatBotDB - Save Chat Responses to MongoDB\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>ChatBotDB</h1>\n <p>Save your chat responses directly to MongoDB</p>\n</header>\n\n<main>\n <section id=\"chat-container\">\n <div id=\"chat-history\"></div>\n <form id=\"chat-form\">\n <input type=\"text\" id=\"user-input\" placeholder=\"Type your message...\" required>\n <button type=\"submit\">Send</button>\n </form>\n </section>\n</main>\n\n<footer>\n <p>Simple, secure, and efficient chat storage</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #4CAF50;\n --secondary-color: #45a049;\n --background-color: #f4f4f4;\n --text-color: #333;\n --chat-bg: #fff;\n --user-bg: #e3f2fd;\n}\n\nbody {\n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n margin: 0;\n padding: 0;\n background-color: var(--background-color);\n color: var(--text-color);\n line-height: 1.6;\n}\n\nheader {\n background: var(--primary-color);\n color: white;\n padding: 2rem 1rem;\n text-align: center;\n}\n\nmain {\n max-width: 800px;\n margin: 2rem auto;\n padding: 1rem;\n}\n\n#chat-container {\n background: var(--chat-bg);\n border-radius: 8px;\n box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n padding: 1rem;\n}\n\n#chat-history {\n height: 400px;\n overflow-y: auto;\n margin-bottom: 1rem;\n padding: 1rem;\n border: 1px solid #ddd;\n border-radius: 4px;\n}\n\n.message {\n margin-bottom: 1rem;\n padding: 0.5rem 1rem;\n border-radius: 4px;\n}\n\n.user-message {\n background: var(--user-bg);\n margin-left: 20%;\n}\n\n.bot-message {\n background: var(--chat-bg);\n margin-right: 20%;\n}\n\n#chat-form {\n display: flex;\n gap: 0.5rem;\n}\n\n#user-input {\n flex: 1;\n padding: 0.5rem;\n border: 1px solid #ddd;\n border-radius: 4px;\n}\n\nbutton {\n background: var(--primary-color);\n color: white;\n border: none;\n padding: 0.5rem 1rem;\n border-radius: 4px;\n cursor: pointer;\n}\n\nbutton:hover {\n background: var(--secondary-color);\n}\n\nfooter {\n text-align: center;\n padding: 1rem;\n background: var(--primary-color);\n color: white;\n margin-top: 2rem;\n}\n\n@media (max-width: 600px) {\n #chat-history {\n height: 300px;\n }\n \n .user-message, .bot-message {\n margin-left: 0;\n margin-right: 0;\n }\n}\n---script.js---\nconst MONGODB_URI = 'mongodb+srv://dvaughnhouse:CRKV3zAwxL5SR614@cluster0.o3qrq.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0';\nconst PORT = 3000;\n\ndocument.getElementById('chat-form').addEventListener('submit', async (e) => {\n e.preventDefault();\n \n const userInput = document.getElementById('user-input').value;\n if (!userInput) return;\n\n // Add user message to chat history\n const chatHistory = document.getElementById('chat-history');\n const userMessage = document.createElement('div');\n userMessage.className = 'message user-message';\n userMessage.textContent = userInput;\n chatHistory.appendChild(userMessage);\n\n // Clear input\n document.getElementById('user-input').value = '';\n\n // Save to MongoDB\n try {\n const response = await fetch(`http://localhost:${PORT}/save`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ message: userInput }),\n });\n\n if (!response.ok) throw new Error('Failed to save message');\n\n const data = await response.json();\n const botMessage = document.createElement('div');\n botMessage.className = 'message bot-message';\n botMessage.textContent = `Message saved with ID: ${data.insertedId}`;\n chatHistory.appendChild(botMessage);\n } catch (error) {\n console.error('Error:', error);\n const errorMessage = document.createElement('div');\n errorMessage.className = 'message bot-message';\n errorMessage.textContent = 'Error saving message to database';\n chatHistory.appendChild(errorMessage);\n }\n\n // Scroll to bottom\n chatHistory.scrollTop = chatHistory.scrollHeight;\n});\n---end---"
+ },
+ "logprobs": null,
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 306,
+ "completion_tokens": 1162,
+ "total_tokens": 1468,
+ "prompt_cache_hit_tokens": 0,
+ "prompt_cache_miss_tokens": 306
+ },
+ "system_fingerprint": "fp_f1afce2943"
+}
\ No newline at end of file
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..9cde384
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# chatbotdb.scroll.pub
+Website generated by DeepSeek from prompt: create a chat bot that saves responses to mongo db: PORT=3000 MONGODB_URI=mongodb+srv://dvaughnhouse:CRKV3zAwxL5SR614@cluster0.o3qrq.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..779899d
--- /dev/null
+++ b/script.js
@@ -0,0 +1,47 @@
+const MONGODB_URI = 'mongodb+srv://dvaughnhouse:CRKV3zAwxL5SR614@cluster0.o3qrq.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0';
+const PORT = 3000;
+
+document.getElementById('chat-form').addEventListener('submit', async (e) => {
+ e.preventDefault();
+
+ const userInput = document.getElementById('user-input').value;
+ if (!userInput) return;
+
+ // Add user message to chat history
+ const chatHistory = document.getElementById('chat-history');
+ const userMessage = document.createElement('div');
+ userMessage.className = 'message user-message';
+ userMessage.textContent = userInput;
+ chatHistory.appendChild(userMessage);
+
+ // Clear input
+ document.getElementById('user-input').value = '';
+
+ // Save to MongoDB
+ try {
+ const response = await fetch(`http://localhost:${PORT}/save`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ message: userInput }),
+ });
+
+ if (!response.ok) throw new Error('Failed to save message');
+
+ const data = await response.json();
+ const botMessage = document.createElement('div');
+ botMessage.className = 'message bot-message';
+ botMessage.textContent = `Message saved with ID: ${data.insertedId}`;
+ chatHistory.appendChild(botMessage);
+ } catch (error) {
+ console.error('Error:', error);
+ const errorMessage = document.createElement('div');
+ errorMessage.className = 'message bot-message';
+ errorMessage.textContent = 'Error saving message to database';
+ chatHistory.appendChild(errorMessage);
+ }
+
+ // Scroll to bottom
+ chatHistory.scrollTop = chatHistory.scrollHeight;
+});
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..733653f
--- /dev/null
+++ b/style.css
@@ -0,0 +1,106 @@
+:root {
+ --primary-color: #4CAF50;
+ --secondary-color: #45a049;
+ --background-color: #f4f4f4;
+ --text-color: #333;
+ --chat-bg: #fff;
+ --user-bg: #e3f2fd;
+}
+
+body {
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
+ margin: 0;
+ padding: 0;
+ background-color: var(--background-color);
+ color: var(--text-color);
+ line-height: 1.6;
+}
+
+header {
+ background: var(--primary-color);
+ color: white;
+ padding: 2rem 1rem;
+ text-align: center;
+}
+
+main {
+ max-width: 800px;
+ margin: 2rem auto;
+ padding: 1rem;
+}
+
+#chat-container {
+ background: var(--chat-bg);
+ border-radius: 8px;
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+ padding: 1rem;
+}
+
+#chat-history {
+ height: 400px;
+ overflow-y: auto;
+ margin-bottom: 1rem;
+ padding: 1rem;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+}
+
+.message {
+ margin-bottom: 1rem;
+ padding: 0.5rem 1rem;
+ border-radius: 4px;
+}
+
+.user-message {
+ background: var(--user-bg);
+ margin-left: 20%;
+}
+
+.bot-message {
+ background: var(--chat-bg);
+ margin-right: 20%;
+}
+
+#chat-form {
+ display: flex;
+ gap: 0.5rem;
+}
+
+#user-input {
+ flex: 1;
+ padding: 0.5rem;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+}
+
+button {
+ background: var(--primary-color);
+ color: white;
+ border: none;
+ padding: 0.5rem 1rem;
+ border-radius: 4px;
+ cursor: pointer;
+}
+
+button:hover {
+ background: var(--secondary-color);
+}
+
+footer {
+ text-align: center;
+ padding: 1rem;
+ background: var(--primary-color);
+ color: white;
+ margin-top: 2rem;
+}
+
+@media (max-width: 600px) {
+ #chat-history {
+ height: 300px;
+ }
+
+ .user-message, .bot-message {
+ margin-left: 0;
+ margin-right: 0;
+ }
+}
\ No newline at end of file