-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from 33 commits
1960adb
8e9cb95
d7f7765
18a094c
68be43a
38eaf60
78b55d4
ce4f3f8
978a7ee
775d517
2046ac5
bc87a8c
81f1450
b4c9f32
4c9c876
7123bda
2fcdbc2
68b6bf3
3177b83
6caa377
7e993fd
c15e53d
54a62c2
55df13c
aeca570
47cf8fb
8bc7de5
8f9b7ca
4f91539
a46fc28
04640df
571251e
aecaecb
645ba27
34eb5f7
bdd44aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -251,9 +251,7 @@ <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; // Use and increment the current seed | ||
|
|
||
| const systemPrompt = `You are an animated SVG art generator. Create SVG code that fits within a 800x600 viewBox. | ||
| Follow these rules: | ||
|
|
@@ -382,6 +380,10 @@ <h2>History</h2> | |
| isRunning = true; | ||
| elements.start.disabled = true; | ||
| elements.stop.disabled = false; | ||
|
|
||
| if (parseInt(elements.seed.value) >= 0) { | ||
|
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. 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 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; | ||
|
|
@@ -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') || '{}'); | ||
|
|
||
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 increment is now handled outside this function, but there's no comment indicating where the increment happens. Consider adding a comment here to point to where
currentSeedgets incremented (line 364) for better code maintainability.