mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Fix meta prompts rendering on landing page
Updated the regex used to parse `META_PROMPTS.md` in `landing/index.html` to be more robust against variations in newline and language identifier formatting. Added error handling to display "Prompt format mismatch" instead of leaving the element in a "Loading..." state if parsing fails. This ensures users can access the scheduler prompts even if minor formatting differences occur. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
a7a7679223
commit
3d66cd885f
2 files changed
+10
-2
No files matched your search
+10
-2
@@ -1195,15 +1195,23 @@ npm install https://github.com/PR0M3TH3AN/TORCH/archive/refs/heads/main.tar.gz &
|
||||
|
||||
// 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]*?)```/);
|
||||
// Using non-capturing group (?:[^\n\r]*)? for optional language hint on the same line
|
||||
// followed by newline(s) to start content capture
|
||||
const dailyMatch = text.match(/## Daily Scheduler Meta Prompt[\s\S]*?```(?:[^\n\r]*)?[\r\n]+([\s\S]*?)```/);
|
||||
const weeklyMatch = text.match(/## Weekly Scheduler Meta Prompt[\s\S]*?```(?:[^\n\r]*)?[\r\n]+([\s\S]*?)```/);
|
||||
|
||||
if (dailyMatch && dailyMatch[1]) {
|
||||
document.getElementById('daily-code').textContent = dailyMatch[1].trim();
|
||||
} else {
|
||||
console.warn('Daily prompt regex mismatch');
|
||||
document.getElementById('daily-code').textContent = 'Error: Daily prompt format mismatch in META_PROMPTS.md';
|
||||
}
|
||||
|
||||
if (weeklyMatch && weeklyMatch[1]) {
|
||||
document.getElementById('weekly-code').textContent = weeklyMatch[1].trim();
|
||||
} else {
|
||||
console.warn('Weekly prompt regex mismatch');
|
||||
document.getElementById('weekly-code').textContent = 'Error: Weekly prompt format mismatch in META_PROMPTS.md';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching meta prompts:', error);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Reference in new issue
Block a user