@docyrus/ui-pro-ai-assistant 0.2.9 → 0.3.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.
@@ -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
  );
@@ -22954,6 +22972,8 @@ var AssistantView = ({ ref, ...props }) => {
22954
22972
  openCanvasView: handleOpenCanvasViewInline,
22955
22973
  renderThreadHeader,
22956
22974
  threadId: commonProps.threadId,
22975
+ initialModelId: commonProps.initialModelId,
22976
+ initialFeatures: commonProps.initialFeatures,
22957
22977
  compactToolbar: !isFullscreen
22958
22978
  }
22959
22979
  )
@@ -25232,6 +25252,8 @@ var DocyAssistant = ({
25232
25252
  supportMultiModels,
25233
25253
  deploymentId,
25234
25254
  tenantAiAgentId: activeAgentId,
25255
+ initialModelId,
25256
+ initialFeatures,
25235
25257
  enableMicrophone,
25236
25258
  enableVoice,
25237
25259
  isRecording,