@osdk/react-components 0.33.0 → 0.34.0-main-d24cc61b1e7fde7722d8229ed2b6821f5ce1bf8a
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/AGENTS.md +3 -0
- package/CHANGELOG.md +19 -0
- package/README.md +14 -13
- package/build/browser/aip-agent-chat/AipAgentChat.js +113 -0
- package/build/browser/aip-agent-chat/AipAgentChat.js.map +1 -0
- package/build/browser/aip-agent-chat/AipAgentChat.module.css +231 -0
- package/build/browser/aip-agent-chat/AipAgentChat.module.css.js +29 -0
- package/build/browser/aip-agent-chat/AipAgentChatApi.js +2 -0
- package/build/browser/aip-agent-chat/AipAgentChatApi.js.map +1 -0
- package/build/browser/aip-agent-chat/BaseAipAgentChat.js +67 -0
- package/build/browser/aip-agent-chat/BaseAipAgentChat.js.map +1 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatComposer.js +96 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatComposer.js.map +1 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatLoader.js +43 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatLoader.js.map +1 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatMessage.js +60 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatMessage.js.map +1 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatMessageList.js +60 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatMessageList.js.map +1 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatModelPicker.js +56 -0
- package/build/browser/aip-agent-chat/components/AipAgentChatModelPicker.js.map +1 -0
- package/build/browser/aip-agent-chat/hooks/useChatAutoScroll.js +61 -0
- package/build/browser/aip-agent-chat/hooks/useChatAutoScroll.js.map +1 -0
- package/build/browser/base-components/callout/Callout.js +65 -0
- package/build/browser/base-components/callout/Callout.js.map +1 -0
- package/build/browser/base-components/callout/Callout.module.css +59 -0
- package/build/browser/base-components/callout/Callout.module.css.js +15 -0
- package/build/browser/public/experimental/aip-agent-chat.js +22 -0
- package/build/browser/public/experimental/aip-agent-chat.js.map +1 -0
- package/build/browser/styles.css +402 -0
- package/build/browser/tokens/base-tokens/dark.css +10 -0
- package/build/browser/tokens/component-tokens/aip-agent-chat.css +56 -0
- package/build/browser/tokens/component-tokens/callout.css +40 -0
- package/build/browser/tokens.css +2 -0
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/{chunk-N5NOB4G4.cjs → chunk-4SBWDLNA.cjs} +4 -4
- package/build/cjs/{chunk-N5NOB4G4.cjs.map → chunk-4SBWDLNA.cjs.map} +1 -1
- package/build/cjs/{chunk-PFGIO77A.cjs → chunk-5JPP5IKU.cjs} +4 -4
- package/build/cjs/{chunk-PFGIO77A.cjs.map → chunk-5JPP5IKU.cjs.map} +1 -1
- package/build/cjs/{chunk-56CFJTXV.cjs → chunk-73EYJP6Z.cjs} +6 -6
- package/build/cjs/{chunk-56CFJTXV.cjs.map → chunk-73EYJP6Z.cjs.map} +1 -1
- package/build/cjs/{chunk-XCZD54BD.cjs → chunk-ABKLMCWO.cjs} +4 -4
- package/build/cjs/{chunk-XCZD54BD.cjs.map → chunk-ABKLMCWO.cjs.map} +1 -1
- package/build/cjs/{chunk-QWFT3G4W.cjs → chunk-EOXGPHI7.cjs} +4 -4
- package/build/cjs/{chunk-QWFT3G4W.cjs.map → chunk-EOXGPHI7.cjs.map} +1 -1
- package/build/cjs/chunk-HM6F2PSA.cjs +11 -0
- package/build/cjs/{chunk-N7TOWLUY.cjs.map → chunk-HM6F2PSA.cjs.map} +1 -1
- package/build/cjs/chunk-ILBAVINW.cjs +11 -0
- package/build/cjs/{chunk-SUEZQS7M.cjs.map → chunk-ILBAVINW.cjs.map} +1 -1
- package/build/cjs/chunk-MSUA3D5M.cjs +11 -0
- package/build/cjs/{chunk-AEFCONAY.cjs.map → chunk-MSUA3D5M.cjs.map} +1 -1
- package/build/cjs/{chunk-4AGEVOFW.cjs → chunk-MV4WJDCS.cjs} +4 -4
- package/build/cjs/{chunk-4AGEVOFW.cjs.map → chunk-MV4WJDCS.cjs.map} +1 -1
- package/build/cjs/{chunk-LYAAHEAS.cjs → chunk-PSXAPQB3.cjs} +4 -4
- package/build/cjs/{chunk-LYAAHEAS.cjs.map → chunk-PSXAPQB3.cjs.map} +1 -1
- package/build/cjs/chunk-RCL5R3P4.cjs +11 -0
- package/build/cjs/{chunk-D6RQIMMX.cjs.map → chunk-RCL5R3P4.cjs.map} +1 -1
- package/build/cjs/{chunk-OTAWBR27.cjs → chunk-S7Z4MCUS.cjs} +4 -4
- package/build/cjs/{chunk-OTAWBR27.cjs.map → chunk-S7Z4MCUS.cjs.map} +1 -1
- package/build/cjs/{chunk-364UCCB2.cjs → chunk-WVRYCKJY.cjs} +3 -3
- package/build/cjs/chunk-WVRYCKJY.cjs.map +1 -0
- package/build/cjs/chunk-YNECVUTQ.cjs +11 -0
- package/build/cjs/{chunk-3MDT2TJK.cjs.map → chunk-YNECVUTQ.cjs.map} +1 -1
- package/build/cjs/public/experimental/action-form.cjs +4 -4
- package/build/cjs/public/experimental/aip-agent-chat.cjs +434 -0
- package/build/cjs/public/experimental/aip-agent-chat.cjs.map +1 -0
- package/build/cjs/public/experimental/aip-agent-chat.css +304 -0
- package/build/cjs/public/experimental/aip-agent-chat.css.map +1 -0
- package/build/cjs/public/experimental/aip-agent-chat.d.cts +202 -0
- package/build/cjs/public/experimental/cbac-picker.cjs +11 -11
- package/build/cjs/public/experimental/document-viewer.cjs +6 -6
- package/build/cjs/public/experimental/email-viewer.cjs +3 -3
- package/build/cjs/public/experimental/excel-viewer.cjs +3 -3
- package/build/cjs/public/experimental/filter-list.cjs +15 -15
- package/build/cjs/public/experimental/image-viewer.cjs +3 -3
- package/build/cjs/public/experimental/markdown-renderer.cjs +3 -3
- package/build/cjs/public/experimental/object-table.cjs +8 -8
- package/build/cjs/public/experimental/pdf-viewer.cjs +7 -7
- package/build/cjs/public/experimental/tiff-renderer.cjs +3 -3
- package/build/cjs/public/experimental/video-viewer.cjs +3 -3
- package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
- package/build/cjs/public/experimental.cjs +74 -74
- package/build/esm/aip-agent-chat/AipAgentChat.js +113 -0
- package/build/esm/aip-agent-chat/AipAgentChat.js.map +1 -0
- package/build/esm/aip-agent-chat/AipAgentChat.module.css +231 -0
- package/build/esm/aip-agent-chat/AipAgentChatApi.js +2 -0
- package/build/esm/aip-agent-chat/AipAgentChatApi.js.map +1 -0
- package/build/esm/aip-agent-chat/BaseAipAgentChat.js +67 -0
- package/build/esm/aip-agent-chat/BaseAipAgentChat.js.map +1 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatComposer.js +96 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatComposer.js.map +1 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatLoader.js +43 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatLoader.js.map +1 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatMessage.js +60 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatMessage.js.map +1 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatMessageList.js +60 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatMessageList.js.map +1 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatModelPicker.js +56 -0
- package/build/esm/aip-agent-chat/components/AipAgentChatModelPicker.js.map +1 -0
- package/build/esm/aip-agent-chat/hooks/useChatAutoScroll.js +61 -0
- package/build/esm/aip-agent-chat/hooks/useChatAutoScroll.js.map +1 -0
- package/build/esm/base-components/callout/Callout.js +65 -0
- package/build/esm/base-components/callout/Callout.js.map +1 -0
- package/build/esm/base-components/callout/Callout.module.css +59 -0
- package/build/esm/public/experimental/aip-agent-chat.js +22 -0
- package/build/esm/public/experimental/aip-agent-chat.js.map +1 -0
- package/build/esm/tokens/base-tokens/dark.css +10 -0
- package/build/esm/tokens/component-tokens/aip-agent-chat.css +56 -0
- package/build/esm/tokens/component-tokens/callout.css +40 -0
- package/build/esm/tokens.css +2 -0
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/types/aip-agent-chat/AipAgentChat.d.ts +10 -0
- package/build/types/aip-agent-chat/AipAgentChat.d.ts.map +1 -0
- package/build/types/aip-agent-chat/AipAgentChatApi.d.ts +135 -0
- package/build/types/aip-agent-chat/AipAgentChatApi.d.ts.map +1 -0
- package/build/types/aip-agent-chat/BaseAipAgentChat.d.ts +55 -0
- package/build/types/aip-agent-chat/BaseAipAgentChat.d.ts.map +1 -0
- package/build/types/aip-agent-chat/components/AipAgentChatComposer.d.ts +19 -0
- package/build/types/aip-agent-chat/components/AipAgentChatComposer.d.ts.map +1 -0
- package/build/types/aip-agent-chat/components/AipAgentChatLoader.d.ts +9 -0
- package/build/types/aip-agent-chat/components/AipAgentChatLoader.d.ts.map +1 -0
- package/build/types/aip-agent-chat/components/AipAgentChatMessage.d.ts +12 -0
- package/build/types/aip-agent-chat/components/AipAgentChatMessage.d.ts.map +1 -0
- package/build/types/aip-agent-chat/components/AipAgentChatMessageList.d.ts +11 -0
- package/build/types/aip-agent-chat/components/AipAgentChatMessageList.d.ts.map +1 -0
- package/build/types/aip-agent-chat/components/AipAgentChatModelPicker.d.ts +16 -0
- package/build/types/aip-agent-chat/components/AipAgentChatModelPicker.d.ts.map +1 -0
- package/build/types/aip-agent-chat/hooks/useChatAutoScroll.d.ts +11 -0
- package/build/types/aip-agent-chat/hooks/useChatAutoScroll.d.ts.map +1 -0
- package/build/types/base-components/callout/Callout.d.ts +33 -0
- package/build/types/base-components/callout/Callout.d.ts.map +1 -0
- package/build/types/public/experimental/aip-agent-chat.d.ts +7 -0
- package/build/types/public/experimental/aip-agent-chat.d.ts.map +1 -0
- package/docs/AipAgentChat.md +207 -0
- package/docs/CSSVariables.md +52 -0
- package/docs/Welcome.md +1 -0
- package/package.json +24 -8
- package/build/cjs/chunk-364UCCB2.cjs.map +0 -1
- package/build/cjs/chunk-3MDT2TJK.cjs +0 -11
- package/build/cjs/chunk-AEFCONAY.cjs +0 -11
- package/build/cjs/chunk-D6RQIMMX.cjs +0 -11
- package/build/cjs/chunk-N7TOWLUY.cjs +0 -11
- package/build/cjs/chunk-SUEZQS7M.cjs +0 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPKJFOG2Z_cjs = require('./chunk-PKJFOG2Z.cjs');
|
|
4
|
+
var chunkWVRYCKJY_cjs = require('./chunk-WVRYCKJY.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/experimental/email-viewer.ts
|
|
7
|
+
var EmailViewer2 = chunkWVRYCKJY_cjs.withOsdkMetrics(chunkPKJFOG2Z_cjs.EmailViewer, "EmailViewer");
|
|
8
|
+
|
|
9
|
+
exports.EmailViewer = EmailViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-RCL5R3P4.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-RCL5R3P4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/email-viewer.ts"],"names":["EmailViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/email-viewer.ts"],"names":["EmailViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-RCL5R3P4.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// BaseEmailViewer\nexport { BaseEmailViewer } from \"../../email-viewer/BaseEmailViewer.js\";\n// EmailViewer (Media wrapper)\nimport { EmailViewer as _EmailViewer } from \"../../email-viewer/EmailViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const EmailViewer = withOsdkMetrics(_EmailViewer, \"EmailViewer\");"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkIISDOJPR_cjs = require('./chunk-IISDOJPR.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkWVRYCKJY_cjs = require('./chunk-WVRYCKJY.cjs');
|
|
5
5
|
|
|
6
6
|
// src/public/experimental/tiff-renderer.ts
|
|
7
|
-
var TiffViewerMedia2 =
|
|
7
|
+
var TiffViewerMedia2 = chunkWVRYCKJY_cjs.withOsdkMetrics(chunkIISDOJPR_cjs.TiffViewerMedia, "TiffViewerMedia");
|
|
8
8
|
|
|
9
9
|
exports.TiffViewerMedia = TiffViewerMedia2;
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-S7Z4MCUS.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-S7Z4MCUS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/tiff-renderer.ts"],"names":["TiffViewerMedia","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,gBAAAA,GAAkBC,iCAAA,CAAgBD,iCAAA,EAAkB,iBAAiB","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/tiff-renderer.ts"],"names":["TiffViewerMedia","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,gBAAAA,GAAkBC,iCAAA,CAAgBD,iCAAA,EAAkB,iBAAiB","file":"chunk-S7Z4MCUS.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// TiffRenderer\nexport { TiffRenderer } from \"../../images/tiff-renderer/TiffRenderer.js\";\n// TiffViewerMedia (Media wrapper)\nimport { TiffViewerMedia as _TiffViewerMedia } from \"../../images/tiff-renderer/TiffViewerMedia.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const TiffViewerMedia = withOsdkMetrics(_TiffViewerMedia, \"TiffViewerMedia\");"]}
|
|
@@ -10,7 +10,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
10
10
|
// src/util/withOsdkMetrics.ts
|
|
11
11
|
|
|
12
12
|
// src/util/UserAgent.ts
|
|
13
|
-
var PACKAGE_USER_AGENT = `osdk-react-components/${"0.
|
|
13
|
+
var PACKAGE_USER_AGENT = `osdk-react-components/${"0.34.0-main-d24cc61b1e7fde7722d8229ed2b6821f5ce1bf8a"}`;
|
|
14
14
|
function componentUserAgent(componentName) {
|
|
15
15
|
return `${PACKAGE_USER_AGENT}/${componentName}`;
|
|
16
16
|
}
|
|
@@ -26,5 +26,5 @@ function withOsdkMetrics(Component, name) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
exports.withOsdkMetrics = withOsdkMetrics;
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-WVRYCKJY.cjs.map
|
|
30
|
+
//# sourceMappingURL=chunk-WVRYCKJY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/util/UserAgent.ts","../../src/util/withOsdkMetrics.ts"],"names":["useRegisterUserAgent","React"],"mappings":";;;;;;;;;;;;AAgBA,IAAM,kBAAA,GAAqB,yBAAyB,sDAA2B,CAAA,CAAA;AACxE,SAAS,mBAAmB,aAAA,EAAe;AAChD,EAAA,OAAO,CAAA,EAAG,kBAAkB,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA;AAC/C;;;ACKO,SAAS,eAAA,CAAgB,WAAW,IAAA,EAAM;AAC/C,EAAA,MAAM,UAAU,CAAA,KAAA,KAAS;AACvB,IAAAA,0BAAA,CAAqB,kBAAA,CAAmB,IAAI,CAAC,CAAA;AAC7C,IAAA,uBAAoBC,sBAAA,CAAM,aAAA,CAAc,SAAA,EAAW,KAAK,CAAA;AAAA,EAC1D,CAAA;AACA,EAAA,OAAA,CAAQ,WAAA,GAAc,mBAAmB,IAAI,CAAA,CAAA,CAAA;AAC7C,EAAA,OAAO,OAAA;AACT","file":"chunk-WVRYCKJY.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst PACKAGE_USER_AGENT = `osdk-react-components/${process.env.PACKAGE_VERSION}`;\nexport function componentUserAgent(componentName) {\n return `${PACKAGE_USER_AGENT}/${componentName}`;\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useRegisterUserAgent } from \"@osdk/react\";\nimport React from \"react\";\nimport { componentUserAgent } from \"./UserAgent.js\";\n\n// `any` is required: FunctionComponent defaults to FunctionComponent<{}> which\n// rejects components with required props. A generic P parameter doesn't help\n// because TS can't infer both P and C simultaneously from a single argument.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withOsdkMetrics(Component, name) {\n const Wrapped = props => {\n useRegisterUserAgent(componentUserAgent(name));\n return /*#__PURE__*/React.createElement(Component, props);\n };\n Wrapped.displayName = `withOsdkMetrics(${name})`;\n return Wrapped;\n}"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkVOROB7KJ_cjs = require('./chunk-VOROB7KJ.cjs');
|
|
4
|
+
var chunkWVRYCKJY_cjs = require('./chunk-WVRYCKJY.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/experimental/image-viewer.ts
|
|
7
|
+
var ImageViewer2 = chunkWVRYCKJY_cjs.withOsdkMetrics(chunkVOROB7KJ_cjs.ImageViewer, "ImageViewer");
|
|
8
|
+
|
|
9
|
+
exports.ImageViewer = ImageViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-YNECVUTQ.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-YNECVUTQ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/image-viewer.ts"],"names":["ImageViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/image-viewer.ts"],"names":["ImageViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-YNECVUTQ.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// BaseImageViewer\nexport { BaseImageViewer } from \"../../images/image-viewer/BaseImageViewer.js\";\n// ImageViewer (Media wrapper)\nimport { ImageViewer as _ImageViewer } from \"../../images/image-viewer/ImageViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const ImageViewer = withOsdkMetrics(_ImageViewer, \"ImageViewer\");"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5JPP5IKU_cjs = require('../../chunk-5JPP5IKU.cjs');
|
|
4
4
|
require('../../chunk-JKNARBQW.cjs');
|
|
5
5
|
require('../../chunk-PUQBJVFU.cjs');
|
|
6
6
|
require('../../chunk-CASYBF4M.cjs');
|
|
@@ -10,18 +10,18 @@ require('../../chunk-HNBSGCSZ.cjs');
|
|
|
10
10
|
require('../../chunk-7LXS66DW.cjs');
|
|
11
11
|
require('../../chunk-MD4KDE44.cjs');
|
|
12
12
|
require('../../chunk-UCTQICPR.cjs');
|
|
13
|
-
require('../../chunk-
|
|
13
|
+
require('../../chunk-WVRYCKJY.cjs');
|
|
14
14
|
require('../../chunk-PZPCRXSV.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "ActionForm", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunk5JPP5IKU_cjs.ActionForm; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "BaseForm", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunk5JPP5IKU_cjs.BaseForm; }
|
|
25
25
|
});
|
|
26
26
|
//# sourceMappingURL=action-form.cjs.map
|
|
27
27
|
//# sourceMappingURL=action-form.cjs.map
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMD4KDE44_cjs = require('../../chunk-MD4KDE44.cjs');
|
|
4
|
+
require('../../chunk-PZPCRXSV.cjs');
|
|
5
|
+
var aipCore = require('@osdk/aip-core');
|
|
6
|
+
var aip = require('@osdk/react/experimental/aip');
|
|
7
|
+
var React6 = require('react');
|
|
8
|
+
var classNames5 = require('classnames');
|
|
9
|
+
var icons = require('@blueprintjs/icons');
|
|
10
|
+
var input = require('@base-ui/react/input');
|
|
11
|
+
|
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
function _interopNamespace(e) {
|
|
15
|
+
if (e && e.__esModule) return e;
|
|
16
|
+
var n = Object.create(null);
|
|
17
|
+
if (e) {
|
|
18
|
+
Object.keys(e).forEach(function (k) {
|
|
19
|
+
if (k !== 'default') {
|
|
20
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return e[k]; }
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
n.default = e;
|
|
29
|
+
return Object.freeze(n);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
|
|
33
|
+
var classNames5__default = /*#__PURE__*/_interopDefault(classNames5);
|
|
34
|
+
|
|
35
|
+
// src/base-components/callout/Callout.module.css
|
|
36
|
+
var Callout_default = {};
|
|
37
|
+
|
|
38
|
+
// src/base-components/callout/Callout.tsx
|
|
39
|
+
var DEFAULT_ICONS = {
|
|
40
|
+
error: icons.Error,
|
|
41
|
+
warning: icons.WarningSign,
|
|
42
|
+
success: icons.Tick,
|
|
43
|
+
info: icons.InfoSign
|
|
44
|
+
};
|
|
45
|
+
var INTENT_STYLES = {
|
|
46
|
+
error: Callout_default.error,
|
|
47
|
+
warning: Callout_default.warning,
|
|
48
|
+
success: Callout_default.success,
|
|
49
|
+
info: Callout_default.info
|
|
50
|
+
};
|
|
51
|
+
var Callout = /* @__PURE__ */ React6__namespace.memo(function Callout2({
|
|
52
|
+
intent,
|
|
53
|
+
title,
|
|
54
|
+
children,
|
|
55
|
+
actions,
|
|
56
|
+
icon,
|
|
57
|
+
className
|
|
58
|
+
}) {
|
|
59
|
+
const IconComponent = icon ?? DEFAULT_ICONS[intent];
|
|
60
|
+
return /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
61
|
+
"aria-live": "polite",
|
|
62
|
+
className: classNames5__default.default(Callout_default.callout, INTENT_STYLES[intent], className),
|
|
63
|
+
role: "alert"
|
|
64
|
+
}, IconComponent != null && /* @__PURE__ */ React6__namespace.createElement("span", {
|
|
65
|
+
className: Callout_default.icon
|
|
66
|
+
}, /* @__PURE__ */ React6__namespace.createElement(IconComponent, {
|
|
67
|
+
size: 16
|
|
68
|
+
})), /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
69
|
+
className: Callout_default.body
|
|
70
|
+
}, title != null && /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
71
|
+
className: Callout_default.title
|
|
72
|
+
}, title), children != null && /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
73
|
+
className: Callout_default.message
|
|
74
|
+
}, children)), actions != null && /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
75
|
+
className: Callout_default.actions
|
|
76
|
+
}, actions));
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// src/aip-agent-chat/AipAgentChat.module.css
|
|
80
|
+
var AipAgentChat_default = {};
|
|
81
|
+
function _extends() {
|
|
82
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
83
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
84
|
+
var t = arguments[e];
|
|
85
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
86
|
+
}
|
|
87
|
+
return n;
|
|
88
|
+
}, _extends.apply(null, arguments);
|
|
89
|
+
}
|
|
90
|
+
function AipAgentChatComposer({
|
|
91
|
+
isInFlight,
|
|
92
|
+
onSendMessage,
|
|
93
|
+
onStop,
|
|
94
|
+
placeholder,
|
|
95
|
+
className,
|
|
96
|
+
footerLeft
|
|
97
|
+
}) {
|
|
98
|
+
const [draft, setDraft] = React6__namespace.useState("");
|
|
99
|
+
const canSend = !isInFlight && draft.trim().length > 0;
|
|
100
|
+
const handleSend = React6__namespace.useCallback(() => {
|
|
101
|
+
const trimmed = draft.trim();
|
|
102
|
+
if (trimmed.length === 0) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const result = onSendMessage(trimmed);
|
|
107
|
+
if (result instanceof Promise) {
|
|
108
|
+
result.catch(noop);
|
|
109
|
+
}
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
setDraft("");
|
|
113
|
+
}, [draft, onSendMessage]);
|
|
114
|
+
const handleKeyDown = React6__namespace.useCallback((event) => {
|
|
115
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
if (!isInFlight) {
|
|
118
|
+
handleSend();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, [handleSend, isInFlight]);
|
|
122
|
+
const renderTextarea = React6__namespace.useCallback((props) => /* @__PURE__ */ React6__namespace.createElement("textarea", _extends({}, props, {
|
|
123
|
+
onKeyDown: handleKeyDown,
|
|
124
|
+
rows: 3
|
|
125
|
+
})), [handleKeyDown]);
|
|
126
|
+
return /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
127
|
+
className: classNames5__default.default(AipAgentChat_default.composer, className)
|
|
128
|
+
}, /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
129
|
+
className: AipAgentChat_default.inputWrapper
|
|
130
|
+
}, /* @__PURE__ */ React6__namespace.createElement(input.Input, {
|
|
131
|
+
"aria-label": "Message input",
|
|
132
|
+
className: AipAgentChat_default.textarea,
|
|
133
|
+
onValueChange: setDraft,
|
|
134
|
+
placeholder,
|
|
135
|
+
value: draft,
|
|
136
|
+
render: renderTextarea
|
|
137
|
+
}), /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
138
|
+
className: AipAgentChat_default.inputActions
|
|
139
|
+
}, isInFlight && onStop != null ? /* @__PURE__ */ React6__namespace.createElement(chunkMD4KDE44_cjs.ActionButton, {
|
|
140
|
+
onClick: onStop,
|
|
141
|
+
type: "button"
|
|
142
|
+
}, "Stop") : /* @__PURE__ */ React6__namespace.createElement(chunkMD4KDE44_cjs.ActionButton, {
|
|
143
|
+
disabled: !canSend,
|
|
144
|
+
onClick: handleSend,
|
|
145
|
+
type: "button",
|
|
146
|
+
variant: "primary"
|
|
147
|
+
}, "Send"))), footerLeft != null && /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
148
|
+
className: AipAgentChat_default.composerFooterLeft
|
|
149
|
+
}, footerLeft));
|
|
150
|
+
}
|
|
151
|
+
function noop() {
|
|
152
|
+
}
|
|
153
|
+
function useChatAutoScroll(signal, enabled) {
|
|
154
|
+
const elRef = React6__namespace.useRef(null);
|
|
155
|
+
const cleanupRef = React6__namespace.useRef(null);
|
|
156
|
+
const isPinnedRef = React6__namespace.useRef(true);
|
|
157
|
+
const setRef = React6__namespace.useCallback((el) => {
|
|
158
|
+
cleanupRef.current?.();
|
|
159
|
+
cleanupRef.current = null;
|
|
160
|
+
elRef.current = el;
|
|
161
|
+
if (el == null) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const onScroll = () => {
|
|
165
|
+
const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
|
|
166
|
+
isPinnedRef.current = distanceFromBottom <= NEAR_BOTTOM_THRESHOLD_PX;
|
|
167
|
+
};
|
|
168
|
+
el.addEventListener("scroll", onScroll, {
|
|
169
|
+
passive: true
|
|
170
|
+
});
|
|
171
|
+
cleanupRef.current = () => el.removeEventListener("scroll", onScroll);
|
|
172
|
+
}, []);
|
|
173
|
+
React6__namespace.useEffect(() => {
|
|
174
|
+
if (!enabled) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const el = elRef.current;
|
|
178
|
+
if (el == null || !isPinnedRef.current) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
el.scrollTop = el.scrollHeight;
|
|
182
|
+
}, [signal, enabled]);
|
|
183
|
+
return setRef;
|
|
184
|
+
}
|
|
185
|
+
var NEAR_BOTTOM_THRESHOLD_PX = 32;
|
|
186
|
+
function AipAgentChatLoader({
|
|
187
|
+
className,
|
|
188
|
+
label = "Assistant is responding"
|
|
189
|
+
}) {
|
|
190
|
+
return /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
191
|
+
"aria-label": label,
|
|
192
|
+
"aria-live": "polite",
|
|
193
|
+
className: classNames5__default.default(AipAgentChat_default.loader, className),
|
|
194
|
+
role: "status"
|
|
195
|
+
}, /* @__PURE__ */ React6__namespace.createElement("span", {
|
|
196
|
+
"aria-hidden": "true",
|
|
197
|
+
className: AipAgentChat_default.loaderDot
|
|
198
|
+
}), /* @__PURE__ */ React6__namespace.createElement("span", {
|
|
199
|
+
"aria-hidden": "true",
|
|
200
|
+
className: AipAgentChat_default.loaderDot
|
|
201
|
+
}), /* @__PURE__ */ React6__namespace.createElement("span", {
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
className: AipAgentChat_default.loaderDot
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
function AipAgentChatMessage({
|
|
207
|
+
message
|
|
208
|
+
}) {
|
|
209
|
+
const text = aipCore.getUIMessageText(message);
|
|
210
|
+
const role = message.role;
|
|
211
|
+
const styling = ROLE_STYLING[role];
|
|
212
|
+
return /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
213
|
+
"aria-label": styling.label,
|
|
214
|
+
className: classNames5__default.default(AipAgentChat_default.message, styling.container),
|
|
215
|
+
role: "group"
|
|
216
|
+
}, /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
217
|
+
className: classNames5__default.default(AipAgentChat_default.bubble, styling.bubble)
|
|
218
|
+
}, text.length > 0 ? text : /* @__PURE__ */ React6__namespace.createElement("span", {
|
|
219
|
+
className: AipAgentChat_default.streamingPlaceholder
|
|
220
|
+
}, "\u2026")));
|
|
221
|
+
}
|
|
222
|
+
var ROLE_STYLING = {
|
|
223
|
+
user: {
|
|
224
|
+
container: AipAgentChat_default.userMessage,
|
|
225
|
+
bubble: AipAgentChat_default.userBubble,
|
|
226
|
+
label: "User message"
|
|
227
|
+
},
|
|
228
|
+
assistant: {
|
|
229
|
+
container: AipAgentChat_default.assistantMessage,
|
|
230
|
+
bubble: AipAgentChat_default.assistantBubble,
|
|
231
|
+
label: "Assistant message"
|
|
232
|
+
},
|
|
233
|
+
system: {
|
|
234
|
+
container: AipAgentChat_default.systemMessage,
|
|
235
|
+
bubble: AipAgentChat_default.systemBubble,
|
|
236
|
+
label: "System message"
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// src/aip-agent-chat/components/AipAgentChatMessageList.tsx
|
|
241
|
+
var DEFAULT_EMPTY_STATE = /* @__PURE__ */ React6__namespace.createElement(React6__namespace.Fragment, null, /* @__PURE__ */ React6__namespace.createElement(icons.Chat, {
|
|
242
|
+
className: AipAgentChat_default.emptyIcon,
|
|
243
|
+
size: 64
|
|
244
|
+
}), /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
245
|
+
className: AipAgentChat_default.emptyTitle
|
|
246
|
+
}, "Start a conversation"), /* @__PURE__ */ React6__namespace.createElement("div", null, "Type a message below to chat with the assistant."));
|
|
247
|
+
function AipAgentChatMessageList({
|
|
248
|
+
messages,
|
|
249
|
+
isStreaming,
|
|
250
|
+
enableAutoScroll,
|
|
251
|
+
className,
|
|
252
|
+
renderEmptyState,
|
|
253
|
+
renderMessage
|
|
254
|
+
}) {
|
|
255
|
+
const lastMessage = messages.at(-1);
|
|
256
|
+
const lastMessageTextLength = lastMessage != null ? aipCore.getUIMessageText(lastMessage).length : 0;
|
|
257
|
+
const scrollSignal = `${messages.length}:${lastMessageTextLength}`;
|
|
258
|
+
const setContainerRef = useChatAutoScroll(scrollSignal, enableAutoScroll);
|
|
259
|
+
const isEmpty = messages.length === 0 && !isStreaming;
|
|
260
|
+
const showLoader = isStreaming && lastMessage?.role !== "assistant";
|
|
261
|
+
return /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
262
|
+
"aria-live": isEmpty ? void 0 : "polite",
|
|
263
|
+
className: classNames5__default.default(AipAgentChat_default.messageList, isEmpty && AipAgentChat_default.empty, className),
|
|
264
|
+
ref: setContainerRef,
|
|
265
|
+
role: isEmpty ? void 0 : "log"
|
|
266
|
+
}, isEmpty ? renderEmptyState != null ? renderEmptyState() : DEFAULT_EMPTY_STATE : /* @__PURE__ */ React6__namespace.createElement(React6__namespace.Fragment, null, messages.map((message) => /* @__PURE__ */ React6__namespace.createElement(React6__namespace.Fragment, {
|
|
267
|
+
key: message.id
|
|
268
|
+
}, renderMessage != null ? renderMessage(message) : /* @__PURE__ */ React6__namespace.createElement(AipAgentChatMessage, {
|
|
269
|
+
message
|
|
270
|
+
}))), showLoader && /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
271
|
+
className: classNames5__default.default(AipAgentChat_default.message, AipAgentChat_default.assistantMessage)
|
|
272
|
+
}, /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
273
|
+
className: classNames5__default.default(AipAgentChat_default.bubble, AipAgentChat_default.assistantBubble)
|
|
274
|
+
}, /* @__PURE__ */ React6__namespace.createElement(AipAgentChatLoader, null)))));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// src/aip-agent-chat/BaseAipAgentChat.tsx
|
|
278
|
+
var BaseAipAgentChat = /* @__PURE__ */ React6__namespace.memo(function BaseAipAgentChat2({
|
|
279
|
+
messages,
|
|
280
|
+
status,
|
|
281
|
+
error,
|
|
282
|
+
onSendMessage,
|
|
283
|
+
onStop,
|
|
284
|
+
onClearError,
|
|
285
|
+
composerFooter,
|
|
286
|
+
className,
|
|
287
|
+
placeholder = "Type a message...",
|
|
288
|
+
enableAutoScroll = true,
|
|
289
|
+
renderEmptyState,
|
|
290
|
+
renderMessage
|
|
291
|
+
}) {
|
|
292
|
+
const isInFlight = status === "submitted" || status === "streaming";
|
|
293
|
+
return /* @__PURE__ */ React6__namespace.createElement("div", {
|
|
294
|
+
className: classNames5__default.default(AipAgentChat_default.chat, className)
|
|
295
|
+
}, error != null && /* @__PURE__ */ React6__namespace.createElement(Callout, {
|
|
296
|
+
actions: /* @__PURE__ */ React6__namespace.createElement(chunkMD4KDE44_cjs.ActionButton, {
|
|
297
|
+
onClick: onClearError,
|
|
298
|
+
type: "button"
|
|
299
|
+
}, "Dismiss"),
|
|
300
|
+
intent: "error",
|
|
301
|
+
title: "Something went wrong"
|
|
302
|
+
}, error.message.length > 0 ? error.message : "An unknown error occurred. Try again, or dismiss to keep the conversation."), /* @__PURE__ */ React6__namespace.createElement(AipAgentChatMessageList, {
|
|
303
|
+
enableAutoScroll,
|
|
304
|
+
isStreaming: isInFlight,
|
|
305
|
+
messages,
|
|
306
|
+
renderEmptyState,
|
|
307
|
+
renderMessage
|
|
308
|
+
}), /* @__PURE__ */ React6__namespace.createElement(AipAgentChatComposer, {
|
|
309
|
+
footerLeft: composerFooter,
|
|
310
|
+
isInFlight,
|
|
311
|
+
onSendMessage,
|
|
312
|
+
onStop,
|
|
313
|
+
placeholder
|
|
314
|
+
}));
|
|
315
|
+
});
|
|
316
|
+
function AipAgentChatModelPicker({
|
|
317
|
+
models,
|
|
318
|
+
activeModel,
|
|
319
|
+
onModelChange,
|
|
320
|
+
disabled,
|
|
321
|
+
className
|
|
322
|
+
}) {
|
|
323
|
+
const handleChange = React6__namespace.useCallback((event) => {
|
|
324
|
+
onModelChange(event.target.value);
|
|
325
|
+
}, [onModelChange]);
|
|
326
|
+
if (models.length === 0) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
if (models.length === 1) {
|
|
330
|
+
return /* @__PURE__ */ React6__namespace.createElement("span", {
|
|
331
|
+
className: classNames5__default.default(AipAgentChat_default.modelPickerLabel, className)
|
|
332
|
+
}, "Model: ", activeModel);
|
|
333
|
+
}
|
|
334
|
+
return /* @__PURE__ */ React6__namespace.createElement("select", {
|
|
335
|
+
"aria-label": "Active model",
|
|
336
|
+
className: classNames5__default.default(AipAgentChat_default.modelPicker, className),
|
|
337
|
+
disabled,
|
|
338
|
+
onChange: handleChange,
|
|
339
|
+
value: activeModel
|
|
340
|
+
}, models.map((modelName) => /* @__PURE__ */ React6__namespace.createElement("option", {
|
|
341
|
+
key: modelName,
|
|
342
|
+
value: modelName
|
|
343
|
+
}, modelName)));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// src/aip-agent-chat/AipAgentChat.tsx
|
|
347
|
+
var FALLBACK_MODEL_API_NAME = "gpt-4o";
|
|
348
|
+
function AipAgentChat({
|
|
349
|
+
client,
|
|
350
|
+
model: controlledModel,
|
|
351
|
+
defaultModel,
|
|
352
|
+
availableModels,
|
|
353
|
+
onModelChange,
|
|
354
|
+
system,
|
|
355
|
+
initialMessages,
|
|
356
|
+
className,
|
|
357
|
+
placeholder,
|
|
358
|
+
enableAutoScroll,
|
|
359
|
+
onError,
|
|
360
|
+
onFinish,
|
|
361
|
+
renderEmptyState,
|
|
362
|
+
renderMessage
|
|
363
|
+
}) {
|
|
364
|
+
const [internalModel, setInternalModel] = React6__namespace.useState(() => controlledModel ?? defaultModel ?? availableModels?.[0] ?? FALLBACK_MODEL_API_NAME);
|
|
365
|
+
const isControlled = controlledModel != null;
|
|
366
|
+
const activeModel = isControlled ? controlledModel : internalModel;
|
|
367
|
+
const handleModelChange = React6__namespace.useCallback((next) => {
|
|
368
|
+
if (!isControlled) {
|
|
369
|
+
setInternalModel(next);
|
|
370
|
+
}
|
|
371
|
+
onModelChange?.(next);
|
|
372
|
+
}, [isControlled, onModelChange]);
|
|
373
|
+
const model = React6__namespace.useMemo(() => aipCore.foundryModel({
|
|
374
|
+
client,
|
|
375
|
+
model: activeModel
|
|
376
|
+
}), [client, activeModel]);
|
|
377
|
+
const {
|
|
378
|
+
messages,
|
|
379
|
+
status,
|
|
380
|
+
error,
|
|
381
|
+
sendMessage,
|
|
382
|
+
stop,
|
|
383
|
+
clearError
|
|
384
|
+
} = aip.useChat({
|
|
385
|
+
model,
|
|
386
|
+
system,
|
|
387
|
+
messages: initialMessages,
|
|
388
|
+
onError,
|
|
389
|
+
onFinish
|
|
390
|
+
});
|
|
391
|
+
React6__namespace.useEffect(() => {
|
|
392
|
+
if (isControlled || availableModels == null || availableModels.length === 0) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (!availableModels.includes(internalModel)) {
|
|
396
|
+
setInternalModel(availableModels[0]);
|
|
397
|
+
}
|
|
398
|
+
}, [isControlled, availableModels, internalModel]);
|
|
399
|
+
const handleSendMessage = React6__namespace.useCallback((text) => {
|
|
400
|
+
return sendMessage({
|
|
401
|
+
text
|
|
402
|
+
});
|
|
403
|
+
}, [sendMessage]);
|
|
404
|
+
const isInFlight = status === "submitted" || status === "streaming";
|
|
405
|
+
const composerFooter = availableModels != null && availableModels.length > 0 ? /* @__PURE__ */ React6__namespace.createElement(AipAgentChatModelPicker, {
|
|
406
|
+
activeModel,
|
|
407
|
+
models: availableModels,
|
|
408
|
+
onModelChange: handleModelChange,
|
|
409
|
+
disabled: isInFlight
|
|
410
|
+
}) : void 0;
|
|
411
|
+
return /* @__PURE__ */ React6__namespace.createElement(BaseAipAgentChat, {
|
|
412
|
+
className,
|
|
413
|
+
composerFooter,
|
|
414
|
+
enableAutoScroll,
|
|
415
|
+
messages,
|
|
416
|
+
status,
|
|
417
|
+
error,
|
|
418
|
+
onClearError: clearError,
|
|
419
|
+
onSendMessage: handleSendMessage,
|
|
420
|
+
onStop: stop,
|
|
421
|
+
placeholder,
|
|
422
|
+
renderEmptyState,
|
|
423
|
+
renderMessage
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
Object.defineProperty(exports, "getUIMessageText", {
|
|
428
|
+
enumerable: true,
|
|
429
|
+
get: function () { return aipCore.getUIMessageText; }
|
|
430
|
+
});
|
|
431
|
+
exports.AipAgentChat = AipAgentChat;
|
|
432
|
+
exports.BaseAipAgentChat = BaseAipAgentChat;
|
|
433
|
+
//# sourceMappingURL=aip-agent-chat.cjs.map
|
|
434
|
+
//# sourceMappingURL=aip-agent-chat.cjs.map
|