Skip to content

Commit

Permalink
fix llm demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisShank committed Dec 11, 2024
1 parent 967bb7c commit 2fccf42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 3 additions & 8 deletions demo/embeddable-llm-with-propagators.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
font-style: italic;
font-size: 1rem;
text-align: center;
margin: 0;
}
</style>
</head>
Expand Down Expand Up @@ -80,7 +81,7 @@
</folk-shape>

<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 x="700" y="200">
Expand All @@ -94,13 +95,7 @@
expression="prompt: `double this list of ingredients '${from.innerHTML}'`"
></folk-event-propagator>

<folk-event-propagator
source="folk-llm"
target="folk-timer"
trigger="started"
expression="reset(): true
start(): true"
>
<folk-event-propagator source="folk-llm" target="folk-timer" trigger="started" expression="restart(): true">
</folk-event-propagator>

<folk-event-propagator
Expand Down
9 changes: 7 additions & 2 deletions src/folk-timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class FolkTimer extends FolkElement {

connectedCallback() {
super.connectedCallback();
this.#updateTime(0);
this.reset();
}

start() {
Expand All @@ -33,8 +33,13 @@ export class FolkTimer extends FolkElement {
this.#updateTime(0);
}

restart() {
this.reset();
this.start();
}

#updateTime = (time = this.#timeMs + this.#intervalMs) => {
this.#timeMs = time;
this.textContent = (time / 1000).toFixed(1);
this.renderRoot.textContent = (time / 1000).toFixed(1);
};
}

0 comments on commit 2fccf42

Please sign in to comment.