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