Skip to content

Commit dbd1592

Browse files
committed
don't use common-checkbox, it doesn't exist
1 parent 133750a commit dbd1592

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

recipes/email-date-extractor.tsx

+21-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
llm,
99
NAME,
1010
recipe,
11-
Schema,
1211
str,
1312
UI,
1413
} from "@commontools/builder";
@@ -398,6 +397,8 @@ export default recipe(
398397
const extractionResult = llm({
399398
system: systemPrompt,
400399
prompt: userPrompt,
400+
model: "google:gemini-2.0-flash",
401+
mode: "json",
401402
});
402403

403404
// Return email with extracted dates
@@ -469,39 +470,41 @@ export default recipe(
469470
<common-hstack gap="md">
470471
<common-vstack gap="sm">
471472
<div>
472-
<common-checkbox
473+
<input
474+
type="checkbox"
473475
checked={settings.includeEmailDate}
474-
oncommon-checked={includeEmailDateHandler}
476+
onChange={includeEmailDateHandler}
475477
/>
476478
<label>Include email sent date</label>
477479
</div>
478480

479481
<div>
480-
<common-checkbox
482+
<input
483+
type="checkbox"
481484
checked={settings.extractTimes}
482-
oncommon-checked={extractTimesHandler}
485+
onChange={extractTimesHandler}
483486
/>
484487
<label>Extract time information</label>
485488
</div>
486489

487490
<div>
488491
<label>Context length</label>
489-
<common-input
492+
<input
490493
type="number"
491494
value={settings.contextLength}
492-
oncommon-input={contextLengthHandler}
495+
onChange={contextLengthHandler}
493496
/>
494497
</div>
495498

496499
<div>
497500
<label>Min confidence (0-1)</label>
498-
<common-input
501+
<input
499502
type="number"
500503
step="0.1"
501504
min="0"
502505
max="1"
503506
value={settings.minConfidence}
504-
oncommon-input={minConfidenceHandler}
507+
onChange={minConfidenceHandler}
505508
/>
506509
</div>
507510
</common-vstack>
@@ -534,11 +537,14 @@ export default recipe(
534537
)}
535538
<td>{date.context}</td>
536539
<td>
537-
{derive(date, (d) => (d.confidence * 100).toFixed(0))}%
540+
{derive(date, (d) =>
541+
(d?.confidence ?? 0 * 100).toFixed(0))}%
538542
</td>
539543
<td>
540544
{derive(emailsWithDates, (items) =>
541-
items.find((e) => e.dates.includes(date))?.email
545+
items.find((e) =>
546+
e.dates.includes(date)
547+
)?.email
542548
.subject ||
543549
"")}
544550
</td>
@@ -562,7 +568,7 @@ export default recipe(
562568
<tr>
563569
<th>DATE TEXT</th>
564570
<th>NORMALIZED</th>
565-
{ifElse(settings.extractTimes, <th>TIME</th>, null)}
571+
{ifElse(settings.extractTimes, (<th>TIME</th>), null)}
566572
<th>CONTEXT</th>
567573
<th>CONFIDENCE</th>
568574
</tr>
@@ -574,20 +580,20 @@ export default recipe(
574580
<td>{date.normalizedDate}</td>
575581
{ifElse(
576582
settings.extractTimes,
577-
<td>
583+
(<td>
578584
{ifElse(
579585
date.normalizedTime,
580586
date.normalizedTime,
581587
"-",
582588
)}
583-
</td>,
589+
</td>),
584590
null,
585591
)}
586592
<td>{date.context}</td>
587593
<td>
588594
{derive(
589595
date,
590-
(d) => (d.confidence * 100).toFixed(0),
596+
(d) => (d?.confidence ?? 0 * 100).toFixed(0),
591597
)}%
592598
</td>
593599
</tr>

0 commit comments

Comments
 (0)