commit 266c166d25e0e9c18e2af7d04026c7f4a23d15fb
Author: root <root@hub.scroll.pub>
Date: 2024-12-28 23:57:42 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..d5a9466
--- /dev/null
+++ b/body.html
@@ -0,0 +1,35 @@
+<header>
+ <h1>实验助手</h1>
+ <p>在线调用本地摄像头,加载实验指导书,通过语音交互指导实验</p>
+</header>
+
+<main>
+ <section class="camera-section">
+ <h2>摄像头</h2>
+ <div class="camera-container">
+ <video id="camera-feed" autoplay></video>
+ <button id="start-camera">开启摄像头</button>
+ </div>
+ </section>
+
+ <section class="document-section">
+ <h2>实验指导书</h2>
+ <div class="document-upload">
+ <input type="file" id="document-upload" accept=".pdf,.doc,.docx">
+ <label for="document-upload" class="upload-button">上传指导书</label>
+ </div>
+ <iframe id="document-viewer" class="hidden"></iframe>
+ </section>
+
+ <section class="voice-section">
+ <h2>语音指导</h2>
+ <div class="voice-controls">
+ <button id="start-voice">开始语音指导</button>
+ <button id="stop-voice" class="hidden">停止语音指导</button>
+ </div>
+ </section>
+</main>
+
+<footer>
+ <p>实验助手 - 让实验更简单</p>
+</footer>
\ No newline at end of file
diff --git a/index.scroll b/index.scroll
new file mode 100644
index 0000000..e0dd386
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,8 @@
+buildHtml
+baseUrl https://labassist.scroll.pub
+metaTags
+editButton /edit.html
+title 实验助手 - 在线实验指导
+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..26e0851
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,25 @@
+{
+ "id": "275c56e6-6e6c-45d9-b945-8aa758618fef",
+ "object": "chat.completion",
+ "created": 1735430243,
+ "model": "deepseek-chat",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "---domain---\nlabassist.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://labassist.scroll.pub\nmetaTags\neditButton /edit.html\ntitle 实验助手 - 在线实验指导\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>实验助手</h1>\n <p>在线调用本地摄像头,加载实验指导书,通过语音交互指导实验</p>\n</header>\n\n<main>\n <section class=\"camera-section\">\n <h2>摄像头</h2>\n <div class=\"camera-container\">\n <video id=\"camera-feed\" autoplay></video>\n <button id=\"start-camera\">开启摄像头</button>\n </div>\n </section>\n\n <section class=\"document-section\">\n <h2>实验指导书</h2>\n <div class=\"document-upload\">\n <input type=\"file\" id=\"document-upload\" accept=\".pdf,.doc,.docx\">\n <label for=\"document-upload\" class=\"upload-button\">上传指导书</label>\n </div>\n <iframe id=\"document-viewer\" class=\"hidden\"></iframe>\n </section>\n\n <section class=\"voice-section\">\n <h2>语音指导</h2>\n <div class=\"voice-controls\">\n <button id=\"start-voice\">开始语音指导</button>\n <button id=\"stop-voice\" class=\"hidden\">停止语音指导</button>\n </div>\n </section>\n</main>\n\n<footer>\n <p>实验助手 - 让实验更简单</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #4CAF50;\n --secondary-color: #45a049;\n --background-color: #f5f5f5;\n --text-color: #333;\n --white: #fff;\n}\n\nbody {\n font-family: 'Segoe UI', 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-color: var(--primary-color);\n color: var(--white);\n padding: 2rem;\n text-align: center;\n}\n\nh1 {\n margin: 0;\n font-size: 2.5rem;\n}\n\nmain {\n max-width: 1200px;\n margin: 2rem auto;\n padding: 0 1rem;\n}\n\nsection {\n margin-bottom: 2rem;\n background-color: var(--white);\n padding: 1.5rem;\n border-radius: 8px;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n}\n\n.camera-container {\n position: relative;\n width: 100%;\n max-width: 640px;\n margin: 0 auto;\n}\n\n#camera-feed {\n width: 100%;\n height: auto;\n border-radius: 8px;\n display: none;\n}\n\nbutton {\n background-color: var(--primary-color);\n color: var(--white);\n border: none;\n padding: 0.8rem 1.5rem;\n border-radius: 4px;\n cursor: pointer;\n font-size: 1rem;\n transition: background-color 0.3s ease;\n}\n\nbutton:hover {\n background-color: var(--secondary-color);\n}\n\n.document-upload {\n text-align: center;\n margin: 1rem 0;\n}\n\n.upload-button {\n display: inline-block;\n padding: 0.8rem 1.5rem;\n cursor: pointer;\n}\n\n#document-viewer {\n width: 100%;\n height: 500px;\n border: 1px solid #ddd;\n border-radius: 8px;\n margin-top: 1rem;\n}\n\n.voice-controls {\n text-align: center;\n}\n\n.hidden {\n display: none;\n}\n\nfooter {\n text-align: center;\n padding: 1rem;\n background-color: var(--primary-color);\n color: var(--white);\n margin-top: 2rem;\n}\n\n@media (max-width: 768px) {\n h1 {\n font-size: 2rem;\n }\n \n #document-viewer {\n height: 300px;\n }\n}\n---script.js---\n// Camera functionality\nconst video = document.getElementById('camera-feed');\nconst startCameraBtn = document.getElementById('start-camera');\n\nstartCameraBtn.addEventListener('click', async () => {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ video: true });\n video.srcObject = stream;\n video.style.display = 'block';\n startCameraBtn.style.display = 'none';\n } catch (error) {\n alert('无法访问摄像头,请确保已授予权限');\n }\n});\n\n// Document upload functionality\nconst documentUpload = document.getElementById('document-upload');\nconst documentViewer = document.getElementById('document-viewer');\n\ndocumentUpload.addEventListener('change', (event) => {\n const file = event.target.files[0];\n if (file) {\n const fileURL = URL.createObjectURL(file);\n documentViewer.src = fileURL;\n documentViewer.classList.remove('hidden');\n }\n});\n\n// Voice functionality\nconst startVoiceBtn = document.getElementById('start-voice');\nconst stopVoiceBtn = document.getElementById('stop-voice');\nlet recognition;\n\nif ('webkitSpeechRecognition' in window) {\n recognition = new webkitSpeechRecognition();\n recognition.continuous = true;\n recognition.interimResults = true;\n recognition.lang = 'zh-CN';\n\n recognition.onstart = () => {\n startVoiceBtn.classList.add('hidden');\n stopVoiceBtn.classList.remove('hidden');\n };\n\n recognition.onend = () => {\n startVoiceBtn.classList.remove('hidden');\n stopVoiceBtn.classList.add('hidden');\n };\n\n recognition.onresult = (event) => {\n // Handle voice commands here\n console.log(event.results);\n };\n\n startVoiceBtn.addEventListener('click', () => {\n recognition.start();\n });\n\n stopVoiceBtn.addEventListener('click', () => {\n recognition.stop();\n });\n} else {\n startVoiceBtn.disabled = true;\n startVoiceBtn.textContent = '语音识别不可用';\n}\n---end---"
+ },
+ "logprobs": null,
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 264,
+ "completion_tokens": 1376,
+ "total_tokens": 1640,
+ "prompt_cache_hit_tokens": 0,
+ "prompt_cache_miss_tokens": 264
+ },
+ "system_fingerprint": "fp_f1afce2943"
+}
\ No newline at end of file
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..0a5145c
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# labassist.scroll.pub
+Website generated by DeepSeek from prompt: 中文网站,在线调用本地摄像头,加载PDF或WORD版本的实验指导书,通过语音交互,指导摄像头里的人按实验指导书进行试验
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..e2c5ed6
--- /dev/null
+++ b/script.js
@@ -0,0 +1,65 @@
+// Camera functionality
+const video = document.getElementById('camera-feed');
+const startCameraBtn = document.getElementById('start-camera');
+
+startCameraBtn.addEventListener('click', async () => {
+ try {
+ const stream = await navigator.mediaDevices.getUserMedia({ video: true });
+ video.srcObject = stream;
+ video.style.display = 'block';
+ startCameraBtn.style.display = 'none';
+ } catch (error) {
+ alert('无法访问摄像头,请确保已授予权限');
+ }
+});
+
+// Document upload functionality
+const documentUpload = document.getElementById('document-upload');
+const documentViewer = document.getElementById('document-viewer');
+
+documentUpload.addEventListener('change', (event) => {
+ const file = event.target.files[0];
+ if (file) {
+ const fileURL = URL.createObjectURL(file);
+ documentViewer.src = fileURL;
+ documentViewer.classList.remove('hidden');
+ }
+});
+
+// Voice functionality
+const startVoiceBtn = document.getElementById('start-voice');
+const stopVoiceBtn = document.getElementById('stop-voice');
+let recognition;
+
+if ('webkitSpeechRecognition' in window) {
+ recognition = new webkitSpeechRecognition();
+ recognition.continuous = true;
+ recognition.interimResults = true;
+ recognition.lang = 'zh-CN';
+
+ recognition.onstart = () => {
+ startVoiceBtn.classList.add('hidden');
+ stopVoiceBtn.classList.remove('hidden');
+ };
+
+ recognition.onend = () => {
+ startVoiceBtn.classList.remove('hidden');
+ stopVoiceBtn.classList.add('hidden');
+ };
+
+ recognition.onresult = (event) => {
+ // Handle voice commands here
+ console.log(event.results);
+ };
+
+ startVoiceBtn.addEventListener('click', () => {
+ recognition.start();
+ });
+
+ stopVoiceBtn.addEventListener('click', () => {
+ recognition.stop();
+ });
+} else {
+ startVoiceBtn.disabled = true;
+ startVoiceBtn.textContent = '语音识别不可用';
+}
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..b6adfc3
--- /dev/null
+++ b/style.css
@@ -0,0 +1,116 @@
+:root {
+ --primary-color: #4CAF50;
+ --secondary-color: #45a049;
+ --background-color: #f5f5f5;
+ --text-color: #333;
+ --white: #fff;
+}
+
+body {
+ font-family: 'Segoe UI', sans-serif;
+ margin: 0;
+ padding: 0;
+ background-color: var(--background-color);
+ color: var(--text-color);
+ line-height: 1.6;
+}
+
+header {
+ background-color: var(--primary-color);
+ color: var(--white);
+ padding: 2rem;
+ text-align: center;
+}
+
+h1 {
+ margin: 0;
+ font-size: 2.5rem;
+}
+
+main {
+ max-width: 1200px;
+ margin: 2rem auto;
+ padding: 0 1rem;
+}
+
+section {
+ margin-bottom: 2rem;
+ background-color: var(--white);
+ padding: 1.5rem;
+ border-radius: 8px;
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
+}
+
+.camera-container {
+ position: relative;
+ width: 100%;
+ max-width: 640px;
+ margin: 0 auto;
+}
+
+#camera-feed {
+ width: 100%;
+ height: auto;
+ border-radius: 8px;
+ display: none;
+}
+
+button {
+ background-color: var(--primary-color);
+ color: var(--white);
+ border: none;
+ padding: 0.8rem 1.5rem;
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 1rem;
+ transition: background-color 0.3s ease;
+}
+
+button:hover {
+ background-color: var(--secondary-color);
+}
+
+.document-upload {
+ text-align: center;
+ margin: 1rem 0;
+}
+
+.upload-button {
+ display: inline-block;
+ padding: 0.8rem 1.5rem;
+ cursor: pointer;
+}
+
+#document-viewer {
+ width: 100%;
+ height: 500px;
+ border: 1px solid #ddd;
+ border-radius: 8px;
+ margin-top: 1rem;
+}
+
+.voice-controls {
+ text-align: center;
+}
+
+.hidden {
+ display: none;
+}
+
+footer {
+ text-align: center;
+ padding: 1rem;
+ background-color: var(--primary-color);
+ color: var(--white);
+ margin-top: 2rem;
+}
+
+@media (max-width: 768px) {
+ h1 {
+ font-size: 2rem;
+ }
+
+ #document-viewer {
+ height: 300px;
+ }
+}
\ No newline at end of file