@botonic/react 0.45.0 → 0.46.0-alpha.0

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.
Files changed (75) hide show
  1. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.d.ts +4 -0
  2. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.js +49 -0
  3. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -0
  4. package/lib/cjs/components/system-debug-trace/events/ai-agent/executed-tools.d.ts +7 -0
  5. package/lib/cjs/components/system-debug-trace/events/ai-agent/executed-tools.js +21 -0
  6. package/lib/cjs/components/system-debug-trace/events/ai-agent/executed-tools.js.map +1 -0
  7. package/lib/cjs/components/system-debug-trace/events/ai-agent/index.d.ts +2 -0
  8. package/lib/cjs/components/system-debug-trace/events/ai-agent/index.js +6 -0
  9. package/lib/cjs/components/system-debug-trace/events/ai-agent/index.js.map +1 -0
  10. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.d.ts +9 -0
  11. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.js +28 -0
  12. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.js.map +1 -0
  13. package/lib/cjs/components/system-debug-trace/events/{ai-agent.d.ts → ai-agent/types.d.ts} +4 -7
  14. package/lib/cjs/components/system-debug-trace/events/ai-agent/types.js +3 -0
  15. package/lib/cjs/components/system-debug-trace/events/ai-agent/types.js.map +1 -0
  16. package/lib/cjs/components/system-debug-trace/events/components/sources-section.js +7 -1
  17. package/lib/cjs/components/system-debug-trace/events/components/sources-section.js.map +1 -1
  18. package/lib/cjs/components/system-debug-trace/events/constants.d.ts +4 -1
  19. package/lib/cjs/components/system-debug-trace/events/constants.js +4 -1
  20. package/lib/cjs/components/system-debug-trace/events/constants.js.map +1 -1
  21. package/lib/cjs/components/system-debug-trace/styles.d.ts +1 -1
  22. package/lib/cjs/components/system-debug-trace/styles.js +3 -5
  23. package/lib/cjs/components/system-debug-trace/styles.js.map +1 -1
  24. package/lib/cjs/index-types.d.ts +2 -1
  25. package/lib/cjs/index-types.js.map +1 -1
  26. package/lib/cjs/webchat/context/index.js +3 -0
  27. package/lib/cjs/webchat/context/index.js.map +1 -1
  28. package/lib/cjs/webchat/custom-messages/rating/index.js +12 -0
  29. package/lib/cjs/webchat/custom-messages/rating/index.js.map +1 -1
  30. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.d.ts +4 -0
  31. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js +49 -0
  32. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -0
  33. package/lib/esm/components/system-debug-trace/events/ai-agent/executed-tools.d.ts +7 -0
  34. package/lib/esm/components/system-debug-trace/events/ai-agent/executed-tools.js +21 -0
  35. package/lib/esm/components/system-debug-trace/events/ai-agent/executed-tools.js.map +1 -0
  36. package/lib/esm/components/system-debug-trace/events/ai-agent/index.d.ts +2 -0
  37. package/lib/esm/components/system-debug-trace/events/ai-agent/index.js +6 -0
  38. package/lib/esm/components/system-debug-trace/events/ai-agent/index.js.map +1 -0
  39. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.d.ts +9 -0
  40. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.js +28 -0
  41. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.js.map +1 -0
  42. package/lib/esm/components/system-debug-trace/events/{ai-agent.d.ts → ai-agent/types.d.ts} +4 -7
  43. package/lib/esm/components/system-debug-trace/events/ai-agent/types.js +3 -0
  44. package/lib/esm/components/system-debug-trace/events/ai-agent/types.js.map +1 -0
  45. package/lib/esm/components/system-debug-trace/events/components/sources-section.js +7 -1
  46. package/lib/esm/components/system-debug-trace/events/components/sources-section.js.map +1 -1
  47. package/lib/esm/components/system-debug-trace/events/constants.d.ts +4 -1
  48. package/lib/esm/components/system-debug-trace/events/constants.js +4 -1
  49. package/lib/esm/components/system-debug-trace/events/constants.js.map +1 -1
  50. package/lib/esm/components/system-debug-trace/styles.d.ts +1 -1
  51. package/lib/esm/components/system-debug-trace/styles.js +3 -5
  52. package/lib/esm/components/system-debug-trace/styles.js.map +1 -1
  53. package/lib/esm/index-types.d.ts +2 -1
  54. package/lib/esm/index-types.js.map +1 -1
  55. package/lib/esm/webchat/context/index.js +3 -0
  56. package/lib/esm/webchat/context/index.js.map +1 -1
  57. package/lib/esm/webchat/custom-messages/rating/index.js +12 -0
  58. package/lib/esm/webchat/custom-messages/rating/index.js.map +1 -1
  59. package/package.json +2 -2
  60. package/src/components/system-debug-trace/events/ai-agent/ai-agent.tsx +130 -0
  61. package/src/components/system-debug-trace/events/ai-agent/executed-tools.tsx +43 -0
  62. package/src/components/system-debug-trace/events/ai-agent/index.ts +2 -0
  63. package/src/components/system-debug-trace/events/ai-agent/parse-tools.ts +31 -0
  64. package/src/components/system-debug-trace/events/ai-agent/types.ts +23 -0
  65. package/src/components/system-debug-trace/events/components/sources-section.tsx +7 -2
  66. package/src/components/system-debug-trace/events/constants.ts +4 -1
  67. package/src/components/system-debug-trace/styles.ts +3 -4
  68. package/src/index-types.ts +2 -0
  69. package/src/webchat/context/index.tsx +3 -0
  70. package/src/webchat/custom-messages/rating/index.tsx +13 -1
  71. package/lib/cjs/components/system-debug-trace/events/ai-agent.js +0 -59
  72. package/lib/cjs/components/system-debug-trace/events/ai-agent.js.map +0 -1
  73. package/lib/esm/components/system-debug-trace/events/ai-agent.js +0 -59
  74. package/lib/esm/components/system-debug-trace/events/ai-agent.js.map +0 -1
  75. package/src/components/system-debug-trace/events/ai-agent.tsx +0 -158
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/types.ts"],"names":[],"mappings":""}
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SourcesSection = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
5
7
  const styles_1 = require("../../styles");
6
8
  const constants_1 = require("../constants");
9
+ const StyledSeeChunksButton = (0, styled_components_1.default)(styles_1.StyledSeeInfo) `
10
+ margin-left: 0;
11
+ margin-top: 4px;
12
+ `;
7
13
  const SourcesSection = ({ sources, chunks, getIconForSourceType, onSeeChunks, label = constants_1.LABELS.SOURCES, }) => {
8
14
  if (sources.length === 0) {
9
15
  return null;
@@ -15,7 +21,7 @@ const SourcesSection = ({ sources, chunks, getIconForSourceType, onSeeChunks, la
15
21
  ? source.activeExtractionJob?.url
16
22
  : source.activeExtractionJob?.fileName;
17
23
  return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugItemWithIcon, { children: [icon, isUrl ? ((0, jsx_runtime_1.jsx)(styles_1.StyledUrlSourceValue, { href: value ?? '', target: '_blank', rel: 'noopener noreferrer', title: value ?? 'Not detected', children: value })) : ((0, jsx_runtime_1.jsx)(styles_1.StyledFileSourceValue, { children: value }))] }, source.id));
18
- }), chunks.length > 0 && ((0, jsx_runtime_1.jsx)(styles_1.StyledSeeChunksButton, { onClick: onSeeChunks, children: constants_1.LABELS.SEE_CHUNKS_BUTTON }))] }));
24
+ }), chunks.length > 0 && ((0, jsx_runtime_1.jsx)(StyledSeeChunksButton, { onClick: onSeeChunks, children: constants_1.LABELS.SEE_CHUNKS_BUTTON }))] }));
19
25
  };
20
26
  exports.SourcesSection = SourcesSection;
21
27
  //# sourceMappingURL=sources-section.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sources-section.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/components/sources-section.tsx"],"names":[],"mappings":";;;;AAEA,yCAOqB;AACrB,4CAAqC;AAW9B,MAAM,cAAc,GAAG,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,KAAK,GAAG,kBAAM,CAAC,OAAO,GACF,EAAE,EAAE;IACxB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,KAAK,GAAoB,EAC3C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBACpB,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;gBACzC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,KAAK,KAAK,CAAA;gBACnC,MAAM,KAAK,GAAG,KAAK;oBACjB,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,GAAG;oBACjC,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAA;gBAExC,OAAO,CACL,wBAAC,gCAAuB,eACrB,IAAI,EACJ,KAAK,CAAC,CAAC,CAAC,CACP,uBAAC,6BAAoB,IACnB,IAAI,EAAE,KAAK,IAAI,EAAE,EACjB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,KAAK,EAAE,KAAK,IAAI,cAAc,YAE7B,KAAK,GACe,CACxB,CAAC,CAAC,CAAC,CACF,uBAAC,8BAAqB,cAAE,KAAK,GAAyB,CACvD,KAb2B,MAAM,CAAC,EAAE,CAcb,CAC3B,CAAA;YACH,CAAC,CAAC,EACD,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACpB,uBAAC,8BAAqB,IAAC,OAAO,EAAE,WAAW,YACxC,kBAAM,CAAC,iBAAiB,GACH,CACzB,IACiB,CACrB,CAAA;AACH,CAAC,CAAA;AA9CY,QAAA,cAAc,kBA8C1B"}
1
+ {"version":3,"file":"sources-section.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/components/sources-section.tsx"],"names":[],"mappings":";;;;;AACA,kFAAsC;AACtC,yCAOqB;AACrB,4CAAqC;AAGrC,MAAM,qBAAqB,GAAG,IAAA,2BAAM,EAAC,sBAAa,CAAC,C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UL_ANSWER: "Faithful answer";
5
5
  readonly QUERY: "Query";
6
6
  readonly SOURCES: "Sources";
7
- readonly KNOWLEDGE_GATHERED: "Knowledge gathered";
7
+ readonly KNOWLEDGE_SOURCES: "Knowledge sources";
8
8
  readonly EXECUTED_TOOLS: "Executed tools";
9
+ readonly TOOL_ARGUMENTS: "Tool arguments";
10
+ readonly TOOL_RESULTS: "Tool results";
9
11
  readonly NO_TOOLS_EXECUTED: "No tools executed";
10
12
  readonly AUTO_ASSIGN_ON: "ON";
11
13
  readonly AUTO_ASSIGN_OFF: "OFF";
@@ -16,6 +18,7 @@ export declare const LABELS: {
16
18
  readonly NOTE: "Note";
17
19
  readonly KNOWLEDGE_BASE_FAIL_REASON: "Knowledge Base Fail Reason";
18
20
  readonly SEE_CHUNKS_BUTTON: "See chunks";
21
+ readonly SEE_TOOL_DETAILS: "Details";
19
22
  readonly STATUS: "Status";
20
23
  readonly YES: "Yes";
21
24
  readonly NO: "No";
@@ -7,8 +7,10 @@ exports.LABELS = {
7
7
  FAITHFUL_ANSWER: 'Faithful answer',
8
8
  QUERY: 'Query',
9
9
  SOURCES: 'Sources',
10
- KNOWLEDGE_GATHERED: 'Knowledge gathered',
10
+ KNOWLEDGE_SOURCES: 'Knowledge sources',
11
11
  EXECUTED_TOOLS: 'Executed tools',
12
+ TOOL_ARGUMENTS: 'Tool arguments',
13
+ TOOL_RESULTS: 'Tool results',
12
14
  NO_TOOLS_EXECUTED: 'No tools executed',
13
15
  AUTO_ASSIGN_ON: 'ON',
14
16
  AUTO_ASSIGN_OFF: 'OFF',
@@ -19,6 +21,7 @@ exports.LABELS = {
19
21
  NOTE: 'Note',
20
22
  KNOWLEDGE_BASE_FAIL_REASON: 'Knowledge Base Fail Reason',
21
23
  SEE_CHUNKS_BUTTON: 'See chunks',
24
+ SEE_TOOL_DETAILS: 'Details',
22
25
  STATUS: 'Status',
23
26
  YES: 'Yes',
24
27
  NO: 'No',
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;IAC/B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;IAC/B,gBAAgB,EAAE,SAAS;IAC3B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAA"}
@@ -9,7 +9,7 @@ export declare const StyledDebugLabel: import("styled-components").StyledCompone
9
9
  export declare const StyledDebugValue: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
10
  export declare const StyledDebugItemWithIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
11
11
  export declare const StyledDebugMetadata: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
- export declare const StyledSeeChunksButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
12
+ export declare const StyledSeeInfo: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
13
13
  interface StyledGuardrailItemProps {
14
14
  $isLastItem?: boolean;
15
15
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StyledUrlSourceValue = exports.StyledFileSourceValue = exports.StyledSourceValue = exports.StyledGuardrailValue = exports.StyledGuardrailLabel = exports.StyledDebugContentWrapper = exports.StyledGuardrailItem = exports.StyledSeeChunksButton = exports.StyledDebugMetadata = exports.StyledDebugItemWithIcon = exports.StyledDebugValue = exports.StyledDebugLabel = exports.StyledDebugDetail = exports.StyledDebugContent = exports.StyledDebugTitle = exports.StyledDebugIcon = exports.StyledDebugArrow = exports.StyledDebugHeader = exports.StyledDebugContainer = void 0;
3
+ exports.StyledUrlSourceValue = exports.StyledFileSourceValue = exports.StyledSourceValue = exports.StyledGuardrailValue = exports.StyledGuardrailLabel = exports.StyledDebugContentWrapper = exports.StyledGuardrailItem = exports.StyledSeeInfo = exports.StyledDebugMetadata = exports.StyledDebugItemWithIcon = exports.StyledDebugValue = exports.StyledDebugLabel = exports.StyledDebugDetail = exports.StyledDebugContent = exports.StyledDebugTitle = exports.StyledDebugIcon = exports.StyledDebugArrow = exports.StyledDebugHeader = exports.StyledDebugContainer = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
6
6
  const constants_1 = require("../../constants");
@@ -169,7 +169,7 @@ exports.StyledDebugMetadata = styled_components_1.default.div `
169
169
  font-weight: 400;
170
170
  }
171
171
  `;
172
- exports.StyledSeeChunksButton = styled_components_1.default.button `
172
+ exports.StyledSeeInfo = styled_components_1.default.button `
173
173
  border: 1px solid #c4c6d0;
174
174
  border-radius: 6px;
175
175
  padding: 8px;
@@ -181,8 +181,6 @@ exports.StyledSeeChunksButton = styled_components_1.default.button `
181
181
  font-weight: 500;
182
182
  line-height: 1.5;
183
183
  cursor: pointer;
184
- margin-left: 0;
185
- margin-top: 4px;
186
184
  display: flex;
187
185
  align-items: center;
188
186
  justify-content: center;
@@ -211,7 +209,7 @@ exports.StyledGuardrailItem = styled_components_1.default.div `
211
209
  exports.StyledDebugContentWrapper = styled_components_1.default.div `
212
210
  display: flex;
213
211
  flex-direction: column;
214
- gap: 8px;
212
+ gap: 16px;
215
213
  position: relative;
216
214
  width: 100%;
217
215
  min-width: 0;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/system-debug-trace/styles.ts"],"names":[],"mappings":";;;;AAAA,kFAAsC;AAEtC,+CAAwC;AAE3B,QAAA,oBAAoB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;sBAOxB,kBAAM,CAAC,WAAW;;;;;;;;;;;;;0BAad,kBAAM,CAAC,GAAG;;;CAGnC,CAAA;AAEY,QAAA,iBAAiB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;CAS1C,CAAA;AAEY,QAAA,gBAAgB,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CAAA;AAEY,QAAA,oBAAoB,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;WAIpC,kBAAM,CAAC,IAAI;CACrB,CAAA;AAEY,QAAA,iBAAiB,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;WAIjC,kBAAM,CAAC,IAAI;CACrB,CAAA;AAEY,QAAA,qBAAqB,GAAG,IAAA,2BAAM,EAAC,yBAAiB,CAAC,CAAA;;;;;;;CAO7D,CAAA;AAEY,QAAA,oBAAoB,GAAG,2BAAM,CAAC,CAAC,CAAA;;;;WAIjC,kBAAM,CAAC,IAAI;;;;;;;;;;;aAWT,kBAAM,CAAC,YAAY;;;;aAInB,kBAAM,CAAC,IAAI;;CAEvB,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { BotContext, BotRequest as CoreBotRequest, Input as CoreInput, InputType as CoreInputType, Route as CoreRoute, Routes as CoreRoutes, Session as CoreSession, SessionUser as CoreSessionUser, ServerConfig } from '@botonic/core';
1
+ import type { BotContext, BotRequest as CoreBotRequest, Input as CoreInput, InputType as CoreInputType, Route as CoreRoute, Routes as CoreRoutes, Session as CoreSession, SessionUser as CoreSessionUser, ServerConfig, ToolExecution } from '@botonic/core';
2
2
  import type React from 'react';
3
3
  import type { BlockInputOption, ButtonProps, ReplyProps, WebchatSettingsProps } from './components';
4
4
  import { ChunkIdsGroupedBySourceData } from './components/system-debug-trace/events/knowledge-bases-types';
@@ -61,6 +61,7 @@ export interface MinimalHubtypeMessage {
61
61
  export interface PreviewUtils {
62
62
  getChunkIdsGroupedBySource: (chunkIds: string[]) => Promise<ChunkIdsGroupedBySourceData[]>;
63
63
  onClickOpenChunks: (chunkIdsGroupedBySource: ChunkIdsGroupedBySourceData[]) => void;
64
+ onClickOpenToolResults: (toolExecution: ToolExecution) => void;
64
65
  getMessageById: (messageId: string) => Promise<MinimalHubtypeMessage>;
65
66
  trackPreviewEventOpened: (eventProperties: Record<string, unknown>) => void;
66
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":";;;AA8JA,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,4BAAiB,CAAA;AACnB,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AAED,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB"}
1
+ {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":";;;AAgKA,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,4BAAiB,CAAA;AACnB,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AAED,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB"}
@@ -73,6 +73,9 @@ exports.WebchatContext = (0, react_1.createContext)({
73
73
  },
74
74
  webchatState: {},
75
75
  previewUtils: {
76
+ onClickOpenToolResults: () => {
77
+ return;
78
+ },
76
79
  trackPreviewEventOpened: () => {
77
80
  return;
78
81
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/context/index.tsx"],"names":[],"mappings":";;;AAAA,iCAAqC;AAOrC,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AAEN,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAsB;IAC/D,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,gBAAgB,EAAE,GAAG,EAAE;QACrB,OAAM;IACR,CAAC,EAAE,uGAAuG;IAC1G,YAAY,EAAE,KAAK,IAAI,EAAE;QACvB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,G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QACR,CAAC;QACD,cAAc,EAAE,KAAK,IAAI,EAAE;YACzB,OAAO,EAA2B,CAAA;QACpC,CAAC;KACF;IAED,UAAU,EAAE,KAAK,IAAI,EAAE;QACrB,OAAM;IACR,CAAC;IACD,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9B,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAChC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5C,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/context/index.tsx"],"names":[],"mappings":";;;AAAA,iCAAqC;AAOrC,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AAEN,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAsB;IAC/D,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,gBAAgB,EAAE,GAAG,EAAE;QACrB,OAAM;IACR,CAAC,EAAE,uGAAuG;IAC1G,YAAY,EAAE,KAAK,IAAI,EAAE;QACvB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,mBAAmB,EAAE,GAAG,EAAE;QACxB,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,qBAAqB,EAAE,GAAG,EAAE;QAC1B,OAAM;IACR,CAAC;IACD,cAAc,EAAE,KAAK,IAAI,EAAE;QACzB,OAAM;IACR,CAAC;IACD,SAAS,EAAE,KAAK,IAAI,EAAE;QACpB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,KAAK,IAAI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AE;IAC5B,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5C,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA"}
@@ -8,6 +8,17 @@ const components_1 = require("../../../components");
8
8
  const context_1 = require("../../context");
9
9
  const rating_selector_1 = require("./rating-selector");
10
10
  const styles_1 = require("./styles");
11
+ const types_1 = require("./types");
12
+ const ratingValues = {
13
+ [types_1.RatingType.Stars]: [
14
+ '⭐'.repeat(1),
15
+ '⭐'.repeat(2),
16
+ '⭐'.repeat(3),
17
+ '⭐'.repeat(4),
18
+ '⭐'.repeat(5),
19
+ ],
20
+ [types_1.RatingType.Smileys]: ['😠', '🙁', '😐', '🙂', '😄'],
21
+ };
11
22
  const CustomRatingMessage = props => {
12
23
  const { payloads, messageText, buttonText, ratingType, id, valueSent } = props;
13
24
  const { updateCustomMessageProps, sendInput } = (0, react_1.useContext)(context_1.WebchatContext);
@@ -31,6 +42,7 @@ const CustomRatingMessage = props => {
31
42
  const input = {
32
43
  type: core_1.INPUT.POSTBACK,
33
44
  payload,
45
+ referral: ratingValues[ratingType][ratingValue - 1],
34
46
  };
35
47
  void sendInput(input);
36
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/webchat/custom-messages/rating/index.tsx"],"names":[],"mappings":";;;AAAA,wCAAqD;AAErD,iCAA4C;AAC5C,yDAAgD;AAEhD,oDAA2D;AAC3D,2CAA8C;AAC9C,uDAAkD;AAClD,qCAAwC;AAYxC,MAAM,mBAAmB,GAAuC,KAAK,CAAC,EAAE;IACtE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IAC9E,MAAM,EAAE,wBAAwB,EAAE,SAAS,EAAE,GAAG,IAAA,kBAAU,EAAC,wBAAc,CAAC,CAAA;IAE1E,MAAM,KAAK,GAAG,IAAA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f,CAAC,KAAK,EAAE,SAAS,IAAI,UAAU,IAAI,CAClC,uBAAC,mBAAM,IACL,WAAW,EAAE,IAAI,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,gBAAgB,YAExB,UAAU,GACJ,CACV,IACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,IAAA,0BAAa,EAAC;IAC3B,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,mBAAmB;CAC/B,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botonic/react",
3
- "version": "0.45.0",
3
+ "version": "0.46.0-alpha.0",
4
4
  "license": "MIT",
5
5
  "description": "Build Chatbots using React",
6
6
  "main": "./lib/cjs",
@@ -20,7 +20,7 @@
20
20
  "format": "biome format --write src/ tests/"
21
21
  },
22
22
  "dependencies": {
23
- "@botonic/core": "^0.45.0",
23
+ "@botonic/core": "^0.46.0-alpha.0",
24
24
  "axios": "^1.13.6",
25
25
  "emoji-picker-react": "^4.12.0",
26
26
  "lodash.merge": "^4.6.2",
@@ -0,0 +1,130 @@
1
+ import { EventAction, type ToolExecution } from '@botonic/core'
2
+ import { useContext, useMemo } from 'react'
3
+ import { WebchatContext } from '../../../../webchat/context'
4
+ import { useKnowledgeBaseInfo } from '../../hooks/use-knowledge-base-info'
5
+ import { WandSvg } from '../../icons'
6
+ import {
7
+ StyledDebugDetail,
8
+ StyledDebugLabel,
9
+ StyledDebugValue,
10
+ } from '../../styles'
11
+ import type { DebugEventConfig } from '../../types'
12
+ import { GuardrailList, SourcesSection } from '../components'
13
+ import { LABELS } from '../constants'
14
+ import { ExecutedTools } from './executed-tools'
15
+ import { parseTools } from './parse-tools'
16
+ import type { AiAgentDebugEvent, ToolExecuted } from './types'
17
+
18
+ export const AiAgent = ({
19
+ tools_executed,
20
+ input_guardrails_triggered,
21
+ output_guardrails_triggered,
22
+ exit,
23
+ error,
24
+ messageId,
25
+ knowledge_base_chunks_with_sources,
26
+ }: AiAgentDebugEvent) => {
27
+ const { previewUtils } = useContext(WebchatContext)
28
+
29
+ const { otherTools, allSourcesIds, allChunksIds, query } = useMemo(
30
+ () => parseTools(tools_executed),
31
+ [tools_executed]
32
+ )
33
+
34
+ const {
35
+ sources: allSources,
36
+ chunks: allChunks,
37
+ chunksWithSources,
38
+ getIconForSourceType,
39
+ } = useKnowledgeBaseInfo({
40
+ sourceIds: allSourcesIds,
41
+ chunkIds: allChunksIds,
42
+ messageId,
43
+ existingChunksWithSources: knowledge_base_chunks_with_sources,
44
+ })
45
+
46
+ const handleSeeChunks = () => {
47
+ previewUtils?.onClickOpenChunks?.(chunksWithSources)
48
+ }
49
+
50
+ const handleSeeToolDetails = (tool: ToolExecuted) => {
51
+ const toolExecution: ToolExecution = {
52
+ toolName: tool.tool_name,
53
+ toolArguments: tool.tool_arguments ?? {},
54
+ toolResults: tool.tool_results ?? '',
55
+ }
56
+
57
+ previewUtils?.onClickOpenToolResults?.(toolExecution)
58
+ }
59
+
60
+ return (
61
+ <>
62
+ {query && (
63
+ <StyledDebugDetail>
64
+ <StyledDebugLabel>{LABELS.QUERY}</StyledDebugLabel>
65
+ <StyledDebugValue>&quot;{query}&quot;</StyledDebugValue>
66
+ </StyledDebugDetail>
67
+ )}
68
+
69
+ <SourcesSection
70
+ sources={allSources}
71
+ chunks={allChunks}
72
+ getIconForSourceType={getIconForSourceType}
73
+ onSeeChunks={handleSeeChunks}
74
+ label={LABELS.KNOWLEDGE_SOURCES}
75
+ />
76
+
77
+ <ExecutedTools
78
+ tools={otherTools}
79
+ onSeeToolDetails={handleSeeToolDetails}
80
+ />
81
+
82
+ {!tools_executed.length && (
83
+ <StyledDebugDetail>
84
+ <StyledDebugLabel>{LABELS.NO_TOOLS_EXECUTED}</StyledDebugLabel>
85
+ </StyledDebugDetail>
86
+ )}
87
+
88
+ <GuardrailList
89
+ keyPrefix='input'
90
+ guardrails={input_guardrails_triggered}
91
+ />
92
+
93
+ <GuardrailList
94
+ keyPrefix='output'
95
+ guardrails={output_guardrails_triggered}
96
+ $isLastItem={!exit && !error}
97
+ />
98
+
99
+ {exit && (
100
+ <StyledDebugDetail>
101
+ <StyledDebugLabel>{LABELS.EXIT}</StyledDebugLabel>
102
+ </StyledDebugDetail>
103
+ )}
104
+
105
+ {error && (
106
+ <StyledDebugDetail>
107
+ <StyledDebugLabel>{LABELS.ERROR}</StyledDebugLabel>
108
+ </StyledDebugDetail>
109
+ )}
110
+ </>
111
+ )
112
+ }
113
+
114
+ export const getAiAgentEventConfig = (
115
+ data: AiAgentDebugEvent
116
+ ): DebugEventConfig => {
117
+ const title = (
118
+ <>
119
+ AI Agent triggered <span>- {data.flow_node_content_id}</span>
120
+ </>
121
+ )
122
+
123
+ return {
124
+ action: EventAction.AiAgent,
125
+ title,
126
+ component: AiAgent,
127
+ icon: <WandSvg />,
128
+ collapsible: true,
129
+ }
130
+ }
@@ -0,0 +1,43 @@
1
+ import styled from 'styled-components'
2
+ import { ScrewdriverWrenchSvg } from '../../icons'
3
+ import {
4
+ StyledDebugDetail,
5
+ StyledDebugItemWithIcon,
6
+ StyledDebugLabel,
7
+ StyledSeeInfo,
8
+ } from '../../styles'
9
+ import { LABELS } from '../constants'
10
+ import type { ToolExecuted } from './types'
11
+
12
+ const StyledSeeToolDetailsButton = styled(StyledSeeInfo)`
13
+ flex-shrink: 0;
14
+ border: none;
15
+ `
16
+
17
+ interface Props {
18
+ tools: ToolExecuted[]
19
+ onSeeToolDetails: (tool: ToolExecuted) => void
20
+ }
21
+
22
+ export const ExecutedTools = ({ tools, onSeeToolDetails }: Props) => {
23
+ if (!tools.length) {
24
+ return null
25
+ }
26
+
27
+ return (
28
+ <StyledDebugDetail>
29
+ <StyledDebugLabel>{LABELS.EXECUTED_TOOLS}</StyledDebugLabel>
30
+
31
+ {tools.map((tool, index) => (
32
+ <StyledDebugItemWithIcon key={`${tool.tool_name}-${index}`}>
33
+ <ScrewdriverWrenchSvg />
34
+ {tool.tool_name}
35
+
36
+ <StyledSeeToolDetailsButton onClick={() => onSeeToolDetails(tool)}>
37
+ {LABELS.SEE_TOOL_DETAILS}
38
+ </StyledSeeToolDetailsButton>
39
+ </StyledDebugItemWithIcon>
40
+ ))}
41
+ </StyledDebugDetail>
42
+ )
43
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ai-agent'
2
+ export * from './types'
@@ -0,0 +1,31 @@
1
+ import type { ToolExecuted } from './types'
2
+
3
+ export const RETRIEVE_KNOWLEDGE_TOOL = 'retrieve_knowledge'
4
+
5
+ export function parseTools(tools: ToolExecuted[]) {
6
+ const result = {
7
+ retrieveKnowledgeTools: [] as ToolExecuted[],
8
+ otherTools: [] as ToolExecuted[],
9
+ allSourcesIds: [] as string[],
10
+ allChunksIds: [] as string[],
11
+ query: undefined as string | undefined,
12
+ }
13
+
14
+ for (const tool of tools) {
15
+ if (tool.tool_name !== RETRIEVE_KNOWLEDGE_TOOL) {
16
+ result.otherTools.push(tool)
17
+ continue
18
+ }
19
+
20
+ result.retrieveKnowledgeTools.push(tool)
21
+
22
+ if (typeof tool.tool_arguments?.query === 'string') {
23
+ result.query = tool.tool_arguments.query
24
+ }
25
+
26
+ result.allSourcesIds.push(...(tool.knowledgebase_sources_ids ?? []))
27
+ result.allChunksIds.push(...(tool.knowledgebase_chunks_ids ?? []))
28
+ }
29
+
30
+ return result
31
+ }
@@ -0,0 +1,23 @@
1
+ import type { EventAction } from '@botonic/core'
2
+ import type { ChunkIdsGroupedBySourceData } from '../knowledge-bases-types'
3
+
4
+ export interface ToolExecuted {
5
+ tool_name: string
6
+ tool_arguments: Record<string, unknown>
7
+ tool_results?: string
8
+ knowledgebase_sources_ids?: string[]
9
+ knowledgebase_chunks_ids?: string[]
10
+ }
11
+
12
+ export interface AiAgentDebugEvent {
13
+ action: EventAction.AiAgent
14
+ flow_node_content_id: string
15
+ user_input?: string
16
+ tools_executed: ToolExecuted[]
17
+ input_guardrails_triggered: string[]
18
+ output_guardrails_triggered: string[]
19
+ exit: boolean
20
+ error: boolean
21
+ knowledge_base_chunks_with_sources?: ChunkIdsGroupedBySourceData[]
22
+ messageId?: string
23
+ }
@@ -1,16 +1,21 @@
1
1
  import type React from 'react'
2
-
2
+ import styled from 'styled-components'
3
3
  import {
4
4
  StyledDebugDetail,
5
5
  StyledDebugItemWithIcon,
6
6
  StyledDebugLabel,
7
7
  StyledFileSourceValue,
8
- StyledSeeChunksButton,
8
+ StyledSeeInfo,
9
9
  StyledUrlSourceValue,
10
10
  } from '../../styles'
11
11
  import { LABELS } from '../constants'
12
12
  import type { HubtypeChunk, HubtypeSource } from '../knowledge-bases-types'
13
13
 
14
+ const StyledSeeChunksButton = styled(StyledSeeInfo)`
15
+ margin-left: 0;
16
+ margin-top: 4px;
17
+ `
18
+
14
19
  interface SourcesSectionProps {
15
20
  sources: HubtypeSource[]
16
21
  chunks: HubtypeChunk[]
@@ -4,8 +4,10 @@ export const LABELS = {
4
4
  FAITHFUL_ANSWER: 'Faithful answer',
5
5
  QUERY: 'Query',
6
6
  SOURCES: 'Sources',
7
- KNOWLEDGE_GATHERED: 'Knowledge gathered',
7
+ KNOWLEDGE_SOURCES: 'Knowledge sources',
8
8
  EXECUTED_TOOLS: 'Executed tools',
9
+ TOOL_ARGUMENTS: 'Tool arguments',
10
+ TOOL_RESULTS: 'Tool results',
9
11
  NO_TOOLS_EXECUTED: 'No tools executed',
10
12
  AUTO_ASSIGN_ON: 'ON',
11
13
  AUTO_ASSIGN_OFF: 'OFF',
@@ -16,6 +18,7 @@ export const LABELS = {
16
18
  NOTE: 'Note',
17
19
  KNOWLEDGE_BASE_FAIL_REASON: 'Knowledge Base Fail Reason',
18
20
  SEE_CHUNKS_BUTTON: 'See chunks',
21
+ SEE_TOOL_DETAILS: 'Details',
19
22
  STATUS: 'Status',
20
23
  YES: 'Yes',
21
24
  NO: 'No',
@@ -178,7 +178,7 @@ export const StyledDebugMetadata = styled.div`
178
178
  }
179
179
  `
180
180
 
181
- export const StyledSeeChunksButton = styled.button`
181
+ export const StyledSeeInfo = styled.button`
182
182
  border: 1px solid #c4c6d0;
183
183
  border-radius: 6px;
184
184
  padding: 8px;
@@ -190,8 +190,6 @@ export const StyledSeeChunksButton = styled.button`
190
190
  font-weight: 500;
191
191
  line-height: 1.5;
192
192
  cursor: pointer;
193
- margin-left: 0;
194
- margin-top: 4px;
195
193
  display: flex;
196
194
  align-items: center;
197
195
  justify-content: center;
@@ -201,6 +199,7 @@ export const StyledSeeChunksButton = styled.button`
201
199
  background-color: ${COLORS.N100};
202
200
  }
203
201
  `
202
+
204
203
  interface StyledGuardrailItemProps {
205
204
  $isLastItem?: boolean
206
205
  }
@@ -224,7 +223,7 @@ export const StyledGuardrailItem = styled.div<StyledGuardrailItemProps>`
224
223
  export const StyledDebugContentWrapper = styled.div`
225
224
  display: flex;
226
225
  flex-direction: column;
227
- gap: 8px;
226
+ gap: 16px;
228
227
  position: relative;
229
228
  width: 100%;
230
229
  min-width: 0;
@@ -8,6 +8,7 @@ import type {
8
8
  Session as CoreSession,
9
9
  SessionUser as CoreSessionUser,
10
10
  ServerConfig,
11
+ ToolExecution,
11
12
  } from '@botonic/core'
12
13
  import type React from 'react'
13
14
 
@@ -95,6 +96,7 @@ export interface PreviewUtils {
95
96
  onClickOpenChunks: (
96
97
  chunkIdsGroupedBySource: ChunkIdsGroupedBySourceData[]
97
98
  ) => void
99
+ onClickOpenToolResults: (toolExecution: ToolExecution) => void
98
100
  getMessageById: (messageId: string) => Promise<MinimalHubtypeMessage>
99
101
  trackPreviewEventOpened: (eventProperties: Record<string, unknown>) => void
100
102
  }
@@ -76,6 +76,9 @@ export const WebchatContext = createContext<WebchatContextProps>({
76
76
  },
77
77
  webchatState: {} as WebchatState,
78
78
  previewUtils: {
79
+ onClickOpenToolResults: () => {
80
+ return
81
+ },
79
82
  trackPreviewEventOpened: () => {
80
83
  return
81
84
  },
@@ -7,7 +7,7 @@ import { Button, customMessage } from '../../../components'
7
7
  import { WebchatContext } from '../../context'
8
8
  import { RatingSelector } from './rating-selector'
9
9
  import { MessageBubble } from './styles'
10
- import type { RatingType } from './types'
10
+ import { RatingType } from './types'
11
11
 
12
12
  interface CustomRatingMessageProps {
13
13
  payloads: string[]
@@ -18,6 +18,17 @@ interface CustomRatingMessageProps {
18
18
  valueSent?: number
19
19
  }
20
20
 
21
+ const ratingValues = {
22
+ [RatingType.Stars]: [
23
+ '⭐'.repeat(1),
24
+ '⭐'.repeat(2),
25
+ '⭐'.repeat(3),
26
+ '⭐'.repeat(4),
27
+ '⭐'.repeat(5),
28
+ ],
29
+ [RatingType.Smileys]: ['😠', '🙁', '😐', '🙂', '😄'],
30
+ } as const
31
+
21
32
  const CustomRatingMessage: React.FC<CustomRatingMessageProps> = props => {
22
33
  const { payloads, messageText, buttonText, ratingType, id, valueSent } = props
23
34
  const { updateCustomMessageProps, sendInput } = useContext(WebchatContext)
@@ -48,6 +59,7 @@ const CustomRatingMessage: React.FC<CustomRatingMessageProps> = props => {
48
59
  const input = {
49
60
  type: INPUT.POSTBACK as InputType,
50
61
  payload,
62
+ referral: ratingValues[ratingType][ratingValue - 1],
51
63
  }
52
64
  void sendInput(input)
53
65
  }