folk-canvas/website/embeddable-llm-with-propaga...

116 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LLM</title>
<style>
html {
height: 100%;
}
body {
min-height: 100%;
position: relative;
margin: 0;
}
folk-shape {
border: 1px solid black;
border-radius: 4px;
}
folk-llm {
display: block;
width: 100%;
height: 100%;
min-height: 1lh;
}
folk-timer {
padding: 0.5rem;
}
p {
font-style: italic;
font-size: 1rem;
text-align: center;
margin: 0;
}
</style>
</head>
<body>
<p>
Note: This demo only works in Chrome with
<a href="https://medium.com/@kenzic/getting-started-window-ai-in-chrome-c2982efada33">certain flags turned on.</a>
</p>
<folk-shape x="100" y="100" width="250">
<ul id="recipe" class="wprm-recipe-ingredients">
<li class="wprm-recipe-ingredient" style="list-style-type: disc" data-uid="0">
<span class="wprm-recipe-ingredient-amount">500</span>
<span class="wprm-recipe-ingredient-unit">g</span>
<span class="wprm-recipe-ingredient-name">all purpose flour King Arthur brand is recommended</span>
<span class="wprm-recipe-ingredient-notes wprm-recipe-ingredient-notes-faded"
>about 3 1/2 cups, using 'scoop and swipe' method</span
>
</li>
<li class="wprm-recipe-ingredient" style="list-style-type: disc" data-uid="1">
<span class="wprm-recipe-ingredient-amount">360</span>
<span class="wprm-recipe-ingredient-unit">g</span>
<span class="wprm-recipe-ingredient-name">water</span>
<span class="wprm-recipe-ingredient-notes wprm-recipe-ingredient-notes-faded">about 1 1/2 cups + 1 Tbsp</span>
</li>
<li class="wprm-recipe-ingredient" style="list-style-type: disc" data-uid="2">
<span class="wprm-recipe-ingredient-amount">10</span> <span class="wprm-recipe-ingredient-unit">g</span>
<span class="wprm-recipe-ingredient-name">salt</span>
<span class="wprm-recipe-ingredient-notes wprm-recipe-ingredient-notes-faded">about 2 tsp</span>
</li>
<li class="wprm-recipe-ingredient" style="list-style-type: disc" data-uid="3">
<span class="wprm-recipe-ingredient-amount">3</span> <span class="wprm-recipe-ingredient-unit">g</span>
<span class="wprm-recipe-ingredient-name">instant yeast</span>
<span class="wprm-recipe-ingredient-notes wprm-recipe-ingredient-notes-faded"
>about 1 tsp; also known as Quick Rise or Rapid Rise yeast</span
>
</li>
<li class="wprm-recipe-ingredient" style="list-style-type: disc" data-uid="4">
<span class="wprm-recipe-ingredient-amount">25</span> <span class="wprm-recipe-ingredient-unit">g</span>
<span class="wprm-recipe-ingredient-name">honey</span>
<span class="wprm-recipe-ingredient-notes wprm-recipe-ingredient-notes-faded">about 1 Tbsp</span>
</li>
</ul>
</folk-shape>
<folk-shape x="400" y="100" width="250">
<folk-llm system-prompt="Output text as HTML"></folk-llm>
</folk-shape>
<folk-shape x="700" y="200">
<folk-timer></folk-timer>
</folk-shape>
<folk-event-propagator
source="#recipe"
target="folk-llm"
trigger="click"
expression="prompt: `double this list of ingredients '${from.innerHTML}'`"
></folk-event-propagator>
<folk-event-propagator source="folk-llm" target="folk-timer" trigger="started" expression="restart(): true">
</folk-event-propagator>
<folk-event-propagator
source="folk-llm"
target="folk-timer"
trigger="finished"
expression="stop(): true"
></folk-event-propagator>
<script type="module">
import './src/folk-timer.ts';
import '../lib/standalone/folk-shape.ts';
import '../lib/standalone/folk-llm.ts';
import '../lib/standalone/folk-event-propagator.ts';
</script>
</body>
</html>