@fluxyte/sdk 0.4.0 → 0.4.2
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
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
The official TypeScript SDK for the Fluxyte Onboarding AI API: a context-aware,
|
|
4
4
|
documentation-grounded assistant designed for onboarding and setup flows (not generic chat).
|
|
5
5
|
|
|
6
|
+
## What's New In 0.4.0
|
|
7
|
+
|
|
8
|
+
- Voice chat API via `client.voiceChat(...)` for speech input.
|
|
9
|
+
- Optional synthesized audio reply output.
|
|
10
|
+
- React voice chat hook support for UI integration.
|
|
11
|
+
|
|
6
12
|
## Install
|
|
7
13
|
|
|
8
14
|
```bash
|
|
@@ -20,6 +26,29 @@ npm install @fluxyte/sdk
|
|
|
20
26
|
|
|
21
27
|
Treat your API key like a password. Do not commit it to source control.
|
|
22
28
|
|
|
29
|
+
### Create an API key
|
|
30
|
+
|
|
31
|
+
1. Sign up at `https://fluxyte.com/signup`
|
|
32
|
+
2. Verify your email
|
|
33
|
+
3. Open the `Account` menu
|
|
34
|
+
4. Select `API Keys`
|
|
35
|
+
5. Click `Create API Key`
|
|
36
|
+
6. Choose key type:
|
|
37
|
+
- `pk_*` (PUBLIC) for frontend/browser SDK usage
|
|
38
|
+
- `sk_*` (SECRET) for backend/server-only usage
|
|
39
|
+
7. Copy your API key (shown once)
|
|
40
|
+
|
|
41
|
+
### Use an API key
|
|
42
|
+
|
|
43
|
+
All integrations authenticate with an API key sent in the `X-API-Key` header.
|
|
44
|
+
|
|
45
|
+
- Use `pk_*` keys in browser/public SDK integrations
|
|
46
|
+
- Use `sk_*` keys only in backend/server environments
|
|
47
|
+
- For `pk_*` keys, configure allowed origins to restrict frontend domains
|
|
48
|
+
- The key controls organization access, docs scope, and analytics ownership
|
|
49
|
+
|
|
50
|
+
### Environment examples
|
|
51
|
+
|
|
23
52
|
- Vite: `VITE_FLUXYTE_API_KEY=pk_...`
|
|
24
53
|
- Next.js: `NEXT_PUBLIC_FLUXYTE_API_KEY=pk_...` (public key only)
|
|
25
54
|
- Server: `FLUXYTE_API_KEY=sk_...`
|
|
@@ -302,6 +331,24 @@ start({
|
|
|
302
331
|
});
|
|
303
332
|
```
|
|
304
333
|
|
|
334
|
+
```tsx
|
|
335
|
+
import { useVoiceChat } from "@fluxyte/sdk/react";
|
|
336
|
+
|
|
337
|
+
const { sendVoice, loading, data, error } = useVoiceChat();
|
|
338
|
+
|
|
339
|
+
const res = await sendVoice({
|
|
340
|
+
audioBase64: "BASE64_AUDIO",
|
|
341
|
+
mimeType: "audio/webm",
|
|
342
|
+
context: { product: "analytics", userTarget: "admin" },
|
|
343
|
+
synthesize: true,
|
|
344
|
+
voice: "alloy",
|
|
345
|
+
audioFormat: "mp3",
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
console.log(res.transcript);
|
|
349
|
+
console.log(res.reply);
|
|
350
|
+
```
|
|
351
|
+
|
|
305
352
|
## Multi-Target
|
|
306
353
|
|
|
307
354
|
Use `context.product` or `context.service` to isolate onboarding targets under one account (apps, APIs, and services).
|
|
@@ -10,6 +10,15 @@ export declare function useVoiceChat(): {
|
|
|
10
10
|
audioFormat?: components["schemas"]["VoiceAudioFormat"] | null;
|
|
11
11
|
replyAudioBase64?: string | null;
|
|
12
12
|
}>;
|
|
13
|
+
sendVoice: (payload: VoiceChatRequest) => Promise<{
|
|
14
|
+
answerId: string;
|
|
15
|
+
transcript: string;
|
|
16
|
+
reply: string;
|
|
17
|
+
confidence?: number | null;
|
|
18
|
+
sources?: components["schemas"]["EvidenceItem"][];
|
|
19
|
+
audioFormat?: components["schemas"]["VoiceAudioFormat"] | null;
|
|
20
|
+
replyAudioBase64?: string | null;
|
|
21
|
+
}>;
|
|
13
22
|
data: {
|
|
14
23
|
answerId: string;
|
|
15
24
|
transcript: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceChat.d.ts","sourceRoot":"","sources":["../../src/react/useVoiceChat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,KAAK,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAGlE,wBAAgB,YAAY;oBAOR,gBAAgB;;;;;
|
|
1
|
+
{"version":3,"file":"useVoiceChat.d.ts","sourceRoot":"","sources":["../../src/react/useVoiceChat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,KAAK,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAGlE,wBAAgB,YAAY;oBAOR,gBAAgB;;;;;kBAuB2kI,qBAAsB;sBAAuC,qBAAsB;;;yBAvB9qI,gBAAgB;;;;;kBAuB2kI,qBAAsB;sBAAuC,qBAAsB;;;;;;;;kBAAnF,qBAAsB;sBAAuC,qBAAsB;;;;;EADjsI"}
|
|
@@ -22,6 +22,9 @@ export function useVoiceChat() {
|
|
|
22
22
|
setLoading(false);
|
|
23
23
|
}
|
|
24
24
|
}, [client]);
|
|
25
|
-
|
|
25
|
+
// Keep `send` for consistency with other hooks and expose `sendVoice`
|
|
26
|
+
// as an explicit alias for voice-focused integrations.
|
|
27
|
+
const sendVoice = send;
|
|
28
|
+
return { send, sendVoice, data, loading, error };
|
|
26
29
|
}
|
|
27
30
|
//# sourceMappingURL=useVoiceChat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceChat.js","sourceRoot":"","sources":["../../src/react/useVoiceChat.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAKlE,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,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