Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1960adb
Add prompt guessing game initial structure
mentatbot[bot] Jan 16, 2025
8e9cb95
Implement prompt guessing game functionality
mentatbot[bot] Jan 16, 2025
d7f7765
Add game instructions and hint system
mentatbot[bot] Jan 16, 2025
18a094c
Fix build configuration and directory structure
mentatbot[bot] Jan 16, 2025
68be43a
Update deploy-apps.yml
voodoohop Jan 17, 2025
38eaf60
Update utils.js
voodoohop Jan 17, 2025
78b55d4
Update vite.config.js
voodoohop Jan 17, 2025
ce4f3f8
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop Jan 17, 2025
978a7ee
Update vite.config.js
voodoohop Jan 17, 2025
775d517
Update vite.config.js
voodoohop Jan 17, 2025
2046ac5
Update vite.config.js
voodoohop Jan 17, 2025
bc87a8c
Crop
voodoohop Jan 17, 2025
81f1450
Add svg feedback experiment
voodoohop Jan 17, 2025
b4c9f32
Update index.html
voodoohop Jan 17, 2025
4c9c876
Update index.html
voodoohop Jan 17, 2025
7123bda
Update index.html
voodoohop Jan 17, 2025
2fcdbc2
Update index.html
voodoohop Jan 17, 2025
68b6bf3
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop Jan 17, 2025
3177b83
Update index.html
voodoohop Jan 17, 2025
6caa377
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop Jan 17, 2025
7e993fd
Beautiful version
voodoohop Jan 17, 2025
c15e53d
Update index.html
voodoohop Jan 17, 2025
54a62c2
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop Jan 17, 2025
55df13c
Update index.html
voodoohop Jan 17, 2025
aeca570
initial svg state
voodoohop Jan 17, 2025
47cf8fb
save preset too
voodoohop Jan 17, 2025
8bc7de5
Update index.html
voodoohop Jan 17, 2025
8f9b7ca
Update index.html
voodoohop Jan 17, 2025
4f91539
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop Jan 17, 2025
a46fc28
Update index.html
voodoohop Jan 17, 2025
04640df
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop Jan 17, 2025
571251e
Update index.html
voodoohop Jan 17, 2025
aecaecb
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop Jan 17, 2025
645ba27
Update SVG dimensions to 100% width and height
voodoohop Jan 17, 2025
34eb5f7
Extract js
voodoohop Jan 17, 2025
bdd44aa
revert script to html file
voodoohop Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions svg-feedback/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ <h1>LLM SVG Art Evolution</h1>
<h2>History</h2>
<div id="history"></div>
</div>
<script src="script.js"></script>

<script>
const elements = {
Expand Down Expand Up @@ -251,11 +252,9 @@ <h2>History</h2>
const maxRetries = 3;
const model = getSelectedModel();
const temperature = parseFloat(elements.temperature.value);
const seed = parseInt(elements.seed.value) >= 0 ?
parseInt(elements.seed.value) :
currentSeed++; // Use and increment the current seed
const seed = currentSeed;// + retryCount; // Increment seed based on retry count

const systemPrompt = `You are an animated SVG art generator. Create SVG code that fits within a 800x600 viewBox.
const systemPrompt = `You are an animated SVG art generator. Create SVG code with 100% width and height.
Follow these rules:
0. Your code should be inspired by the demoscene. Self-containted. Small. Re-using elements and groups creatively.
1. Always start with <?xml version="1.0" encoding="UTF-8"?> and proper SVG tags
Expand All @@ -266,7 +265,8 @@ <h2>History</h2>
6. Return ONLY the SVG code wrapped in \`\`\`svg code blocks
7. animations should be slow and fluid
8. please add directions for the next evolution as explanation underneath the svg

9. The svg should have width and height 100%
10. The background is dark
Creative Direction: ${prompt}`;

const userMessage = currentState ?
Expand Down Expand Up @@ -304,11 +304,8 @@ <h2>History</h2>
const svgContent = extractSvgContent(text);

// Validate SVG completeness
if (!svgContent) {
throw new Error('No valid SVG content found in response');
}

if (!svgContent.includes('</svg>')) {
if (!svgContent || !svgContent.includes('</svg>')) {
throw new Error('Incomplete SVG content');
}

Expand All @@ -318,6 +315,7 @@ <h2>History</h2>

} catch (error) {
console.error('Error:', error);
currentSeed++;
if (retryCount < maxRetries) {
console.log(`Retry ${retryCount + 1}/${maxRetries}: ${error.message}`);
return generateText(prompt, currentState, retryCount + 1);
Expand Down Expand Up @@ -382,6 +380,10 @@ <h2>History</h2>
isRunning = true;
elements.start.disabled = true;
elements.stop.disabled = false;

if (parseInt(elements.seed.value) >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The seed initialization should validate that the parsed value is a finite number to prevent potential issues with NaN or Infinity. Consider adding validation using !isNaN() and isFinite(). Here's how:

if (!isNaN(parseInt(elements.seed.value)) && isFinite(parseInt(elements.seed.value)) && parseInt(elements.seed.value) >= 0) {
    initialSeed = parseInt(elements.seed.value);    
}

initialSeed = parseInt(elements.seed.value);
}

frames = [];
frameIndex = 0;
Expand Down Expand Up @@ -435,7 +437,7 @@ <h2>History</h2>
temperature: elements.temperature.value,
initialSvg: elements.initialSvg.value,
model: elements.modelSelect.value,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change to store initialSeed instead of currentSeed in presets, as it represents the starting point of the evolution sequence. However, consider adding a comment explaining why we store initialSeed rather than currentSeed to make the intent clear for future maintainers.

seed: currentSeed
seed: initialSeed
};

const savedPresets = JSON.parse(localStorage.getItem('savedPresets2') || '{}');
Expand Down
7 changes: 7 additions & 0 deletions svg-feedback/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,10 @@ textarea {
border-color: #333;
color: #aaa;
}

#history svg {
background: var(--bg-primary);
border: 1px solid var(--border);
border-radius: 4px;
margin: 5px;
}
Loading