@rannah-labs/react-voice-orb 1.1.3
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 +240 -0
- package/assets/orb-ss.png +0 -0
- package/assets/thing.png +0 -0
- package/dist/bun-server/src/types/index.d.ts +37 -0
- package/dist/bun-server/src/types/index.js +2 -0
- package/dist/src/app/Types/TranscriberStuff.d.ts +0 -0
- package/dist/src/app/Types/TranscriberStuff.js +1 -0
- package/dist/src/app/Types/apiModels.d.ts +31 -0
- package/dist/src/app/Types/apiModels.js +2 -0
- package/dist/src/app/Types/api_types.d.ts +34 -0
- package/dist/src/app/Types/api_types.js +2 -0
- package/dist/src/app/Types/better-trpc.d.ts +5 -0
- package/dist/src/app/Types/better-trpc.js +23 -0
- package/dist/src/app/Types/browser-only.d.ts +1 -0
- package/dist/src/app/Types/browser-only.js +12 -0
- package/dist/src/app/Types/builltInNodesTemplates.d.ts +1070 -0
- package/dist/src/app/Types/builltInNodesTemplates.js +1341 -0
- package/dist/src/app/Types/defaults.d.ts +7 -0
- package/dist/src/app/Types/defaults.js +210 -0
- package/dist/src/app/Types/demo_extension.d.ts +11 -0
- package/dist/src/app/Types/demo_extension.js +190 -0
- package/dist/src/app/Types/envObject.d.ts +97 -0
- package/dist/src/app/Types/envObject.js +5 -0
- package/dist/src/app/Types/firebase.d.ts +30413 -0
- package/dist/src/app/Types/firebase.js +6696 -0
- package/dist/src/app/Types/gen_openapi.d.ts +130 -0
- package/dist/src/app/Types/gen_openapi.js +2 -0
- package/dist/src/app/Types/global_types.d.ts +254 -0
- package/dist/src/app/Types/global_types.js +6 -0
- package/dist/src/app/Types/messages_types.d.ts +76 -0
- package/dist/src/app/Types/messages_types.js +1 -0
- package/dist/src/app/Types/vapi_types.d.ts +358 -0
- package/dist/src/app/Types/vapi_types.js +2 -0
- package/dist/src/app/Types/vf_types.d.ts +33 -0
- package/dist/src/app/Types/vf_types.js +2 -0
- package/dist/src/public_packages/react-voice-orb/src/animation-orb.d.ts +11 -0
- package/dist/src/public_packages/react-voice-orb/src/animation-orb.js +397 -0
- package/dist/src/public_packages/react-voice-orb/src/index.d.ts +5 -0
- package/dist/src/public_packages/react-voice-orb/src/index.js +16 -0
- package/dist/src/public_packages/react-voice-orb/src/providers/AIAudioProvider.d.ts +21 -0
- package/dist/src/public_packages/react-voice-orb/src/providers/AIAudioProvider.js +81 -0
- package/dist/src/public_packages/react-voice-orb/src/providers/ThemeProvider.d.ts +23 -0
- package/dist/src/public_packages/react-voice-orb/src/providers/ThemeProvider.js +202 -0
- package/dist/src/public_packages/react-voice-orb/src/scripts/same-script.d.ts +1 -0
- package/dist/src/public_packages/react-voice-orb/src/scripts/same-script.js +79 -0
- package/dist/src/public_packages/react-voice-orb/src/spinner.d.ts +3 -0
- package/dist/src/public_packages/react-voice-orb/src/spinner.js +17 -0
- package/dist/src/public_packages/react-voice-orb/tsconfig.tsbuildinfo +1 -0
- package/dist/vg-docker/src/+global_consts/client.d.ts +84 -0
- package/dist/vg-docker/src/+global_consts/client.js +105 -0
- package/package.json +46 -0
- package/scripts/post-tsc.ts +74 -0
- package/src/animation-orb.tsx +441 -0
- package/src/index.ts +5 -0
- package/src/providers/AIAudioProvider.tsx +100 -0
- package/src/providers/ThemeProvider.tsx +211 -0
- package/src/scripts/same-script.ts +73 -0
- package/src/spinner.tsx +19 -0
- package/tsconfig.json +34 -0
- package/webpack.config.js +141 -0
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
## Rannah رنّة React Voice Orb
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
## Get started:
|
|
5
|
+
|
|
6
|
+
Make sure to update the package regularly to the latest version.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm install @rannah-labs/react-voice-orb@latest
|
|
10
|
+
```
|
|
11
|
+
Or
|
|
12
|
+
```bash
|
|
13
|
+
npm install @rannah-labs/react-voice-orb@latest
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
First of all please navigate to the [Rannah رنّة Dashboard](https://rannah.io) and create an agent, then you can use the agent id and region to start a voice call.
|
|
19
|
+
|
|
20
|
+
We need to know 2 parameters to start a voice call from the URL of the agent you have navigated to:
|
|
21
|
+
|
|
22
|
+
1. `agentId` - The agent id is a unique identifier for the agent you want to call.
|
|
23
|
+
2. `region` - The region is the region of the agent you want to call.
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
For example this URL:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
https://rannah.io/app/eu/agents/enit5lczmqbz1s7d/overview?showDebugger=true
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The `agentId` is `enit5lczmqbz1s7d` and the `region` is `eu`.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
Example usage with NextJS 13+ (App Router + TypeScript)
|
|
38
|
+
|
|
39
|
+
- We first have to wrap the page/component with the `VoiceProvider` and `OrbThemeProvider` components.
|
|
40
|
+
```tsx
|
|
41
|
+
// layout.tsx
|
|
42
|
+
"use client";
|
|
43
|
+
import React from "react";
|
|
44
|
+
import { VoiceProvider, OrbThemeProvider } from "@rannah-labs/react-voice-orb";
|
|
45
|
+
|
|
46
|
+
const layout = (props: { children: React.ReactNode }) => {
|
|
47
|
+
return (
|
|
48
|
+
<VoiceProvider
|
|
49
|
+
agentId="ox0uepumt3qokr98"
|
|
50
|
+
region="eu"
|
|
51
|
+
>
|
|
52
|
+
<OrbThemeProvider isDark={true} primaryColor="#CBC3E3">
|
|
53
|
+
{props.children}
|
|
54
|
+
</OrbThemeProvider>
|
|
55
|
+
</VoiceProvider>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default layout;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- Then we can use the `useAIVoice` hook and the orb component.
|
|
63
|
+
```tsx
|
|
64
|
+
// page.tsx
|
|
65
|
+
"use client";
|
|
66
|
+
import { AudioAnimationOrb, useAIVoice, Spinner } from "@rannah-labs/react-voice-orb";
|
|
67
|
+
import React, { useState } from "react";
|
|
68
|
+
import { FaCircleStop, FaMicrophone, FaMicrophoneSlash } from "react-icons/fa6";
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
const page = () => {
|
|
72
|
+
|
|
73
|
+
const { webCall, callState, isMuted } = useAIVoice();
|
|
74
|
+
const [showOrb, setShowOrb] = useState(false);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<AudioAnimationOrb
|
|
78
|
+
orbPlaceholder={
|
|
79
|
+
<div
|
|
80
|
+
style={{
|
|
81
|
+
width: "100%",
|
|
82
|
+
height: "100%",
|
|
83
|
+
backgroundColor: "#e1e1e1",
|
|
84
|
+
borderRadius: "50%",
|
|
85
|
+
}}
|
|
86
|
+
></div>
|
|
87
|
+
}
|
|
88
|
+
showOrb={showOrb}
|
|
89
|
+
width={500}
|
|
90
|
+
height={500}
|
|
91
|
+
>
|
|
92
|
+
<div
|
|
93
|
+
style={{
|
|
94
|
+
width: 500,
|
|
95
|
+
height: 500,
|
|
96
|
+
backgroundColor: "rgba(0, 0, 0, 0.1)",
|
|
97
|
+
borderRadius: "100%",
|
|
98
|
+
display: "flex",
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<div
|
|
104
|
+
className="ta-orb-controls"
|
|
105
|
+
style={{
|
|
106
|
+
display: "flex",
|
|
107
|
+
flexDirection: "column",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
justifyContent: "center",
|
|
110
|
+
height: "100%",
|
|
111
|
+
width: "100%",
|
|
112
|
+
backgroundColor: "transparent",
|
|
113
|
+
color: "#fff",
|
|
114
|
+
padding: "10px 20px",
|
|
115
|
+
borderRadius: "5px",
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
<button
|
|
119
|
+
className="ta-button"
|
|
120
|
+
style={{
|
|
121
|
+
backgroundColor: callState === "connected" ? "rgba(250, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.5)",
|
|
122
|
+
color: "#fff",
|
|
123
|
+
padding: "10px 20px",
|
|
124
|
+
borderRadius: "100%",
|
|
125
|
+
width: "100px",
|
|
126
|
+
height: "100px",
|
|
127
|
+
display: "flex",
|
|
128
|
+
justifyContent: "center",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
}}
|
|
131
|
+
onClick={() => {
|
|
132
|
+
if (!showOrb) {
|
|
133
|
+
setShowOrb(true);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (callState === "idle") {
|
|
137
|
+
webCall.startCall();
|
|
138
|
+
} else {
|
|
139
|
+
webCall.toggleMute();
|
|
140
|
+
}
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{callState === "idle" ? (
|
|
144
|
+
<FaMicrophone style={{ width: "50px", height: "50px" }} />
|
|
145
|
+
) : null}
|
|
146
|
+
{callState === "connecting" ? <Spinner /> : null}
|
|
147
|
+
{callState === "connected" ? (
|
|
148
|
+
<>
|
|
149
|
+
{isMuted ? (
|
|
150
|
+
<FaMicrophoneSlash
|
|
151
|
+
style={{ width: "50px", height: "50px" }}
|
|
152
|
+
/>
|
|
153
|
+
) : (
|
|
154
|
+
<FaMicrophone style={{ width: "50px", height: "50px" }} />
|
|
155
|
+
)}
|
|
156
|
+
</>
|
|
157
|
+
) : null}
|
|
158
|
+
</button>
|
|
159
|
+
{callState === "connected" ? (
|
|
160
|
+
<>
|
|
161
|
+
<button
|
|
162
|
+
style={{
|
|
163
|
+
marginTop: `10px`,
|
|
164
|
+
display: `flex`,
|
|
165
|
+
alignItems: `center`,
|
|
166
|
+
justifyContent: `center`,
|
|
167
|
+
gap: `10px`,
|
|
168
|
+
padding: `10px 20px`,
|
|
169
|
+
backgroundColor: `rgba(0, 0, 0, 0.5)`,
|
|
170
|
+
borderRadius: `10px`,
|
|
171
|
+
}}
|
|
172
|
+
className="ta-button-end"
|
|
173
|
+
onClick={() => {
|
|
174
|
+
webCall.endCall();
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
End Call
|
|
178
|
+
<FaCircleStop style={{ width: "20px", height: "20px" }} />
|
|
179
|
+
</button>
|
|
180
|
+
</>
|
|
181
|
+
) : null}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</AudioAnimationOrb>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default page;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
We can also append messages to the conversation by passing the `options` parameter to the `init` method, in addition to overriding tools or variables for the agent.
|
|
192
|
+
```tsx
|
|
193
|
+
// page.tsx
|
|
194
|
+
await voice.init({
|
|
195
|
+
agentId: "LPTp73I6VFsI0jFVFAPr",
|
|
196
|
+
region: "eu",
|
|
197
|
+
options: {
|
|
198
|
+
messagesHistory: [
|
|
199
|
+
{
|
|
200
|
+
role: "assistant",
|
|
201
|
+
content: "Hi there, how can I help you today?",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
role: "user",
|
|
205
|
+
content: "I'm good my name is Moe btw.",
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Notes:
|
|
213
|
+
- This packages uses WebRTC to make the voice call, any browser that doesn't support that might not be compatible with this package.
|
|
214
|
+
- We use WebGL to render the orb, so it might not work on all devices/browsers.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
MIT License
|
|
220
|
+
|
|
221
|
+
Copyright (c) 2025 Rannah
|
|
222
|
+
|
|
223
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
224
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
225
|
+
in the Software without restriction, including without limitation the rights
|
|
226
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
227
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
228
|
+
furnished to do so, subject to the following conditions:
|
|
229
|
+
|
|
230
|
+
The above copyright notice and this permission notice shall be included in all
|
|
231
|
+
copies or substantial portions of the Software.
|
|
232
|
+
|
|
233
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
234
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
235
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
236
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
237
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
238
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
239
|
+
SOFTWARE.
|
|
240
|
+
```
|
|
Binary file
|
package/assets/thing.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface VectorModel {
|
|
2
|
+
id: string;
|
|
3
|
+
namespace?: string;
|
|
4
|
+
payload?: {
|
|
5
|
+
text?: string;
|
|
6
|
+
chunk_index?: number;
|
|
7
|
+
doc_id?: string;
|
|
8
|
+
doc_name?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
urlDescription?: string;
|
|
11
|
+
};
|
|
12
|
+
vector: number[];
|
|
13
|
+
tags?: string[];
|
|
14
|
+
similarity?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface POST_REQ_CollectionsKBD {
|
|
17
|
+
payload: VectorModel[];
|
|
18
|
+
}
|
|
19
|
+
export interface POST_REQ_DELETECollectionVectors {
|
|
20
|
+
vector_ids: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface REQ_POSTCollectionSearchVectors {
|
|
23
|
+
vector: number[];
|
|
24
|
+
with_payload?: boolean;
|
|
25
|
+
with_vector?: boolean;
|
|
26
|
+
max_chunks?: number;
|
|
27
|
+
similarity_threshold?: number;
|
|
28
|
+
tags?: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface REQ_POSTCollectionCreate {
|
|
31
|
+
dimensions: number;
|
|
32
|
+
}
|
|
33
|
+
export interface CollectionModel {
|
|
34
|
+
id: string;
|
|
35
|
+
dimensions: number;
|
|
36
|
+
vectors: VectorModel[];
|
|
37
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface addCustomDomain_REQUEST {
|
|
2
|
+
customDomain?: string;
|
|
3
|
+
userId?: string;
|
|
4
|
+
agencyId?: string;
|
|
5
|
+
bucket?: 'voiceglow-eu' | '(default)';
|
|
6
|
+
ts?: number;
|
|
7
|
+
isVerified?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface addCustomDomain_RESPONSE {
|
|
10
|
+
"autoSubDomainCreationPatterns"?: ["string"];
|
|
11
|
+
"autoSubDomainIAMRole"?: "string";
|
|
12
|
+
"certificateVerificationDNSRecord"?: "string";
|
|
13
|
+
"domainAssociationArn"?: "string";
|
|
14
|
+
"domainName"?: "string";
|
|
15
|
+
"domainStatus"?: "string";
|
|
16
|
+
"enableAutoSubDomain"?: boolean;
|
|
17
|
+
"statusReason"?: "string";
|
|
18
|
+
"subDomains"?: [
|
|
19
|
+
{
|
|
20
|
+
"dnsRecord": "string";
|
|
21
|
+
"subDomainSetting": {
|
|
22
|
+
"branchName": "string";
|
|
23
|
+
"prefix": "string";
|
|
24
|
+
};
|
|
25
|
+
"verified": boolean;
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
userId?: string;
|
|
29
|
+
agencyId?: string;
|
|
30
|
+
ts?: number;
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LinkObjectModel } from "../Components/AppUI/core/MultiFileUpload";
|
|
2
|
+
import { BUCKET_VALUE, REGION_VALUE, VG_SUPPORTED_LLM, WorkspaceModel } from "./firebase";
|
|
3
|
+
export interface V2API_REQ_POSTWorkspaceEmail {
|
|
4
|
+
to: string;
|
|
5
|
+
subject: string;
|
|
6
|
+
html: string;
|
|
7
|
+
}
|
|
8
|
+
export interface V2API_REQ_POSTWorkspaceAddUser {
|
|
9
|
+
email?: string;
|
|
10
|
+
perms?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface V2API_RES_WorkspaceEmailResponse {
|
|
13
|
+
success: boolean;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
export interface V2ReqShouldContinueWorkspaceModel {
|
|
17
|
+
success?: boolean;
|
|
18
|
+
error?: any;
|
|
19
|
+
shouldContinue?: boolean;
|
|
20
|
+
message?: string;
|
|
21
|
+
workspace?: WorkspaceModel;
|
|
22
|
+
bucket?: BUCKET_VALUE;
|
|
23
|
+
region?: REGION_VALUE;
|
|
24
|
+
}
|
|
25
|
+
export interface V2API_REQ_POSTAgentUtilsLLM {
|
|
26
|
+
systemPrompt?: string;
|
|
27
|
+
query?: string;
|
|
28
|
+
llm?: VG_SUPPORTED_LLM;
|
|
29
|
+
temperature?: number;
|
|
30
|
+
max_tokens?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface REQ_POSTAgentUtilsFileToText {
|
|
33
|
+
fileObject: LinkObjectModel;
|
|
34
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const routeHandlers = {
|
|
4
|
+
get: {
|
|
5
|
+
agentData: {
|
|
6
|
+
path: '/api/v2/agent/data',
|
|
7
|
+
handler: () => {
|
|
8
|
+
console.log('agentData');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
post: {},
|
|
13
|
+
put: {},
|
|
14
|
+
delete: {}
|
|
15
|
+
};
|
|
16
|
+
class Router {
|
|
17
|
+
routes;
|
|
18
|
+
constructor() {
|
|
19
|
+
this.routes = routeHandlers;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const router = new Router();
|
|
23
|
+
router.routes.get.agentData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCookieValue(name: string): string | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCookieValue = getCookieValue;
|
|
4
|
+
function getCookieValue(name) {
|
|
5
|
+
// Build a regex that matches either start-of-string or a semicolon,
|
|
6
|
+
// followed by space(s), then the cookie name, equals sign,
|
|
7
|
+
// and finally, everything up to the next semicolon.
|
|
8
|
+
const re = new RegExp('(?:^|; )' + encodeURIComponent(name) + '=([^;]*)');
|
|
9
|
+
const match = document.cookie.match(re);
|
|
10
|
+
// If found, decode and return. Otherwise, return null.
|
|
11
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
12
|
+
}
|