@superinterface/react 2.22.4 → 2.23.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.
package/dist/index.cjs CHANGED
@@ -391,6 +391,9 @@ __export(src_exports, {
391
391
  AssistantNameContext: function() {
392
392
  return AssistantNameContext;
393
393
  },
394
+ AssistantProvider: function() {
395
+ return AssistantProvider;
396
+ },
394
397
  AudioThread: function() {
395
398
  return AudioThread;
396
399
  },
@@ -5332,10 +5335,82 @@ var ComponentsProvider = function(_param) {
5332
5335
  children: children
5333
5336
  });
5334
5337
  };
5338
+ // src/components/assistants/AssistantProvider/index.tsx
5339
+ var import_react61 = require("react");
5340
+ var import_themes59 = require("@radix-ui/themes");
5341
+ // src/components/assistants/AssistantProvider/Code.tsx
5342
+ var import_react60 = require("react");
5343
+ var import_jsx_runtime87 = require("react/jsx-runtime");
5344
+ var Code4 = function(param) {
5345
+ var children = param.children, className = param.className, markdownContext = param.markdownContext;
5346
+ var messageContext = useMessageContext();
5347
+ var isAssistantMessage = (0, import_react60.useMemo)(function() {
5348
+ var _messageContext_message;
5349
+ return ((_messageContext_message = messageContext.message) === null || _messageContext_message === void 0 ? void 0 : _messageContext_message.role) === "assistant";
5350
+ }, [
5351
+ messageContext
5352
+ ]);
5353
+ if (!isAssistantMessage || className !== "language-suggestions") {
5354
+ return markdownContext.components.code({
5355
+ children: children,
5356
+ className: className
5357
+ });
5358
+ }
5359
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Suggestions, {
5360
+ children: children
5361
+ });
5362
+ };
5363
+ // src/components/assistants/AssistantProvider/index.tsx
5364
+ var import_jsx_runtime88 = // @ts-ignore-next-line
5365
+ require("react/jsx-runtime");
5366
+ var AssistantProvider = function(param) {
5367
+ var children = param.children;
5368
+ var superinterfaceContext = useSuperinterfaceContext();
5369
+ var assistant = useAssistant({
5370
+ assistantId: superinterfaceContext.variables.assistantId
5371
+ }).assistant;
5372
+ var markdownContext = useMarkdownContext();
5373
+ var components2 = (0, import_react61.useMemo)(function() {
5374
+ return {
5375
+ code: function(props) {
5376
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Code4, _object_spread_props(_object_spread({}, props), {
5377
+ markdownContext: markdownContext
5378
+ }));
5379
+ }
5380
+ };
5381
+ }, [
5382
+ markdownContext
5383
+ ]);
5384
+ if (!assistant) {
5385
+ return null;
5386
+ }
5387
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_themes59.Theme, {
5388
+ accentColor: assistant.theme.accentColor,
5389
+ grayColor: assistant.theme.grayColor,
5390
+ radius: assistant.theme.radius,
5391
+ appearance: assistant.theme.appearance,
5392
+ scaling: assistant.theme.scaling,
5393
+ panelBackground: "solid",
5394
+ hasBackground: false,
5395
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(AssistantNameContext.Provider, {
5396
+ value: assistant.name,
5397
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(AssistantAvatarContext.Provider, {
5398
+ value: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Avatar6, {
5399
+ avatar: assistant.avatar
5400
+ }),
5401
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(MarkdownProvider, {
5402
+ components: components2,
5403
+ children: children
5404
+ })
5405
+ })
5406
+ })
5407
+ });
5408
+ };
5335
5409
  // Annotate the CommonJS export names for ESM import in node:
5336
5410
  0 && (module.exports = {
5337
5411
  AssistantAvatarContext: AssistantAvatarContext,
5338
5412
  AssistantNameContext: AssistantNameContext,
5413
+ AssistantProvider: AssistantProvider,
5339
5414
  AudioThread: AudioThread,
5340
5415
  AudioThreadDialog: AudioThreadDialog,
5341
5416
  Avatar: Avatar,