-
Notifications
You must be signed in to change notification settings - Fork 0
svg feedback fix seed increment behavior #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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] 8e9cb95
Implement prompt guessing game functionality
mentatbot[bot] d7f7765
Add game instructions and hint system
mentatbot[bot] 18a094c
Fix build configuration and directory structure
mentatbot[bot] 68be43a
Update deploy-apps.yml
voodoohop 38eaf60
Update utils.js
voodoohop 78b55d4
Update vite.config.js
voodoohop ce4f3f8
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop 978a7ee
Update vite.config.js
voodoohop 775d517
Update vite.config.js
voodoohop 2046ac5
Update vite.config.js
voodoohop bc87a8c
Crop
voodoohop 81f1450
Add svg feedback experiment
voodoohop b4c9f32
Update index.html
voodoohop 4c9c876
Update index.html
voodoohop 7123bda
Update index.html
voodoohop 2fcdbc2
Update index.html
voodoohop 68b6bf3
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop 3177b83
Update index.html
voodoohop 6caa377
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop 7e993fd
Beautiful version
voodoohop c15e53d
Update index.html
voodoohop 54a62c2
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop 55df13c
Update index.html
voodoohop aeca570
initial svg state
voodoohop 47cf8fb
save preset too
voodoohop 8bc7de5
Update index.html
voodoohop 8f9b7ca
Update index.html
voodoohop 4f91539
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop a46fc28
Update index.html
voodoohop 04640df
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop 571251e
Update index.html
voodoohop aecaecb
Merge branch 'main' into mentat-140-1-prompt-guessing-game
voodoohop 645ba27
Update SVG dimensions to 100% width and height
voodoohop 34eb5f7
Extract js
voodoohop bdd44aa
revert script to html file
voodoohop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 = { | ||
|
|
@@ -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 | ||
|
|
@@ -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 ? | ||
|
|
@@ -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'); | ||
| } | ||
|
|
||
|
|
@@ -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); | ||
|
|
@@ -382,6 +380,10 @@ <h2>History</h2> | |
| isRunning = true; | ||
| elements.start.disabled = true; | ||
| elements.stop.disabled = false; | ||
|
|
||
| if (parseInt(elements.seed.value) >= 0) { | ||
| initialSeed = parseInt(elements.seed.value); | ||
| } | ||
|
|
||
| frames = []; | ||
| frameIndex = 0; | ||
|
|
@@ -435,7 +437,7 @@ <h2>History</h2> | |
| temperature: elements.temperature.value, | ||
| initialSvg: elements.initialSvg.value, | ||
| model: elements.modelSelect.value, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good change to store |
||
| seed: currentSeed | ||
| seed: initialSeed | ||
| }; | ||
|
|
||
| const savedPresets = JSON.parse(localStorage.getItem('savedPresets2') || '{}'); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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()andisFinite(). Here's how: