@asgard-js/react 0.0.21 → 0.0.22
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 +72 -28
- package/dist/components/chatbot/chatbot.d.ts +6 -2
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/components/templates/button-template/card.d.ts.map +1 -1
- package/dist/context/asgard-service-context.d.ts +7 -4
- package/dist/context/asgard-service-context.d.ts.map +1 -1
- package/dist/context/asgard-template-context.d.ts +11 -3
- package/dist/context/asgard-template-context.d.ts.map +1 -1
- package/dist/hooks/use-channel.d.ts +5 -3
- package/dist/hooks/use-channel.d.ts.map +1 -1
- package/dist/index.js +3887 -3867
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,38 +15,77 @@ yarn add @asgard-js/core @asgard-js/react
|
|
|
15
15
|
Here's a basic example of how to use the React components:
|
|
16
16
|
|
|
17
17
|
```javascript
|
|
18
|
-
import React from 'react';
|
|
18
|
+
import React, { useRef } from 'react';
|
|
19
19
|
import { Chatbot } from '@asgard-js/react';
|
|
20
20
|
|
|
21
|
+
const chatbotRef = useRef(null);
|
|
22
|
+
|
|
21
23
|
const App = () => {
|
|
22
24
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
<div style={{ width: '800px', position: 'relative' }}>
|
|
26
|
+
<button
|
|
27
|
+
style={{
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: '80px',
|
|
30
|
+
right: '50%',
|
|
31
|
+
transform: 'translateX(50%)',
|
|
32
|
+
zIndex: 10,
|
|
33
|
+
border: '1px solid white',
|
|
34
|
+
borderRadius: '5px',
|
|
35
|
+
color: 'white',
|
|
36
|
+
backgroundColor: 'transparent',
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
padding: '0.5rem 1rem',
|
|
39
|
+
}}
|
|
40
|
+
onClick={() =>
|
|
41
|
+
chatbotRef.current?.serviceContext?.sendMessage?.({ text: 'Hello' })
|
|
34
42
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
>
|
|
44
|
+
Send a message from outside of chatbot
|
|
45
|
+
</button>
|
|
46
|
+
<Chatbot
|
|
47
|
+
ref={chatbotRef}
|
|
48
|
+
title="Asgard AI Chatbot"
|
|
49
|
+
config={{
|
|
50
|
+
apiKey: 'your-api-key',
|
|
51
|
+
endpoint:
|
|
52
|
+
'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}/message/sse',
|
|
53
|
+
botProviderEndpoint:
|
|
54
|
+
'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}',
|
|
55
|
+
onExecutionError: (error) => {
|
|
56
|
+
console.error('Execution error:', error);
|
|
57
|
+
},
|
|
58
|
+
transformSsePayload: (payload) => {
|
|
59
|
+
return payload;
|
|
60
|
+
},
|
|
61
|
+
}}
|
|
62
|
+
enableLoadConfigFromService={true}
|
|
63
|
+
customChannelId="your-channel-id"
|
|
64
|
+
initMessages={[]}
|
|
65
|
+
debugMode={false}
|
|
66
|
+
fullScreen={false}
|
|
67
|
+
avatar="https://example.com/avatar.png"
|
|
68
|
+
botTypingPlaceholder="Bot is typing..."
|
|
69
|
+
onReset={() => {
|
|
70
|
+
console.log('Chat reset');
|
|
71
|
+
}}
|
|
72
|
+
onClose={() => {
|
|
73
|
+
console.log('Chat closed');
|
|
74
|
+
}}
|
|
75
|
+
onSseMessage={(response, ctx) => {
|
|
76
|
+
if (response.eventType === 'asgard.run.done') {
|
|
77
|
+
console.log('onSseMessage', response, ctx.conversation);
|
|
78
|
+
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
// delay some time to wait for the serviceContext to be available
|
|
81
|
+
chatbotRef.current?.serviceContext?.sendMessage?.({
|
|
82
|
+
text: 'Say hi after 5 seconds',
|
|
83
|
+
});
|
|
84
|
+
}, 5000);
|
|
85
|
+
}
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
50
89
|
);
|
|
51
90
|
};
|
|
52
91
|
|
|
@@ -74,11 +113,15 @@ export default App;
|
|
|
74
113
|
- **theme**: `Partial<AsgardThemeContextValue>` - Custom theme configuration
|
|
75
114
|
- **onReset**: `() => void` - Callback function when chat is reset
|
|
76
115
|
- **onClose**: `() => void` - Callback function when chat is closed
|
|
116
|
+
- **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.
|
|
117
|
+
- **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.
|
|
77
118
|
|
|
78
119
|
### Theme Configuration
|
|
120
|
+
|
|
79
121
|
The theme configuration can be obtained from the bot provider metadata of `annotations` field and `theme` props.
|
|
80
122
|
|
|
81
123
|
The priority of themes is as follows (high to low):
|
|
124
|
+
|
|
82
125
|
1. Theme from props
|
|
83
126
|
2. Theme from annotations from bot provider metadata
|
|
84
127
|
3. Default theme
|
|
@@ -228,7 +271,7 @@ const defaultTheme = {
|
|
|
228
271
|
style: {},
|
|
229
272
|
},
|
|
230
273
|
},
|
|
231
|
-
}
|
|
274
|
+
};
|
|
232
275
|
```
|
|
233
276
|
|
|
234
277
|
### Usage Example
|
|
@@ -269,6 +312,7 @@ To develop the React package locally, follow these steps:
|
|
|
269
312
|
1. Clone the repository and navigate to the project root directory.
|
|
270
313
|
|
|
271
314
|
2. Install dependencies:
|
|
315
|
+
|
|
272
316
|
```sh
|
|
273
317
|
yarn install
|
|
274
318
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsgardTemplateContextValue } from '../../context';
|
|
1
|
+
import { AsgardServiceContextValue, AsgardTemplateContextValue, AsgardServiceContextProviderProps } from '../../context';
|
|
2
2
|
import { AsgardThemeContextValue } from '../../context/asgard-theme-context';
|
|
3
3
|
import { ClientConfig, ConversationMessage } from '@asgard-js/core';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
@@ -10,6 +10,7 @@ interface ChatbotProps extends AsgardTemplateContextValue {
|
|
|
10
10
|
config: ClientConfig;
|
|
11
11
|
customChannelId: string;
|
|
12
12
|
initMessages?: ConversationMessage[];
|
|
13
|
+
onSseMessage?: AsgardServiceContextProviderProps['onSseMessage'];
|
|
13
14
|
fullScreen?: boolean;
|
|
14
15
|
avatar?: string;
|
|
15
16
|
botTypingPlaceholder?: string;
|
|
@@ -19,6 +20,9 @@ interface ChatbotProps extends AsgardTemplateContextValue {
|
|
|
19
20
|
onClose?: () => void;
|
|
20
21
|
loadingComponent?: ReactNode;
|
|
21
22
|
}
|
|
22
|
-
export
|
|
23
|
+
export interface ChatbotRef {
|
|
24
|
+
serviceContext?: AsgardServiceContextValue;
|
|
25
|
+
}
|
|
26
|
+
export declare const Chatbot: import('react').ForwardRefExoticComponent<ChatbotProps & import('react').RefAttributes<ChatbotRef>>;
|
|
23
27
|
export {};
|
|
24
28
|
//# sourceMappingURL=chatbot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAEL,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,yBAAyB,EAEzB,0BAA0B,EAE1B,iCAAiC,EAClC,MAAM,aAAa,CAAC;AAMrB,UAAU,YAAa,SAAQ,0BAA0B;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACzC,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,iCAAiC,CAAC,cAAc,CAAC,CAAC;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,yBAAyB,CAAC;CAC5C;AAED,eAAO,MAAM,OAAO,qGA8DlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAE3E,OAAO,EAEL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,UAAU,SAAS;IACjB,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;CAC9E;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAE3E,OAAO,EAEL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,UAAU,SAAS;IACjB,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;CAC9E;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAoFhD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseChannelReturn } from '../hooks';
|
|
2
|
-
import {
|
|
1
|
+
import { UseChannelProps, UseChannelReturn } from '../hooks';
|
|
2
|
+
import { ForwardedRef, ReactNode, RefObject } from 'react';
|
|
3
3
|
import { AsgardServiceClient, ClientConfig, ConversationMessage } from '@asgard-js/core';
|
|
4
4
|
|
|
5
5
|
export interface AsgardServiceContextValue {
|
|
@@ -16,8 +16,11 @@ export interface AsgardServiceContextValue {
|
|
|
16
16
|
botTypingPlaceholder?: string;
|
|
17
17
|
}
|
|
18
18
|
export declare const AsgardServiceContext: import('react').Context<AsgardServiceContextValue>;
|
|
19
|
-
interface AsgardServiceContextProviderProps
|
|
19
|
+
export interface AsgardServiceContextProviderProps {
|
|
20
20
|
children: ReactNode;
|
|
21
|
+
parentRef?: ForwardedRef<Partial<{
|
|
22
|
+
serviceContext?: AsgardServiceContextValue;
|
|
23
|
+
}>>;
|
|
21
24
|
avatar?: string;
|
|
22
25
|
config: ClientConfig;
|
|
23
26
|
botTypingPlaceholder?: string;
|
|
@@ -25,8 +28,8 @@ interface AsgardServiceContextProviderProps extends DetailedHTMLProps<HTMLAttrib
|
|
|
25
28
|
customMessageId?: string;
|
|
26
29
|
delayTime?: number;
|
|
27
30
|
initMessages?: ConversationMessage[];
|
|
31
|
+
onSseMessage?: UseChannelProps['onSseMessage'];
|
|
28
32
|
}
|
|
29
33
|
export declare function AsgardServiceContextProvider(props: AsgardServiceContextProviderProps): ReactNode;
|
|
30
34
|
export declare function useAsgardContext(): AsgardServiceContextValue;
|
|
31
|
-
export {};
|
|
32
35
|
//# sourceMappingURL=asgard-service-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,eAAe,EACf,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,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;IAC/C,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,oBAAoB,oDAS/B,CAAC;AAEH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,CACtB,OAAO,CAAC;QAAE,cAAc,CAAC,EAAE,yBAAyB,CAAA;KAAE,CAAC,CACxD,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;CAChD;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iCAAiC,GACvC,SAAS,CAsEX;AAED,wBAAgB,gBAAgB,IAAI,yBAAyB,CAE5D"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { ConversationErrorMessage } from '@asgard-js/core';
|
|
1
|
+
import { ConversationErrorMessage, FetchSsePayload } from '@asgard-js/core';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
export interface AsgardTemplateContextValue {
|
|
5
5
|
onErrorClick?: (message: ConversationErrorMessage) => void;
|
|
6
6
|
errorMessageRenderer?: (message: ConversationErrorMessage) => ReactNode;
|
|
7
|
-
onTemplateBtnClick?: (payload:
|
|
7
|
+
onTemplateBtnClick?: (payload: Record<string, unknown>, { sse, }: {
|
|
8
|
+
sse: {
|
|
9
|
+
sendMessage: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
|
|
10
|
+
};
|
|
11
|
+
}) => void;
|
|
8
12
|
}
|
|
9
13
|
export declare const AsgardTemplateContext: import('react').Context<AsgardTemplateContextValue>;
|
|
10
14
|
interface AsgardTemplateContextProviderProps extends PropsWithChildren {
|
|
11
15
|
onErrorClick?: (message: ConversationErrorMessage) => void;
|
|
12
16
|
errorMessageRenderer?: (message: ConversationErrorMessage) => ReactNode;
|
|
13
|
-
onTemplateBtnClick?: (payload:
|
|
17
|
+
onTemplateBtnClick?: (payload: Record<string, unknown>, { sse, }: {
|
|
18
|
+
sse: {
|
|
19
|
+
sendMessage: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
|
|
20
|
+
};
|
|
21
|
+
}) => void;
|
|
14
22
|
}
|
|
15
23
|
export declare function AsgardTemplateContextProvider(props: AsgardTemplateContextProviderProps): ReactNode;
|
|
16
24
|
export declare function useAsgardTemplateContext(): AsgardTemplateContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-template-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-template-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"asgard-template-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-template-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,WAAW,0BAA0B;IACzC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAC/C,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;CACX;AAED,eAAO,MAAM,qBAAqB,qDAIhC,CAAC;AAEH,UAAU,kCAAmC,SAAQ,iBAAiB;IACpE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAC/C,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;CACX;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,SAAS,CAcX;AAED,wBAAgB,wBAAwB,IAAI,0BAA0B,CAErE"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { AsgardServiceClient, Conversation, ConversationMessage, FetchSsePayload } from '@asgard-js/core';
|
|
1
|
+
import { AsgardServiceClient, Conversation, ConversationMessage, EventType, FetchSsePayload, SseResponse } from '@asgard-js/core';
|
|
2
2
|
|
|
3
|
-
interface UseChannelProps {
|
|
3
|
+
export interface UseChannelProps {
|
|
4
4
|
defaultIsOpen?: boolean;
|
|
5
5
|
resetPayload?: Pick<FetchSsePayload, 'text' | 'payload'>;
|
|
6
6
|
client: AsgardServiceClient | null;
|
|
7
7
|
customChannelId: string;
|
|
8
8
|
customMessageId?: string;
|
|
9
9
|
initMessages?: ConversationMessage[];
|
|
10
|
+
onSseMessage?: (response: SseResponse<EventType>, context: {
|
|
11
|
+
conversation: Conversation | null;
|
|
12
|
+
}) => void;
|
|
10
13
|
}
|
|
11
14
|
export interface UseChannelReturn {
|
|
12
15
|
isOpen: boolean;
|
|
@@ -18,5 +21,4 @@ export interface UseChannelReturn {
|
|
|
18
21
|
closeChannel?: () => void;
|
|
19
22
|
}
|
|
20
23
|
export declare function useChannel(props: UseChannelProps): UseChannelReturn;
|
|
21
|
-
export {};
|
|
22
24
|
//# sourceMappingURL=use-channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAGnB,YAAY,EACZ,mBAAmB,EACnB,eAAe,
|
|
1
|
+
{"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAGnB,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,CACb,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,EAChC,OAAO,EAAE;QACP,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;KACnC,KACE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAC3E,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAC5E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAoHnE"}
|