@asgard-js/react 0.2.10 → 0.2.12
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 +82 -0
- package/dist/components/chatbot/api-key-input/api-key-input.d.ts +3 -1
- package/dist/components/chatbot/api-key-input/api-key-input.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot-footer/chatbot-footer.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot.d.ts +3 -1
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/context/asgard-service-context.d.ts +14 -2
- package/dist/context/asgard-service-context.d.ts.map +1 -1
- package/dist/hooks/use-resize-observer.d.ts +1 -1
- package/dist/hooks/use-resize-observer.d.ts.map +1 -1
- package/dist/index.js +8005 -7998
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -313,6 +313,7 @@ config: {
|
|
|
313
313
|
- **messageActions?**: `(message: ConversationBotMessage) => MessageActionConfig[]` - Function to define which action buttons to display for each bot message. Returns an array of `{ id: string, label: string }` objects. See [Message Actions](#message-actions) section for details.
|
|
314
314
|
- **onMessageAction?**: `(actionId: string, message: ConversationBotMessage) => void` - Callback when a message action button is clicked. Receives the action ID and the associated bot message.
|
|
315
315
|
- **renderMessageContent?**: `(props: MessageContentRendererProps) => ReactNode` - Custom renderer for message content. Allows customizing how messages are rendered based on message properties. See [Custom Message Renderer](#custom-message-renderer) section for details.
|
|
316
|
+
- **onBeforeSendMessage?**: `(params: SendMessageParams) => SendMessageParams` - Callback to modify message params before sending. Allows injecting contextual data (payload, metadata) from parent components. See [Before Send Message Hook](#before-send-message-hook) section for details.
|
|
316
317
|
- **onSseMessage**: `(response: SseResponse, ctx: AsgardServiceContextValue) => void` - Callback function when SSE message is received. It would be helpful if using with the ref to provide some context and conversation data and do some proactively actions like sending messages to the bot.
|
|
317
318
|
- **ref**: `ForwardedRef<ChatbotRef>` - Forwarded ref to access the chatbot instance. It can be used to access the chatbot instance and do some actions like sending messages to the bot. ChatbotRef extends the ref of the chatbot instance and provides some additional methods like `serviceContext.sendMessage` to interact with the chatbot instance.
|
|
318
319
|
|
|
@@ -999,6 +1000,87 @@ renderMessageContent={(props) => {
|
|
|
999
1000
|
}}
|
|
1000
1001
|
```
|
|
1001
1002
|
|
|
1003
|
+
<a id="before-send-message-hook"></a>
|
|
1004
|
+
<br/>
|
|
1005
|
+
|
|
1006
|
+
### Before Send Message Hook
|
|
1007
|
+
|
|
1008
|
+
The `onBeforeSendMessage` prop allows you to modify message parameters before they are sent. This is useful for injecting contextual data from parent components into every message.
|
|
1009
|
+
|
|
1010
|
+
#### SendMessageParams Interface
|
|
1011
|
+
|
|
1012
|
+
```typescript
|
|
1013
|
+
interface SendMessageParams {
|
|
1014
|
+
text: string;
|
|
1015
|
+
blobIds?: string[];
|
|
1016
|
+
filePreviewUrls?: string[];
|
|
1017
|
+
documentNames?: string[];
|
|
1018
|
+
payload?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
1019
|
+
}
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
#### Use Case
|
|
1023
|
+
|
|
1024
|
+
When the Chatbot component is embedded in a page that has contextual information (e.g., selected category, current step, user preferences), you can inject this context into every message so the backend can provide more relevant responses.
|
|
1025
|
+
|
|
1026
|
+
#### Usage Example
|
|
1027
|
+
|
|
1028
|
+
```typescript
|
|
1029
|
+
import { useState, useCallback } from 'react';
|
|
1030
|
+
import { Chatbot, SendMessageParams } from '@asgard-js/react';
|
|
1031
|
+
|
|
1032
|
+
const TopicCreatePage = () => {
|
|
1033
|
+
const [selectedCategory, setSelectedCategory] = useState<{ id: string; name: string } | null>(null);
|
|
1034
|
+
|
|
1035
|
+
const handleBeforeSendMessage = useCallback(
|
|
1036
|
+
(params: SendMessageParams): SendMessageParams => {
|
|
1037
|
+
if (selectedCategory) {
|
|
1038
|
+
return {
|
|
1039
|
+
...params,
|
|
1040
|
+
payload: {
|
|
1041
|
+
categoryId: selectedCategory.id,
|
|
1042
|
+
categoryName: selectedCategory.name,
|
|
1043
|
+
currentPage: 'topics/create',
|
|
1044
|
+
},
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
return params;
|
|
1048
|
+
},
|
|
1049
|
+
[selectedCategory],
|
|
1050
|
+
);
|
|
1051
|
+
|
|
1052
|
+
return (
|
|
1053
|
+
<div>
|
|
1054
|
+
{/* Category selector */}
|
|
1055
|
+
<select
|
|
1056
|
+
onChange={e => setSelectedCategory({ id: e.target.value, name: e.target.options[e.target.selectedIndex].text })}
|
|
1057
|
+
>
|
|
1058
|
+
<option value="tech">Technology</option>
|
|
1059
|
+
<option value="lifestyle">Lifestyle</option>
|
|
1060
|
+
</select>
|
|
1061
|
+
|
|
1062
|
+
{/* Chatbot with context injection */}
|
|
1063
|
+
<Chatbot config={config} customChannelId="topic-create-chat" onBeforeSendMessage={handleBeforeSendMessage} />
|
|
1064
|
+
</div>
|
|
1065
|
+
);
|
|
1066
|
+
};
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
#### Backend Integration
|
|
1070
|
+
|
|
1071
|
+
The injected payload will be included in the SSE request body, allowing your backend to access contextual information:
|
|
1072
|
+
|
|
1073
|
+
```json
|
|
1074
|
+
{
|
|
1075
|
+
"text": "Help me write about AI",
|
|
1076
|
+
"payload": {
|
|
1077
|
+
"categoryId": "tech",
|
|
1078
|
+
"categoryName": "Technology",
|
|
1079
|
+
"currentPage": "topics/create"
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1002
1084
|
<a id="development"></a>
|
|
1003
1085
|
<br/>
|
|
1004
1086
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
1
3
|
export interface ApiKeyInputProps {
|
|
2
4
|
onSubmit: (apiKey: string) => void | Promise<void>;
|
|
3
5
|
loading?: boolean;
|
|
@@ -7,5 +9,5 @@ export interface ApiKeyInputProps {
|
|
|
7
9
|
showToggle?: boolean;
|
|
8
10
|
className?: string;
|
|
9
11
|
}
|
|
10
|
-
export declare function ApiKeyInput({ onSubmit, loading, error, placeholder, title, showToggle, className, }: ApiKeyInputProps):
|
|
12
|
+
export declare function ApiKeyInput({ onSubmit, loading, error, placeholder, title, showToggle, className, }: ApiKeyInputProps): ReactNode;
|
|
11
13
|
//# sourceMappingURL=api-key-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-input.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/api-key-input/api-key-input.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-key-input.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/api-key-input/api-key-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AASzE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAe,EACf,KAAK,EACL,WAA8B,EAC9B,KAAiB,EACjB,UAAiB,EACjB,SAAS,GACV,EAAE,gBAAgB,GAAG,SAAS,CAqF9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAMV,MAAM,OAAO,CAAC;AAyBf,wBAAgB,aAAa,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAMV,MAAM,OAAO,CAAC;AAyBf,wBAAgB,aAAa,IAAI,SAAS,CA2yBzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsgardServiceContextValue, AsgardTemplateContextValue, AsgardServiceContextProviderProps } from '../../context';
|
|
1
|
+
import { AsgardServiceContextValue, AsgardTemplateContextValue, AsgardServiceContextProviderProps, SendMessageParams } from '../../context';
|
|
2
2
|
import { AsgardThemeContextValue } from '../../context/asgard-theme-context';
|
|
3
3
|
import { ClientConfig, ConversationMessage, AuthState } from '../../../../core/src/index.ts';
|
|
4
4
|
import { ReactNode, CSSProperties } from 'react';
|
|
@@ -34,6 +34,8 @@ interface ChatbotProps extends AsgardTemplateContextValue {
|
|
|
34
34
|
isBotProviderError: boolean;
|
|
35
35
|
errorDetail?: unknown;
|
|
36
36
|
}) => void;
|
|
37
|
+
/** Callback to modify message params before sending */
|
|
38
|
+
onBeforeSendMessage?: (params: SendMessageParams) => SendMessageParams;
|
|
37
39
|
}
|
|
38
40
|
export interface ChatbotRef {
|
|
39
41
|
serviceContext?: AsgardServiceContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAA8B,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AACzG,OAAO,EAEL,yBAAyB,EAEzB,0BAA0B,EAE1B,iCAAiC,
|
|
1
|
+
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot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C;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAG5D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAE5G,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,iBAAiB,CAAC;CACxE;AAED,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,yBAAyB,CAAC;CAC5C;AAED,eAAO,MAAM,OAAO,qGAwLlB,CAAC"}
|
|
@@ -2,6 +2,14 @@ import { UseChannelProps, UseChannelReturn } from '../hooks';
|
|
|
2
2
|
import { ForwardedRef, ReactNode, RefObject } from 'react';
|
|
3
3
|
import { AsgardServiceClient, ClientConfig, ConversationMessage } from '../../../core/src/index.ts';
|
|
4
4
|
|
|
5
|
+
/** Parameters for sending a message */
|
|
6
|
+
export interface SendMessageParams {
|
|
7
|
+
text: string;
|
|
8
|
+
blobIds?: string[];
|
|
9
|
+
filePreviewUrls?: string[];
|
|
10
|
+
documentNames?: string[];
|
|
11
|
+
payload?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
12
|
+
}
|
|
5
13
|
export interface AsgardServiceContextValue {
|
|
6
14
|
avatar?: string;
|
|
7
15
|
title?: string;
|
|
@@ -11,7 +19,7 @@ export interface AsgardServiceContextValue {
|
|
|
11
19
|
isResetting: boolean;
|
|
12
20
|
isConnecting: boolean;
|
|
13
21
|
messages: Map<string, ConversationMessage> | null;
|
|
14
|
-
messageBoxBottomRef: RefObject<HTMLDivElement>;
|
|
22
|
+
messageBoxBottomRef: RefObject<HTMLDivElement | null>;
|
|
15
23
|
sendMessage?: UseChannelReturn['sendMessage'];
|
|
16
24
|
resetChannel?: UseChannelReturn['resetChannel'];
|
|
17
25
|
closeChannel?: UseChannelReturn['closeChannel'];
|
|
@@ -20,6 +28,8 @@ export interface AsgardServiceContextValue {
|
|
|
20
28
|
enableUpload?: boolean;
|
|
21
29
|
enableExport?: boolean;
|
|
22
30
|
enableDocumentUpload?: boolean;
|
|
31
|
+
/** Callback to modify message params before sending */
|
|
32
|
+
onBeforeSendMessage?: (params: SendMessageParams) => SendMessageParams;
|
|
23
33
|
/** 用戶是否正在跟隨最新內容(用於自動滾動判斷) */
|
|
24
34
|
isFollowingLatest: boolean;
|
|
25
35
|
/** 設定跟隨狀態 */
|
|
@@ -29,7 +39,7 @@ export interface AsgardServiceContextValue {
|
|
|
29
39
|
/** 程式滾動到底部(不會改變跟隨狀態) */
|
|
30
40
|
programmaticScrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
31
41
|
/** 滾動容器的 ref */
|
|
32
|
-
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
42
|
+
scrollContainerRef: RefObject<HTMLDivElement | null>;
|
|
33
43
|
}
|
|
34
44
|
export declare const AsgardServiceContext: import('react').Context<AsgardServiceContextValue>;
|
|
35
45
|
export interface AsgardServiceContextProviderProps {
|
|
@@ -55,6 +65,8 @@ export interface AsgardServiceContextProviderProps {
|
|
|
55
65
|
isBotProviderError: boolean;
|
|
56
66
|
errorDetail?: unknown;
|
|
57
67
|
}) => void;
|
|
68
|
+
/** Callback to modify message params before sending */
|
|
69
|
+
onBeforeSendMessage?: (params: SendMessageParams) => SendMessageParams;
|
|
58
70
|
}
|
|
59
71
|
export declare function AsgardServiceContextProvider(props: AsgardServiceContextProviderProps): ReactNode;
|
|
60
72
|
export declare function useAsgardContext(): AsgardServiceContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,SAAS,EAOV,MAAM,OAAO,CAAC;AACf,OAAO,EAAsC,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjG,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,IAAI,CAAC;IAClD,mBAAmB,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,SAAS,EAOV,MAAM,OAAO,CAAC;AACf,OAAO,EAAsC,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjG,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,C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|
import { RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
interface UseResizeObserverProps {
|
|
4
|
-
ref: RefObject<HTMLDivElement>;
|
|
4
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
5
5
|
onResize: (width: number, height: number) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function useResizeObserver(props: UseResizeObserverProps): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-resize-observer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-resize-observer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C,UAAU,sBAAsB;IAC9B,GAAG,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"use-resize-observer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-resize-observer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C,UAAU,sBAAsB;IAC9B,GAAG,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACtC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAmBrE"}
|