Share flexibility and cleanup
This commit is contained in:
parent
f3d395fc46
commit
c10cfcf397
|
@ -48,8 +48,6 @@ export default function Share({
|
||||||
// function to generate a link to a the moment in the song based on the played clips, input variable is how many seconds ago
|
// function to generate a link to a the moment in the song based on the played clips, input variable is how many seconds ago
|
||||||
function generateLink(secondsAgo: number) {
|
function generateLink(secondsAgo: number) {
|
||||||
|
|
||||||
//TODO: Seth, and seconds into past case
|
|
||||||
|
|
||||||
var prompt
|
var prompt
|
||||||
var seed
|
var seed
|
||||||
var denoising
|
var denoising
|
||||||
|
@ -59,16 +57,30 @@ export default function Share({
|
||||||
var numInferenceSteps
|
var numInferenceSteps
|
||||||
var alphaVelocity
|
var alphaVelocity
|
||||||
|
|
||||||
|
|
||||||
// if seconds is 0, set prompt to the currently playing prompt
|
|
||||||
if (secondsAgo == 0) {
|
|
||||||
if (!nowPlayingResult) {
|
if (!nowPlayingResult) {
|
||||||
return window.location.href;
|
return window.location.href;
|
||||||
}
|
}
|
||||||
prompt = nowPlayingResult.input.end.prompt
|
else {
|
||||||
seed = nowPlayingResult.input.end.seed
|
var selectedInput: InferenceResult["input"]
|
||||||
denoising = nowPlayingResult.input.end.denoising
|
if (secondsAgo == 0) {
|
||||||
maskImageId = nowPlayingResult.input.mask_image_id
|
selectedInput = nowPlayingResult.input
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var selectedCounter = nowPlayingResult.counter - (secondsAgo / 5)
|
||||||
|
selectedInput = inferenceResults.find((result) => result.counter == selectedCounter)?.input
|
||||||
|
|
||||||
|
if (!selectedInput) {
|
||||||
|
// TODO: ideally don't show the button in this case...
|
||||||
|
return window.location.href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Consider start or end here. End is something the the user hasn't actually heard yet. Start is perhaps a previous prompt than where the user is headed
|
||||||
|
|
||||||
|
prompt = selectedInput.start.prompt
|
||||||
|
seed = selectedInput.start.seed
|
||||||
|
denoising = selectedInput.start.denoising
|
||||||
|
maskImageId = selectedInput.mask_image_id
|
||||||
|
|
||||||
// TODO, selectively add these based on whether we give user option to change them
|
// TODO, selectively add these based on whether we give user option to change them
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue