@sksharma72000/ai-chat-websdk 1.0.3 → 1.1.1
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 +4 -1
- package/ai-chat-websdk.es.js +4785 -4702
- package/ai-chat-websdk.standalone.js +94 -90
- package/ai-chat-websdk.umd.js +26 -22
- package/hooks/useChatMode.d.ts +3 -1
- package/package.json +1 -1
- package/types/config.d.ts +9 -0
package/README.md
CHANGED
|
@@ -46,7 +46,9 @@ AIChatSDK.initialize({
|
|
|
46
46
|
const { token } = await res.json();
|
|
47
47
|
return token; // 'Bearer ' prefix is optional — the SDK normalises it
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
onBeforeMessageSend:(data)=>{
|
|
50
|
+
return data
|
|
51
|
+
}
|
|
50
52
|
// Branding
|
|
51
53
|
title: 'Support Chat',
|
|
52
54
|
logo: 'https://example.com/logo.png',
|
|
@@ -131,6 +133,7 @@ The **standalone bundle** has React baked in — drop two tags into any HTML pag
|
|
|
131
133
|
| `apiUrl` | `string` | **required** | Base URL of the AI server |
|
|
132
134
|
| `jwtToken` | `string` | — | JWT token (with or without `Bearer ` prefix) |
|
|
133
135
|
| `onTokenExpired` | `() => Promise<string>` | — | Called on 401; return new token; SDK retries automatically |
|
|
136
|
+
| `onBeforeMessageSend` | `(body: any) => Promise<any> \| any` | — | Called with the outgoing request body before it's JSON-stringified; may modify and return the body. |
|
|
134
137
|
| `title` | `string` | `'AI Assistant'` | Header title |
|
|
135
138
|
| `logo` | `string` | — | URL or base64 of logo image |
|
|
136
139
|
| `welcomeMessage` | `string` | — | Markdown string shown as the first AI message |
|