@super_studio/ecforce-ai-agent-react 0.6.0-canary.2 → 0.6.0-canary.4
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.
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { MCP } from "./provider/use-chatbot-frame-handler";
|
|
2
1
|
export type ChatbotFrameProps = {
|
|
3
|
-
/** 管理画面上のエージェントID */
|
|
4
|
-
agentId: string;
|
|
5
2
|
/** 初期化時のチャットID */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
initialConfig?: {
|
|
4
|
+
agentId?: string;
|
|
5
|
+
chatId?: string;
|
|
6
|
+
model?: string;
|
|
7
|
+
};
|
|
9
8
|
/** アプリ名のメタデータ */
|
|
10
9
|
appName?: string;
|
|
11
10
|
/** セッションを取得するための関数 */
|
|
@@ -28,7 +27,7 @@ export type ChatbotFrameProps = {
|
|
|
28
27
|
url?: string;
|
|
29
28
|
className?: string;
|
|
30
29
|
};
|
|
31
|
-
export declare function ChatbotFrame({
|
|
30
|
+
export declare function ChatbotFrame({ appName, initialConfig, getSession, enabled, url, className, }: ChatbotFrameProps): import("react/jsx-runtime").JSX.Element;
|
|
32
31
|
export type SessionData = {
|
|
33
32
|
token: string;
|
|
34
33
|
expiresAt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-frame.d.ts","sourceRoot":"","sources":["../../src/components/chatbot-frame.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatbot-frame.d.ts","sourceRoot":"","sources":["../../src/components/chatbot-frame.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,kBAAkB;IAClB,aAAa,CAAC,EAAE;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,iBAAiB;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,aAAa,EACb,UAAU,EACV,OAAc,EACd,GAAG,EACH,SAAS,GACV,EAAE,iBAAiB,2CAiEnB;AAsBD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;CACzC,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,EAAE,eAAe,sBAuCzD"}
|
package/dist/index.js
CHANGED
|
@@ -199,10 +199,8 @@ var PROD_CHATBOT_URL = "https://agent.ec-force.com";
|
|
|
199
199
|
// src/components/chatbot-frame.tsx
|
|
200
200
|
|
|
201
201
|
function ChatbotFrame({
|
|
202
|
-
agentId,
|
|
203
202
|
appName,
|
|
204
|
-
|
|
205
|
-
mcps,
|
|
203
|
+
initialConfig,
|
|
206
204
|
getSession,
|
|
207
205
|
enabled = true,
|
|
208
206
|
url,
|
|
@@ -222,22 +220,14 @@ function ChatbotFrame({
|
|
|
222
220
|
React5.default.useEffect(() => {
|
|
223
221
|
if (shouldInit && !sentInitRef.current) {
|
|
224
222
|
init({
|
|
225
|
-
mcps,
|
|
226
223
|
appName,
|
|
227
224
|
sessionToken
|
|
228
225
|
});
|
|
229
226
|
sentInitRef.current = true;
|
|
230
|
-
setCurrentMcps(mcps);
|
|
231
227
|
setCurrentAppName(appName);
|
|
232
228
|
setCurrentSessionToken(sessionToken);
|
|
233
229
|
}
|
|
234
|
-
}, [enabled, init,
|
|
235
|
-
React5.default.useEffect(() => {
|
|
236
|
-
if (sentInitRef.current && mcps && JSON.stringify(currentMcps) !== JSON.stringify(mcps)) {
|
|
237
|
-
setMcps(mcps);
|
|
238
|
-
setCurrentMcps(mcps);
|
|
239
|
-
}
|
|
240
|
-
}, [mcps]);
|
|
230
|
+
}, [enabled, init, appName, isReady, sessionToken]);
|
|
241
231
|
React5.default.useEffect(() => {
|
|
242
232
|
if (sentInitRef.current && appName && currentAppName !== appName) {
|
|
243
233
|
setCurrentAppName(appName);
|
|
@@ -256,8 +246,7 @@ function ChatbotFrame({
|
|
|
256
246
|
ref: setIframeEl,
|
|
257
247
|
src: buildIframeUrl({
|
|
258
248
|
baseUrl,
|
|
259
|
-
|
|
260
|
-
initialChatId
|
|
249
|
+
initialConfig
|
|
261
250
|
}),
|
|
262
251
|
className,
|
|
263
252
|
allow: "clipboard-write",
|
|
@@ -270,12 +259,11 @@ function ChatbotFrame({
|
|
|
270
259
|
}
|
|
271
260
|
function buildIframeUrl({
|
|
272
261
|
baseUrl,
|
|
273
|
-
|
|
274
|
-
initialChatId
|
|
262
|
+
initialConfig
|
|
275
263
|
}) {
|
|
276
|
-
const url = new URL(`/embed
|
|
277
|
-
if (
|
|
278
|
-
url.searchParams.set("
|
|
264
|
+
const url = new URL(`/embed`, baseUrl);
|
|
265
|
+
if (initialConfig) {
|
|
266
|
+
url.searchParams.set("initialConfig", JSON.stringify(initialConfig));
|
|
279
267
|
}
|
|
280
268
|
return url.toString();
|
|
281
269
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -199,10 +199,8 @@ var PROD_CHATBOT_URL = "https://agent.ec-force.com";
|
|
|
199
199
|
// src/components/chatbot-frame.tsx
|
|
200
200
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
201
201
|
function ChatbotFrame({
|
|
202
|
-
agentId,
|
|
203
202
|
appName,
|
|
204
|
-
|
|
205
|
-
mcps,
|
|
203
|
+
initialConfig,
|
|
206
204
|
getSession,
|
|
207
205
|
enabled = true,
|
|
208
206
|
url,
|
|
@@ -222,22 +220,14 @@ function ChatbotFrame({
|
|
|
222
220
|
React4.useEffect(() => {
|
|
223
221
|
if (shouldInit && !sentInitRef.current) {
|
|
224
222
|
init({
|
|
225
|
-
mcps,
|
|
226
223
|
appName,
|
|
227
224
|
sessionToken
|
|
228
225
|
});
|
|
229
226
|
sentInitRef.current = true;
|
|
230
|
-
setCurrentMcps(mcps);
|
|
231
227
|
setCurrentAppName(appName);
|
|
232
228
|
setCurrentSessionToken(sessionToken);
|
|
233
229
|
}
|
|
234
|
-
}, [enabled, init,
|
|
235
|
-
React4.useEffect(() => {
|
|
236
|
-
if (sentInitRef.current && mcps && JSON.stringify(currentMcps) !== JSON.stringify(mcps)) {
|
|
237
|
-
setMcps(mcps);
|
|
238
|
-
setCurrentMcps(mcps);
|
|
239
|
-
}
|
|
240
|
-
}, [mcps]);
|
|
230
|
+
}, [enabled, init, appName, isReady, sessionToken]);
|
|
241
231
|
React4.useEffect(() => {
|
|
242
232
|
if (sentInitRef.current && appName && currentAppName !== appName) {
|
|
243
233
|
setCurrentAppName(appName);
|
|
@@ -256,8 +246,7 @@ function ChatbotFrame({
|
|
|
256
246
|
ref: setIframeEl,
|
|
257
247
|
src: buildIframeUrl({
|
|
258
248
|
baseUrl,
|
|
259
|
-
|
|
260
|
-
initialChatId
|
|
249
|
+
initialConfig
|
|
261
250
|
}),
|
|
262
251
|
className,
|
|
263
252
|
allow: "clipboard-write",
|
|
@@ -270,12 +259,11 @@ function ChatbotFrame({
|
|
|
270
259
|
}
|
|
271
260
|
function buildIframeUrl({
|
|
272
261
|
baseUrl,
|
|
273
|
-
|
|
274
|
-
initialChatId
|
|
262
|
+
initialConfig
|
|
275
263
|
}) {
|
|
276
|
-
const url = new URL(`/embed
|
|
277
|
-
if (
|
|
278
|
-
url.searchParams.set("
|
|
264
|
+
const url = new URL(`/embed`, baseUrl);
|
|
265
|
+
if (initialConfig) {
|
|
266
|
+
url.searchParams.set("initialConfig", JSON.stringify(initialConfig));
|
|
279
267
|
}
|
|
280
268
|
return url.toString();
|
|
281
269
|
}
|
package/package.json
CHANGED
|
@@ -4,12 +4,12 @@ import { useChatbot } from "./provider/chatbot-provider";
|
|
|
4
4
|
import type { MCP } from "./provider/use-chatbot-frame-handler";
|
|
5
5
|
|
|
6
6
|
export type ChatbotFrameProps = {
|
|
7
|
-
/** 管理画面上のエージェントID */
|
|
8
|
-
agentId: string;
|
|
9
7
|
/** 初期化時のチャットID */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
initialConfig?: {
|
|
9
|
+
agentId?: string;
|
|
10
|
+
chatId?: string;
|
|
11
|
+
model?: string;
|
|
12
|
+
};
|
|
13
13
|
/** アプリ名のメタデータ */
|
|
14
14
|
appName?: string;
|
|
15
15
|
/** セッションを取得するための関数 */
|
|
@@ -34,10 +34,8 @@ export type ChatbotFrameProps = {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export function ChatbotFrame({
|
|
37
|
-
agentId,
|
|
38
37
|
appName,
|
|
39
|
-
|
|
40
|
-
mcps,
|
|
38
|
+
initialConfig,
|
|
41
39
|
getSession,
|
|
42
40
|
enabled = true,
|
|
43
41
|
url,
|
|
@@ -63,28 +61,14 @@ export function ChatbotFrame({
|
|
|
63
61
|
React.useEffect(() => {
|
|
64
62
|
if (shouldInit && !sentInitRef.current) {
|
|
65
63
|
init({
|
|
66
|
-
mcps,
|
|
67
64
|
appName,
|
|
68
65
|
sessionToken,
|
|
69
66
|
});
|
|
70
67
|
sentInitRef.current = true;
|
|
71
|
-
setCurrentMcps(mcps);
|
|
72
68
|
setCurrentAppName(appName);
|
|
73
69
|
setCurrentSessionToken(sessionToken);
|
|
74
70
|
}
|
|
75
|
-
}, [enabled, init,
|
|
76
|
-
|
|
77
|
-
// mcpsの更新の仕組み
|
|
78
|
-
React.useEffect(() => {
|
|
79
|
-
if (
|
|
80
|
-
sentInitRef.current &&
|
|
81
|
-
mcps &&
|
|
82
|
-
JSON.stringify(currentMcps) !== JSON.stringify(mcps)
|
|
83
|
-
) {
|
|
84
|
-
setMcps(mcps);
|
|
85
|
-
setCurrentMcps(mcps);
|
|
86
|
-
}
|
|
87
|
-
}, [mcps]);
|
|
71
|
+
}, [enabled, init, appName, isReady, sessionToken]);
|
|
88
72
|
|
|
89
73
|
// appNameの更新の仕組み
|
|
90
74
|
React.useEffect(() => {
|
|
@@ -111,8 +95,7 @@ export function ChatbotFrame({
|
|
|
111
95
|
ref={setIframeEl}
|
|
112
96
|
src={buildIframeUrl({
|
|
113
97
|
baseUrl,
|
|
114
|
-
|
|
115
|
-
initialChatId,
|
|
98
|
+
initialConfig,
|
|
116
99
|
})}
|
|
117
100
|
className={className}
|
|
118
101
|
allow="clipboard-write"
|
|
@@ -126,17 +109,19 @@ export function ChatbotFrame({
|
|
|
126
109
|
|
|
127
110
|
function buildIframeUrl({
|
|
128
111
|
baseUrl,
|
|
129
|
-
|
|
130
|
-
initialChatId,
|
|
112
|
+
initialConfig,
|
|
131
113
|
}: {
|
|
132
114
|
baseUrl: string;
|
|
133
|
-
|
|
134
|
-
|
|
115
|
+
initialConfig?: {
|
|
116
|
+
agentId?: string;
|
|
117
|
+
chatId?: string;
|
|
118
|
+
model?: string;
|
|
119
|
+
};
|
|
135
120
|
}) {
|
|
136
|
-
const url = new URL(`/embed
|
|
121
|
+
const url = new URL(`/embed`, baseUrl);
|
|
137
122
|
|
|
138
|
-
if (
|
|
139
|
-
url.searchParams.set("
|
|
123
|
+
if (initialConfig) {
|
|
124
|
+
url.searchParams.set("initialConfig", JSON.stringify(initialConfig));
|
|
140
125
|
}
|
|
141
126
|
|
|
142
127
|
return url.toString();
|