jbilcke-hf HF staff commited on
Commit
9ee3c2f
1 Parent(s): 421fbba

fixed file name generation

Browse files
src/app/interface/bottom-bar/bottom-bar.tsx CHANGED
@@ -184,7 +184,7 @@ function BottomBar() {
184
  >Load</Button> : null}
185
  {canSeeBetaFeatures ? <Button
186
  onClick={downloadClap}
187
- disabled={!prompt?.length || remainingImages > 0 || !currentClap}
188
  >
189
  {remainingImages ? `${allStatus.length - remainingImages}/${allStatus.length} ⌛` : `Save`}
190
  </Button> : null}
 
184
  >Load</Button> : null}
185
  {canSeeBetaFeatures ? <Button
186
  onClick={downloadClap}
187
+ disabled={remainingImages > 0}
188
  >
189
  {remainingImages ? `${allStatus.length - remainingImages}/${allStatus.length} ⌛` : `Save`}
190
  </Button> : null}
src/app/store/index.ts CHANGED
@@ -638,9 +638,12 @@ export const useStore = create<{
638
 
639
  const [stylePrompt, storyPrompt] = prompt.split("||").map(x => x.trim())
640
 
641
- const cleanStylePrompt = stylePrompt.replace(/([a-z0-9_,]+)/gi, "_")
642
- const cleanStoryPrompt = storyPrompt.replace(/([a-z0-9_,]+)/gi, "_")
643
- const cleanName = `${cleanStoryPrompt.slice(0, 20)} (${cleanStylePrompt.slice(0, 20) || "default style"})`
 
 
 
644
 
645
  anchor.download = `${cleanName}.clap`
646
 
 
638
 
639
  const [stylePrompt, storyPrompt] = prompt.split("||").map(x => x.trim())
640
 
641
+ const cleanStylePrompt = stylePrompt.replace(/([^a-z0-9, ]+)/gi, "_")
642
+
643
+ const firstPartOfStory = storyPrompt.split(",").shift() || ""
644
+ const cleanStoryPrompt = firstPartOfStory.replace(/([^a-z0-9, ]+)/gi, "_")
645
+
646
+ const cleanName = `${cleanStoryPrompt.slice(0, 22)} (${cleanStylePrompt.slice(0, 22) || "default style"})`
647
 
648
  anchor.download = `${cleanName}.clap`
649