ultron-ai-sdk 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -402,6 +402,9 @@ Then add a handler to process transcribed speech:
|
|
|
402
402
|
character.onSpeechTranscribed = async (text) => {
|
|
403
403
|
console.log("User said:", text);
|
|
404
404
|
|
|
405
|
+
|
|
406
|
+
/////////////////////////// Your AI Workflow ///////////////////////////////////////
|
|
407
|
+
// The section below can be any API which chats with AI like openai or your own agentic API (Text to text)
|
|
405
408
|
// Send the transcribed text to your AI API
|
|
406
409
|
const response = await fetch("https://your-ai-api.com/endpoint", {
|
|
407
410
|
method: "POST",
|
|
@@ -411,8 +414,13 @@ character.onSpeechTranscribed = async (text) => {
|
|
|
411
414
|
|
|
412
415
|
const data = await response.json();
|
|
413
416
|
|
|
417
|
+
const AIResponseText = data.responseText
|
|
418
|
+
|
|
419
|
+
//////////////////////////////////////////////////////////////////////////////////
|
|
420
|
+
|
|
421
|
+
|
|
414
422
|
// Speak the AI response using the character
|
|
415
|
-
character.
|
|
423
|
+
character.say(AIResponseText);
|
|
416
424
|
};
|
|
417
425
|
```
|
|
418
426
|
|