fix llm demo

This commit is contained in:
“chrisshank” 2024-12-11 15:57:17 -08:00
parent 967bb7c85c
commit 2fccf42c9e
2 changed files with 10 additions and 10 deletions

View File

@ -35,6 +35,7 @@
font-style: italic; font-style: italic;
font-size: 1rem; font-size: 1rem;
text-align: center; text-align: center;
margin: 0;
} }
</style> </style>
</head> </head>
@ -80,7 +81,7 @@
</folk-shape> </folk-shape>
<folk-shape x="400" y="100" width="250"> <folk-shape x="400" y="100" width="250">
<folk-llm system-prompt="Output text as HTML, no backticks"></folk-llm> <folk-llm system-prompt="Output text as HTML"></folk-llm>
</folk-shape> </folk-shape>
<folk-shape x="700" y="200"> <folk-shape x="700" y="200">
@ -94,13 +95,7 @@
expression="prompt: `double this list of ingredients '${from.innerHTML}'`" expression="prompt: `double this list of ingredients '${from.innerHTML}'`"
></folk-event-propagator> ></folk-event-propagator>
<folk-event-propagator <folk-event-propagator source="folk-llm" target="folk-timer" trigger="started" expression="restart(): true">
source="folk-llm"
target="folk-timer"
trigger="started"
expression="reset(): true
start(): true"
>
</folk-event-propagator> </folk-event-propagator>
<folk-event-propagator <folk-event-propagator

View File

@ -16,7 +16,7 @@ export class FolkTimer extends FolkElement {
connectedCallback() { connectedCallback() {
super.connectedCallback(); super.connectedCallback();
this.#updateTime(0); this.reset();
} }
start() { start() {
@ -33,8 +33,13 @@ export class FolkTimer extends FolkElement {
this.#updateTime(0); this.#updateTime(0);
} }
restart() {
this.reset();
this.start();
}
#updateTime = (time = this.#timeMs + this.#intervalMs) => { #updateTime = (time = this.#timeMs + this.#intervalMs) => {
this.#timeMs = time; this.#timeMs = time;
this.textContent = (time / 1000).toFixed(1); this.renderRoot.textContent = (time / 1000).toFixed(1);
}; };
} }