@clikvn/agent-widget-embedded 0.0.1-dev → 0.0.2-dev
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/dist/features/AgentWidget/index.d.ts +1 -0
- package/dist/features/AgentWidget/index.d.ts.map +1 -1
- package/dist/hooks/useChat.d.ts.map +1 -1
- package/dist/hooks/useChatData.d.ts +0 -3
- package/dist/hooks/useChatData.d.ts.map +1 -1
- package/dist/hooks/useConfiguration.d.ts +1 -0
- package/dist/hooks/useConfiguration.d.ts.map +1 -1
- package/dist/register.d.ts +2 -0
- package/dist/register.d.ts.map +1 -1
- package/dist/web.d.ts +1 -0
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +1 -1
- package/dist/window.d.ts +1 -0
- package/dist/window.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/AgentWidget/index.tsx +1 -1
- package/src/hooks/useChat.ts +3 -1
- package/src/hooks/useChatData.tsx +0 -3
- package/src/hooks/useConfiguration.tsx +1 -0
- package/src/register.tsx +2 -0
- package/src/window.ts +1 -0
package/dist/window.d.ts
CHANGED
package/dist/window.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../src/window.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE;QACf,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../src/window.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE;QACf,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACtC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE;QACN,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;CACtD,CAAC;AACF,eAAO,MAAM,UAAU,UAAW,gBAAgB,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,SAYnE,CAAC;AAEF,eAAO,MAAM,OAAO,YAEnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,OAAO,EAAE,OAAO,OAAO,CAAC;CACzB,CAAC;AAQF,eAAO,MAAM,eAAe;wBA7BM,gBAAgB,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE;;CAgClE,CAAC;AAEH,eAAO,MAAM,wBAAwB,UAAW,WAAW,SAG1D,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ export type AgentWidgetType = {
|
|
|
11
11
|
agentId: string;
|
|
12
12
|
overrideConfig?: {
|
|
13
13
|
chatId?: string | undefined;
|
|
14
|
+
overrideConfig?: Record<string, unknown>;
|
|
14
15
|
} & Record<string, unknown>;
|
|
15
16
|
theme?: {
|
|
16
17
|
avatar?: string;
|
|
@@ -34,7 +35,6 @@ const AgentWidget: FC<AgentWidgetType> = (props: AgentWidgetType) => {
|
|
|
34
35
|
<ChatDataProvider
|
|
35
36
|
data={{
|
|
36
37
|
chatId: props.overrideConfig?.chatId,
|
|
37
|
-
theme: props.theme,
|
|
38
38
|
}}
|
|
39
39
|
>
|
|
40
40
|
<Agent />
|
package/src/hooks/useChat.ts
CHANGED
|
@@ -36,7 +36,7 @@ type ReturnType = {
|
|
|
36
36
|
|
|
37
37
|
export const useChat = (props: PropsType): ReturnType => {
|
|
38
38
|
const { id, initialMessages, initialInput, agentId } = props;
|
|
39
|
-
const { apiHost } = useConfiguration();
|
|
39
|
+
const { apiHost, overrideConfig } = useConfiguration();
|
|
40
40
|
|
|
41
41
|
const idKey = id ?? generateUUID();
|
|
42
42
|
const chatIdRef = useRef<string>(idKey);
|
|
@@ -162,6 +162,7 @@ export const useChat = (props: PropsType): ReturnType => {
|
|
|
162
162
|
chatId: chatIdRef.current,
|
|
163
163
|
question: message.content,
|
|
164
164
|
chatflowId: bot?.id,
|
|
165
|
+
overrideConfig: overrideConfig?.overrideConfig,
|
|
165
166
|
});
|
|
166
167
|
setInput('');
|
|
167
168
|
};
|
|
@@ -204,6 +205,7 @@ export const useChat = (props: PropsType): ReturnType => {
|
|
|
204
205
|
question: input,
|
|
205
206
|
uploads: files || [],
|
|
206
207
|
chatflowId: bot?.id,
|
|
208
|
+
overrideConfig: overrideConfig?.overrideConfig,
|
|
207
209
|
});
|
|
208
210
|
setInput('');
|
|
209
211
|
},
|
|
@@ -7,9 +7,6 @@ import { useConfiguration } from './useConfiguration';
|
|
|
7
7
|
|
|
8
8
|
type ChatData = {
|
|
9
9
|
chatId?: string | undefined;
|
|
10
|
-
theme?: {
|
|
11
|
-
avatar?: string;
|
|
12
|
-
} & Record<string, unknown>;
|
|
13
10
|
listeners?: Record<EVENT_TYPE, (props: any) => void>;
|
|
14
11
|
initialMessages?: ChatMessageType[];
|
|
15
12
|
};
|
package/src/register.tsx
CHANGED
|
@@ -8,6 +8,7 @@ type AgentType = {
|
|
|
8
8
|
agentId: string;
|
|
9
9
|
overrideConfig?: {
|
|
10
10
|
chatId?: string | undefined;
|
|
11
|
+
overrideConfig?: Record<string, unknown>;
|
|
11
12
|
} & Record<string, unknown>;
|
|
12
13
|
theme?: {
|
|
13
14
|
avatar?: string;
|
|
@@ -20,6 +21,7 @@ export class AgentWidgetComponent extends HTMLElement {
|
|
|
20
21
|
agentId?: string;
|
|
21
22
|
overrideConfig?: {
|
|
22
23
|
chatId?: string | undefined;
|
|
24
|
+
overrideConfig?: Record<string, unknown>;
|
|
23
25
|
} & Record<string, unknown>;
|
|
24
26
|
theme?: {
|
|
25
27
|
avatar?: string;
|