@fonoster/autopilot 0.7.7 → 0.7.9

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 CHANGED
@@ -15,7 +15,7 @@ The autopilot module provides a way to create Voice AI applications in Fonoster.
15
15
  * [What's Next](#whats-next)
16
16
 
17
17
  > [!WARNING]
18
- > This is an overview of Fonoster's Autopilot. This module is still under heavy development, and the API is subject to change. This overview implements OpenAI models, but we are working to bring support for other providers like Groq and others.
18
+ > This is an overview of Fonoster's Autopilot. This module is still under heavy development, and the API is subject to change. This overview implements OpenAI and Groq models, but we are working to bring support to additional providers. If you have any suggestions or feedback, please let us know.
19
19
 
20
20
  ## Installation
21
21
 
@@ -60,18 +60,20 @@ const machine = (0, xstate_1.setup)({
60
60
  logger.verbose("called processUserRequest action", {
61
61
  speechBuffer: context.speechBuffer
62
62
  });
63
+ // Stop any speech that might be playing
64
+ await context.voice.stopSpeech();
63
65
  const speech = context.speechBuffer.trim();
64
66
  const languageModel = context.languageModel;
65
67
  const response = await languageModel.invoke(speech);
66
68
  const speechResponseTime = Date.now() - context.speechResponseStartTime;
67
69
  context.speechResponseTime = speechResponseTime;
68
70
  context.speechResponseStartTime = 0;
69
- if (!response) {
71
+ if (response.type === "say" && !response.content) {
70
72
  logger.verbose("call might already be hung up");
71
73
  (0, xstate_1.raise)({ type: "USER_REQUEST_PROCESSED" });
72
74
  return;
73
75
  }
74
- if (response.type === "hangup") {
76
+ else if (response.type === "hangup") {
75
77
  const message = context.goodbyeMessage;
76
78
  await context.voice.say(message);
77
79
  await context.voice.hangup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/autopilot",
3
- "version": "0.7.7",
3
+ "version": "0.7.9",
4
4
  "description": "Voice AI for the Fonoster platform",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -35,9 +35,9 @@
35
35
  "url": "https://github.com/fonoster/fonoster/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@fonoster/common": "^0.7.7",
39
- "@fonoster/logger": "^0.7.5",
40
- "@fonoster/voice": "^0.7.7",
38
+ "@fonoster/common": "^0.7.9",
39
+ "@fonoster/logger": "^0.7.9",
40
+ "@fonoster/voice": "^0.7.9",
41
41
  "@langchain/community": "^0.2.31",
42
42
  "@langchain/core": "^0.2.31",
43
43
  "@langchain/groq": "^0.0.17",
@@ -54,5 +54,5 @@
54
54
  "devDependencies": {
55
55
  "typescript": "^5.5.4"
56
56
  },
57
- "gitHead": "f1cfa987ec4221dad9900bc377cccee49221164a"
57
+ "gitHead": "3b16a5ed87b84d03534bb20de4d59d5bbb51a742"
58
58
  }