@kuntur/a2a-carbon-chat-adapter 0.1.3 → 0.1.5
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/index.cjs +69 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +69 -48
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +9 -0
- package/package.json +1 -1
- package/dist/server.d.cts +0 -40
- package/dist/server.d.ts +0 -40
package/dist/index.cjs
CHANGED
|
@@ -1890,39 +1890,10 @@ function A2AChat({
|
|
|
1890
1890
|
setCurrentFormRequest(null);
|
|
1891
1891
|
setPendingTaskId(null);
|
|
1892
1892
|
}, []);
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
hasContentMaxWidth: true
|
|
1898
|
-
},
|
|
1899
|
-
header: {
|
|
1900
|
-
title: agent?.name ?? "AI Assistant",
|
|
1901
|
-
icons: {
|
|
1902
|
-
agent: agent?.iconUrl ?? "/bot.svg"
|
|
1903
|
-
}
|
|
1904
|
-
},
|
|
1905
|
-
input: {
|
|
1906
|
-
placeholder: "Type a message..."
|
|
1907
|
-
},
|
|
1908
|
-
messaging: {
|
|
1909
|
-
customSendMessage: async (request, options, instance) => {
|
|
1910
|
-
instanceRef.current = instance;
|
|
1911
|
-
const text = request?.input?.text;
|
|
1912
|
-
if (text) {
|
|
1913
|
-
await handleSendMessage(text);
|
|
1914
|
-
}
|
|
1915
|
-
},
|
|
1916
|
-
skipWelcome: true
|
|
1917
|
-
},
|
|
1918
|
-
userDefinedResponses: {
|
|
1919
|
-
text_with_citations: renderCustomResponse,
|
|
1920
|
-
sources_list: renderCustomResponse,
|
|
1921
|
-
error: renderCustomResponse
|
|
1922
|
-
}
|
|
1923
|
-
}),
|
|
1924
|
-
[agent, layout, handleSendMessage, renderCustomResponse]
|
|
1925
|
-
);
|
|
1893
|
+
const handleAfterRender = react.useCallback((instance) => {
|
|
1894
|
+
instanceRef.current = instance;
|
|
1895
|
+
console.log("[A2AChat] Chat instance ready");
|
|
1896
|
+
}, []);
|
|
1926
1897
|
if (!agent) {
|
|
1927
1898
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `a2a-chat a2a-chat--error ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No agent configured. Provide `agent`, `agentId`, or `agentUrl` prop." }) });
|
|
1928
1899
|
}
|
|
@@ -1940,25 +1911,75 @@ function A2AChat({
|
|
|
1940
1911
|
) });
|
|
1941
1912
|
if (layout === "float" && ChatContainer) {
|
|
1942
1913
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `a2a-chat a2a-chat--float ${className}`, children: [
|
|
1943
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1915
|
+
ChatContainer,
|
|
1916
|
+
{
|
|
1917
|
+
...{
|
|
1918
|
+
debug: false,
|
|
1919
|
+
aiEnabled: true,
|
|
1920
|
+
injectCarbonTheme: "white"
|
|
1921
|
+
},
|
|
1922
|
+
header: {
|
|
1923
|
+
title: agent?.name ?? "AI Assistant"
|
|
1924
|
+
},
|
|
1925
|
+
launcher: {
|
|
1926
|
+
isOn: true
|
|
1927
|
+
},
|
|
1928
|
+
onAfterRender: handleAfterRender,
|
|
1929
|
+
renderUserDefinedResponse: renderCustomResponse,
|
|
1930
|
+
messaging: {
|
|
1931
|
+
skipWelcome: true,
|
|
1932
|
+
customSendMessage: async (request, _options, _instance) => {
|
|
1933
|
+
const text = request?.input?.text;
|
|
1934
|
+
if (text) {
|
|
1935
|
+
await handleSendMessage(text);
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
),
|
|
1944
1941
|
formOverlay
|
|
1945
1942
|
] });
|
|
1946
1943
|
}
|
|
1947
1944
|
if (ChatCustomElement) {
|
|
1948
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1945
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `a2a-chat a2a-chat--${layout} ${className}`, children: [
|
|
1946
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1947
|
+
ChatCustomElement,
|
|
1948
|
+
{
|
|
1949
|
+
...{
|
|
1950
|
+
className: "a2a-chat__element",
|
|
1951
|
+
debug: false,
|
|
1952
|
+
aiEnabled: true,
|
|
1953
|
+
openChatByDefault: true,
|
|
1954
|
+
injectCarbonTheme: "white"
|
|
1955
|
+
},
|
|
1956
|
+
header: {
|
|
1957
|
+
title: agent?.name ?? "AI Assistant",
|
|
1958
|
+
showMinimize: layout !== "fullscreen"
|
|
1959
|
+
},
|
|
1960
|
+
launcher: {
|
|
1961
|
+
isOn: layout === "float"
|
|
1962
|
+
},
|
|
1963
|
+
layout: {
|
|
1964
|
+
showFrame: layout === "float",
|
|
1965
|
+
showCloseAndRestartButton: layout !== "fullscreen"
|
|
1966
|
+
},
|
|
1967
|
+
onAfterRender: handleAfterRender,
|
|
1968
|
+
renderUserDefinedResponse: renderCustomResponse,
|
|
1969
|
+
messaging: {
|
|
1970
|
+
skipWelcome: true,
|
|
1971
|
+
messageLoadingIndicatorTimeoutSecs: 0,
|
|
1972
|
+
customSendMessage: async (request, _options, _instance) => {
|
|
1973
|
+
const text = request?.input?.text;
|
|
1974
|
+
if (text) {
|
|
1975
|
+
await handleSendMessage(text);
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
),
|
|
1981
|
+
formOverlay
|
|
1982
|
+
] });
|
|
1962
1983
|
}
|
|
1963
1984
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `a2a-chat a2a-chat--loading ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "a2a-chat__spinner" }) });
|
|
1964
1985
|
}
|