@docyrus/ui-pro-ai-assistant 0.2.9 → 0.3.1

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.
@@ -44,6 +44,14 @@ interface AIInputAreaProps {
44
44
  threadId?: string;
45
45
  hasMessages?: boolean;
46
46
  tenantAiProjectId?: string;
47
+ initialModelId?: string;
48
+ initialFeatures?: {
49
+ webSearch?: boolean;
50
+ thinking?: boolean;
51
+ deepResearch?: boolean;
52
+ documentSearch?: boolean;
53
+ workCanvas?: boolean;
54
+ };
47
55
  }
48
56
  export declare const AIInputArea: FC<AIInputAreaProps>;
49
57
  export {};
package/dist/index.js CHANGED
@@ -3979,7 +3979,9 @@ var AIInputArea = ({
3979
3979
  compactToolbar = false,
3980
3980
  threadId,
3981
3981
  hasMessages = false,
3982
- tenantAiProjectId
3982
+ tenantAiProjectId,
3983
+ initialModelId,
3984
+ initialFeatures
3983
3985
  }) => {
3984
3986
  const { t } = useAssistantTranslation();
3985
3987
  const isBaseAgent = !deploymentId && !!tenantAiAgentId;
@@ -4004,11 +4006,21 @@ var AIInputArea = ({
4004
4006
  const effectiveSupportThinking = capabilities ? capabilities.supportThinking : supportThinking;
4005
4007
  const effectiveSupportDeepResearch = capabilities ? capabilities.supportDeepResearch : supportDeepResearch;
4006
4008
  const effectiveSupportWorkCanvas = capabilities ? capabilities.supportWorkCanvas : supportWorkCanvas;
4007
- const [webSearchActive, setWebSearchActive] = useState(false);
4008
- const [documentSearchActive, setDocumentSearchActive] = useState(false);
4009
- const [thinkingActive, setThinkingActive] = useState(false);
4010
- const [deepResearchActive, setDeepResearchActive] = useState(false);
4011
- const [workCanvasActive, setWorkCanvasActive] = useState(false);
4009
+ const [webSearchActive, setWebSearchActive] = useState(initialFeatures?.webSearch ?? false);
4010
+ const [documentSearchActive, setDocumentSearchActive] = useState(initialFeatures?.documentSearch ?? false);
4011
+ const [thinkingActive, setThinkingActive] = useState(initialFeatures?.thinking ?? false);
4012
+ const [deepResearchActive, setDeepResearchActive] = useState(initialFeatures?.deepResearch ?? false);
4013
+ const [workCanvasActive, setWorkCanvasActive] = useState(initialFeatures?.workCanvas ?? false);
4014
+ const initialModelAppliedRef = useRef(false);
4015
+ useEffect(() => {
4016
+ if (initialModelId && models.length > 0 && !initialModelAppliedRef.current) {
4017
+ const match = models.find((m) => m.id === initialModelId);
4018
+ if (match) {
4019
+ setSelectedModel(match);
4020
+ initialModelAppliedRef.current = true;
4021
+ }
4022
+ }
4023
+ }, [initialModelId, models, setSelectedModel]);
4012
4024
  const toggleActiveClass = "bg-primary/10 text-primary hover:bg-primary/20 ring-1 ring-primary/30";
4013
4025
  const [memoryExtractionOpen, setMemoryExtractionOpen] = useState(false);
4014
4026
  const [memoryExtractionLoading, setMemoryExtractionLoading] = useState(false);
@@ -7371,7 +7383,9 @@ function ChatPanel({
7371
7383
  renderThreadHeader,
7372
7384
  messagesClassName,
7373
7385
  compactToolbar,
7374
- threadId
7386
+ threadId,
7387
+ initialModelId,
7388
+ initialFeatures
7375
7389
  }) {
7376
7390
  return /* @__PURE__ */ jsxs(Fragment, { children: [
7377
7391
  renderThreadHeader?.(),
@@ -7419,7 +7433,9 @@ function ChatPanel({
7419
7433
  showToolbar: !compactToolbar,
7420
7434
  compactToolbar,
7421
7435
  threadId,
7422
- hasMessages: messages.length > 0
7436
+ hasMessages: messages.length > 0,
7437
+ initialModelId,
7438
+ initialFeatures
7423
7439
  }
7424
7440
  ) })
7425
7441
  ] });
@@ -22505,6 +22521,8 @@ var AssistantView = ({ ref, ...props }) => {
22505
22521
  onToolAction: commonProps2.onToolAction,
22506
22522
  openCanvasView: handleOpenCanvasView,
22507
22523
  threadId: commonProps2.threadId,
22524
+ initialModelId: commonProps2.initialModelId,
22525
+ initialFeatures: commonProps2.initialFeatures,
22508
22526
  messagesClassName: "p-4"
22509
22527
  }
22510
22528
  );
@@ -22653,7 +22671,10 @@ var AssistantView = ({ ref, ...props }) => {
22653
22671
  activeAgent?.name ?? commonProps.title ?? "Assistant"
22654
22672
  ] }) : null;
22655
22673
  return /* @__PURE__ */ jsxs(Fragment, { children: [
22656
- showHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between h-12 px-3 border-b shrink-0", children: [
22674
+ showHeader && /* @__PURE__ */ jsxs("div", { className: cn(
22675
+ "relative z-50 flex items-center justify-between h-12 px-3 border-b shrink-0 bg-background",
22676
+ !isSidebarOpen && enableSidebar && "ml-10"
22677
+ ), children: [
22657
22678
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
22658
22679
  enableNavDropdown && /* @__PURE__ */ jsxs(DropdownMenu$1, { children: [
22659
22680
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
@@ -22855,7 +22876,7 @@ var AssistantView = ({ ref, ...props }) => {
22855
22876
  /* @__PURE__ */ jsx("div", { className: cn(
22856
22877
  "flex flex-col min-h-0 overflow-hidden transition-all duration-200",
22857
22878
  canvasWork ? "w-2/5" : "flex-1",
22858
- !isSidebarOpen && enableSidebar && "pl-10"
22879
+ ""
22859
22880
  ), children: activeTab === 1 ? (
22860
22881
  // Sessions View
22861
22882
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 min-h-0 overflow-hidden", children: [
@@ -22954,6 +22975,8 @@ var AssistantView = ({ ref, ...props }) => {
22954
22975
  openCanvasView: handleOpenCanvasViewInline,
22955
22976
  renderThreadHeader,
22956
22977
  threadId: commonProps.threadId,
22978
+ initialModelId: commonProps.initialModelId,
22979
+ initialFeatures: commonProps.initialFeatures,
22957
22980
  compactToolbar: !isFullscreen
22958
22981
  }
22959
22982
  )
@@ -25232,6 +25255,8 @@ var DocyAssistant = ({
25232
25255
  supportMultiModels,
25233
25256
  deploymentId,
25234
25257
  tenantAiAgentId: activeAgentId,
25258
+ initialModelId,
25259
+ initialFeatures,
25235
25260
  enableMicrophone,
25236
25261
  enableVoice,
25237
25262
  isRecording,