mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Add Daily and Weekly meta prompts to landing page with copy functionality
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
64d479ccce
commit
782d9f5f31
3 files changed
+163
-4
No files matched your search
@@ -9,6 +9,7 @@ const DIST_DIR = path.join(__dirname, 'dist');
|
||||
const LANDING_SRC = path.join(__dirname, 'landing');
|
||||
const DASHBOARD_SRC = path.join(__dirname, 'dashboard');
|
||||
const DOCS_SRC = path.join(__dirname, 'src', 'docs');
|
||||
const PROMPTS_SRC = path.join(__dirname, 'src', 'prompts', 'META_PROMPTS.md');
|
||||
const CONFIG_SRC = path.join(__dirname, 'torch-config.json');
|
||||
|
||||
// Ensure clean slate
|
||||
@@ -39,7 +40,14 @@ const distDocs = path.join(DIST_DIR, 'src', 'docs');
|
||||
fs.mkdirSync(distDocs, { recursive: true });
|
||||
fs.cpSync(DOCS_SRC, distDocs, { recursive: true });
|
||||
|
||||
// 4. Copy torch-config.json -> dist/torch-config.json (optional config)
|
||||
// 4. Copy src/prompts/META_PROMPTS.md -> dist/src/prompts/META_PROMPTS.md
|
||||
const distPromptsDir = path.join(DIST_DIR, 'src', 'prompts');
|
||||
fs.mkdirSync(distPromptsDir, { recursive: true });
|
||||
if (fs.existsSync(PROMPTS_SRC)) {
|
||||
fs.copyFileSync(PROMPTS_SRC, path.join(distPromptsDir, 'META_PROMPTS.md'));
|
||||
}
|
||||
|
||||
// 5. Copy torch-config.json -> dist/torch-config.json (optional config)
|
||||
if (fs.existsSync(CONFIG_SRC)) {
|
||||
fs.copyFileSync(CONFIG_SRC, path.join(DIST_DIR, 'torch-config.json'));
|
||||
}
|
||||
|
||||
@@ -250,6 +250,89 @@
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Meta Prompts Section */
|
||||
.meta-prompts {
|
||||
max-width: 1200px;
|
||||
margin: 4rem auto;
|
||||
padding: 0 2rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.meta-prompts h2 {
|
||||
text-align: center;
|
||||
font-size: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
color: var(--text-strong);
|
||||
}
|
||||
|
||||
.prompts-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.prompt-card {
|
||||
background: var(--surface-alt);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 1rem;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.prompt-header {
|
||||
padding: 1rem 1.5rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.prompt-title {
|
||||
font-weight: 600;
|
||||
color: var(--text-strong);
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
background: transparent;
|
||||
border: 1px solid var(--border);
|
||||
color: var(--muted);
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.copy-btn:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.prompt-content {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: #0d1117;
|
||||
overflow: auto;
|
||||
max-height: 400px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.prompt-content pre {
|
||||
margin: 0;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.prompt-content code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||
font-size: 0.85rem;
|
||||
color: #e6edf3;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: auto;
|
||||
padding: 2rem;
|
||||
@@ -307,6 +390,30 @@
|
||||
<div class="feature-desc">Powered by Nostr for secure, distributed task orchestration.</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="meta-prompts">
|
||||
<h2>Scheduler Meta Prompts</h2>
|
||||
<div class="prompts-grid">
|
||||
<div class="prompt-card">
|
||||
<div class="prompt-header">
|
||||
<span class="prompt-title">Daily Scheduler</span>
|
||||
<button class="copy-btn" onclick="copyToClipboard('daily-code', this)">Copy</button>
|
||||
</div>
|
||||
<div class="prompt-content">
|
||||
<pre><code id="daily-code">Loading...</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="prompt-card">
|
||||
<div class="prompt-header">
|
||||
<span class="prompt-title">Weekly Scheduler</span>
|
||||
<button class="copy-btn" onclick="copyToClipboard('weekly-code', this)">Copy</button>
|
||||
</div>
|
||||
<div class="prompt-content">
|
||||
<pre><code id="weekly-code">Loading...</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
@@ -369,6 +476,53 @@
|
||||
contentDiv.innerHTML = `<p class="text-danger">Error loading documentation: ${error.message}</p>`;
|
||||
}
|
||||
}
|
||||
|
||||
// Meta Prompts Logic
|
||||
async function fetchMetaPrompts() {
|
||||
try {
|
||||
const response = await fetch('src/prompts/META_PROMPTS.md');
|
||||
if (!response.ok) throw new Error('Failed to load prompts');
|
||||
const text = await response.text();
|
||||
|
||||
// Regex to capture content between ```text and ``` inside the headers
|
||||
// strict on the header, loose on the code block language (text, markdown, or none)
|
||||
const dailyMatch = text.match(/## Daily Scheduler Meta Prompt[\s\S]*?```\w*([\s\S]*?)```/);
|
||||
const weeklyMatch = text.match(/## Weekly Scheduler Meta Prompt[\s\S]*?```\w*([\s\S]*?)```/);
|
||||
|
||||
if (dailyMatch && dailyMatch[1]) {
|
||||
document.getElementById('daily-code').textContent = dailyMatch[1].trim();
|
||||
}
|
||||
|
||||
if (weeklyMatch && weeklyMatch[1]) {
|
||||
document.getElementById('weekly-code').textContent = weeklyMatch[1].trim();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching meta prompts:', error);
|
||||
document.getElementById('daily-code').textContent = 'Error loading prompt.';
|
||||
document.getElementById('weekly-code').textContent = 'Error loading prompt.';
|
||||
}
|
||||
}
|
||||
|
||||
function copyToClipboard(elementId, btn) {
|
||||
const code = document.getElementById(elementId).textContent;
|
||||
navigator.clipboard.writeText(code).then(() => {
|
||||
const originalText = btn.textContent;
|
||||
btn.textContent = 'Copied!';
|
||||
btn.style.borderColor = 'var(--success)';
|
||||
btn.style.color = 'var(--success)';
|
||||
|
||||
setTimeout(() => {
|
||||
btn.textContent = originalText;
|
||||
btn.style.borderColor = '';
|
||||
btn.style.color = '';
|
||||
}, 2000);
|
||||
}).catch(err => {
|
||||
console.error('Failed to copy text: ', err);
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize Meta Prompts
|
||||
fetchMetaPrompts();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +0,0 @@
|
||||
127.0.0.1 - - [14/Feb/2026 03:58:05] "GET /landing/index.html HTTP/1.1" 200 -
|
||||
127.0.0.1 - - [14/Feb/2026 03:58:05] "GET /dashboard/styles.css HTTP/1.1" 200 -
|
||||
127.0.0.1 - - [14/Feb/2026 03:58:06] "GET /src/docs/TORCH.md HTTP/1.1" 200 -
|
||||
Reference in new issue
Block a user