@kuntur/a2a-carbon-chat-adapter 0.1.3 → 0.1.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.
package/dist/index.cjs CHANGED
@@ -1890,39 +1890,10 @@ function A2AChat({
1890
1890
  setCurrentFormRequest(null);
1891
1891
  setPendingTaskId(null);
1892
1892
  }, []);
1893
- const chatConfig = react.useMemo(
1894
- () => ({
1895
- layout: {
1896
- showCloseAndRestartButton: layout !== "fullscreen",
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,7 +1911,32 @@ 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(ChatContainer, { config: chatConfig }),
1914
+ /* @__PURE__ */ jsxRuntime.jsx(
1915
+ ChatContainer,
1916
+ {
1917
+ ...{
1918
+ debug: false,
1919
+ aiEnabled: true
1920
+ },
1921
+ header: {
1922
+ title: agent?.name ?? "AI Assistant"
1923
+ },
1924
+ launcher: {
1925
+ isOn: true
1926
+ },
1927
+ onAfterRender: handleAfterRender,
1928
+ renderUserDefinedResponse: renderCustomResponse,
1929
+ messaging: {
1930
+ skipWelcome: true,
1931
+ customSendMessage: async (request, _options, _instance) => {
1932
+ const text = request?.input?.text;
1933
+ if (text) {
1934
+ await handleSendMessage(text);
1935
+ }
1936
+ }
1937
+ }
1938
+ }
1939
+ ),
1944
1940
  formOverlay
1945
1941
  ] });
1946
1942
  }
@@ -1954,7 +1950,40 @@ function A2AChat({
1954
1950
  width: layout === "sidebar" ? "400px" : void 0
1955
1951
  },
1956
1952
  children: [
1957
- /* @__PURE__ */ jsxRuntime.jsx(ChatCustomElement, { config: chatConfig }),
1953
+ /* @__PURE__ */ jsxRuntime.jsx(
1954
+ ChatCustomElement,
1955
+ {
1956
+ ...{
1957
+ className: "a2a-chat__element",
1958
+ debug: false,
1959
+ aiEnabled: true,
1960
+ openChatByDefault: true
1961
+ },
1962
+ header: {
1963
+ title: agent?.name ?? "AI Assistant",
1964
+ showMinimize: layout !== "fullscreen"
1965
+ },
1966
+ launcher: {
1967
+ isOn: layout === "float"
1968
+ },
1969
+ layout: {
1970
+ showFrame: layout === "float",
1971
+ showCloseAndRestartButton: layout !== "fullscreen"
1972
+ },
1973
+ onAfterRender: handleAfterRender,
1974
+ renderUserDefinedResponse: renderCustomResponse,
1975
+ messaging: {
1976
+ skipWelcome: true,
1977
+ messageLoadingIndicatorTimeoutSecs: 0,
1978
+ customSendMessage: async (request, _options, _instance) => {
1979
+ const text = request?.input?.text;
1980
+ if (text) {
1981
+ await handleSendMessage(text);
1982
+ }
1983
+ }
1984
+ }
1985
+ }
1986
+ ),
1958
1987
  formOverlay
1959
1988
  ]
1960
1989
  }