Skip to content

Commit

Permalink
Rev
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Jun 4, 2024
1 parent 359fe89 commit c2ca5bd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions recipes/llm-voice-assistant/web/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## See It In Action!

[![LLM VA in Action](https://img.youtube.com/vi/WWVSACJQknw/0.jpg)](https://www.youtube.com/watch?v=WWVSACJQknw)

## Compatibility

- Node.js 18+
Expand Down
2 changes: 1 addition & 1 deletion recipes/llm-voice-assistant/web/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "picollm-web-voice-assistant",
"name": "llm-voice-assistant",
"version": "1.0.0",
"description": "",
"entry": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion recipes/llm-voice-assistant/web/public/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ window.onload = () => {
addMessage(humanElem, transcript);
},
onEndpoint: async () => {
message.innerText = "Generating...";
message.innerHTML = "Generating <div class='loader'></div>";
llmElem = startLLMMessage();
},
onText: (text) => {
Expand Down
19 changes: 18 additions & 1 deletion recipes/llm-voice-assistant/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
border-radius: 5px;
background-color: lightblue;
padding: 6px;
margin-bottom: 5px;
}

.llm-border {
Expand All @@ -93,6 +94,7 @@
border-radius: 5px;
background-color: lightgrey;
padding: 6px;
margin-bottom: 5px;
}

.result-container {
Expand All @@ -118,10 +120,25 @@
color: #377dff;
}
}

.loader {
border: 2px solid #f3f3f3;
border-top: 2px solid black;
border-radius: 50%;
width: 12pt;
height: 12pt;
animation: spin 2s linear infinite;
margin-left: 10px;
}

@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<h1>picoLLM Web Voice Assistant</h1>
<h1>LLM Voice Assistant</h1>
<div><b>Status:</b> <span id="status">Not loaded.</span><span id="dotdotdot"></span></div>
<div id="error" style="white-space: pre; display: none;"></div>
<hr/>
Expand Down
1 change: 1 addition & 0 deletions recipes/llm-voice-assistant/web/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const init = async (

const { completion, completionTokens } = await pllm.generate(dialog.prompt(), {
completionTokenLimit: 128,
stopPhrases: stopPhrases,
streamCallback: async token => {
if (!stopPhrases.includes(token)) {
onText(token);
Expand Down

0 comments on commit c2ca5bd

Please sign in to comment.