Spaces:
Sleeping
Sleeping
Commit
•
fcdbd7f
1
Parent(s):
c32ec0d
add captions
Browse files
src/app/interface/panel/index.tsx
CHANGED
@@ -238,21 +238,8 @@ export function Panel({
|
|
238 |
{ "grayscale": preset.color === "grayscale" },
|
239 |
className
|
240 |
)}>
|
241 |
-
{
|
242 |
-
|
243 |
-
ref={ref}
|
244 |
-
src={imageWithText || rendered.assetUrl}
|
245 |
-
width={width}
|
246 |
-
height={height}
|
247 |
-
alt={rendered.alt}
|
248 |
-
className={cn(
|
249 |
-
`comic-panel w-full h-full object-cover max-w-max`,
|
250 |
-
// showCaptions ? `-mt-11` : ''
|
251 |
-
)}
|
252 |
-
/>}
|
253 |
-
{/*
|
254 |
-
<div className={cn(
|
255 |
-
`flex`,
|
256 |
`bg-stone-50`,
|
257 |
`border-stone-800`,
|
258 |
`transition-all duration-200 ease-in-out`,
|
@@ -262,16 +249,27 @@ export function Panel({
|
|
262 |
zoomLevel > 40 ? `border-b-[0.5px] md:border-b-[1px]` :
|
263 |
`border-transparent md:border-b-[0.5px]`,
|
264 |
`print:border-b-[1.5px]`,
|
265 |
-
showCaptions ?
|
266 |
`truncate`,
|
267 |
-
`h-
|
268 |
-
`p-
|
269 |
)}
|
270 |
style={{
|
271 |
fontSize: zoomLevel * 0.2
|
272 |
}}
|
273 |
>{caption}</div>
|
274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
</div>
|
276 |
)
|
277 |
}
|
|
|
238 |
{ "grayscale": preset.color === "grayscale" },
|
239 |
className
|
240 |
)}>
|
241 |
+
<div className={cn(
|
242 |
+
``,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
`bg-stone-50`,
|
244 |
`border-stone-800`,
|
245 |
`transition-all duration-200 ease-in-out`,
|
|
|
249 |
zoomLevel > 40 ? `border-b-[0.5px] md:border-b-[1px]` :
|
250 |
`border-transparent md:border-b-[0.5px]`,
|
251 |
`print:border-b-[1.5px]`,
|
252 |
+
showCaptions ? `block` : `hidden`,
|
253 |
`truncate`,
|
254 |
+
`max-h-32`,
|
255 |
+
`p-2`
|
256 |
)}
|
257 |
style={{
|
258 |
fontSize: zoomLevel * 0.2
|
259 |
}}
|
260 |
>{caption}</div>
|
261 |
+
{rendered.assetUrl &&
|
262 |
+
<img
|
263 |
+
ref={ref}
|
264 |
+
src={imageWithText || rendered.assetUrl}
|
265 |
+
width={width}
|
266 |
+
height={height}
|
267 |
+
alt={rendered.alt}
|
268 |
+
className={cn(
|
269 |
+
`comic-panel w-full h-full object-cover max-w-max`,
|
270 |
+
// showCaptions ? `-mt-11` : ''
|
271 |
+
)}
|
272 |
+
/>}
|
273 |
</div>
|
274 |
)
|
275 |
}
|
src/app/interface/top-menu/index.tsx
CHANGED
@@ -204,7 +204,6 @@ export function TopMenu() {
|
|
204 |
>
|
205 |
Generate
|
206 |
</Button>
|
207 |
-
{/*
|
208 |
<Switch
|
209 |
checked={showCaptions}
|
210 |
onCheckedChange={setShowCaptions}
|
@@ -212,7 +211,6 @@ export function TopMenu() {
|
|
212 |
<Label>
|
213 |
Caption
|
214 |
</Label>
|
215 |
-
*/}
|
216 |
</div>
|
217 |
{/*
|
218 |
Let's add this feature later, because right now people
|
|
|
204 |
>
|
205 |
Generate
|
206 |
</Button>
|
|
|
207 |
<Switch
|
208 |
checked={showCaptions}
|
209 |
onCheckedChange={setShowCaptions}
|
|
|
211 |
<Label>
|
212 |
Caption
|
213 |
</Label>
|
|
|
214 |
</div>
|
215 |
{/*
|
216 |
Let's add this feature later, because right now people
|
src/lib/cleanJson.ts
CHANGED
@@ -2,6 +2,9 @@ import { dirtyLLMResponseCleaner } from "./dirtyLLMResponseCleaner"
|
|
2 |
|
3 |
export function cleanJson(input: string) {
|
4 |
|
|
|
|
|
|
|
5 |
let tmp = dirtyLLMResponseCleaner(input)
|
6 |
|
7 |
// we only keep what's after the first [
|
|
|
2 |
|
3 |
export function cleanJson(input: string) {
|
4 |
|
5 |
+
if (input.includes('```')) {
|
6 |
+
input = input.split('```')[0]
|
7 |
+
}
|
8 |
let tmp = dirtyLLMResponseCleaner(input)
|
9 |
|
10 |
// we only keep what's after the first [
|