@docyrus/ui-pro-ai-assistant 0.8.7 → 0.8.8

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.
@@ -24,6 +24,8 @@ export interface UseDeploymentDataResult {
24
24
  toggleMcpServer: (id: string, active: boolean) => void;
25
25
  capabilities: AgentCapabilities | null;
26
26
  promptOptimizationChoice: string | null;
27
+ /** Agent's configured default reasoning level id (from the agent editor). */
28
+ defaultReasoningLevel: string | null;
27
29
  isLoading: boolean;
28
30
  error: Error | null;
29
31
  }
package/dist/index.js CHANGED
@@ -4628,6 +4628,7 @@ function useDeploymentData(deploymentIdOrAgentId, supportMultiModels = false, is
4628
4628
  const [selectedAgent, setSelectedAgent] = useState(null);
4629
4629
  const [capabilities, setCapabilities] = useState(null);
4630
4630
  const [promptOptimizationChoice, setPromptOptimizationChoice] = useState(null);
4631
+ const [defaultReasoningLevel, setDefaultReasoningLevel] = useState(null);
4631
4632
  const [isLoading, setIsLoading] = useState(false);
4632
4633
  const [error, setError] = useState(null);
4633
4634
  useEffect(() => {
@@ -4672,6 +4673,7 @@ function useDeploymentData(deploymentIdOrAgentId, supportMultiModels = false, is
4672
4673
  supportMultiModels: agentData.agent.supportMultipleModels ?? supportMultiModels
4673
4674
  });
4674
4675
  setPromptOptimizationChoice(agentData.agent.promptOptimizationChoice ?? null);
4676
+ setDefaultReasoningLevel(agentData.agent.defaultReasoningLevel ?? null);
4675
4677
  }
4676
4678
  }
4677
4679
  } catch (err) {
@@ -4705,6 +4707,7 @@ function useDeploymentData(deploymentIdOrAgentId, supportMultiModels = false, is
4705
4707
  toggleMcpServer,
4706
4708
  capabilities,
4707
4709
  promptOptimizationChoice,
4710
+ defaultReasoningLevel,
4708
4711
  isLoading,
4709
4712
  error
4710
4713
  };
@@ -5958,7 +5961,8 @@ var AIInputArea = ({
5958
5961
  activeMcpServers,
5959
5962
  toggleMcpServer,
5960
5963
  capabilities,
5961
- promptOptimizationChoice
5964
+ promptOptimizationChoice,
5965
+ defaultReasoningLevel
5962
5966
  } = useDeploymentData(idToUse, supportMultiModels, isBaseAgent);
5963
5967
  const effectiveSupportWebSearch = capabilities ? capabilities.supportWebSearch : supportWebSearch;
5964
5968
  const effectiveSupportDocumentSearch = capabilities ? capabilities.supportDocumentSearch : supportDocumentSearch;
@@ -6003,10 +6007,19 @@ var AIInputArea = ({
6003
6007
  const [deepResearchActive, setDeepResearchActive] = useState(initialFeatures?.deepResearch ?? false);
6004
6008
  const [workCanvasActive, setWorkCanvasActive] = useState(initialFeatures?.workCanvas ?? false);
6005
6009
  const [reasoningOverride, setReasoningOverride] = useState(null);
6006
- const reasoningLevels = selectedModel?.reasoningLevels ?? [];
6007
- const activeOverrideId = reasoningOverride && reasoningOverride.modelId === selectedModel?.id ? reasoningOverride.id : null;
6008
- const overrideLevel = activeOverrideId ? reasoningLevels.find((level) => level.id === activeOverrideId) : void 0;
6009
- const selectedReasoningLevel = reasoningLevels.length === 0 ? null : overrideLevel ?? reasoningLevels.find((level) => level.default) ?? reasoningLevels[0];
6010
+ const reasoningLevels = useMemo(() => selectedModel?.reasoningLevels ?? [], [selectedModel?.reasoningLevels]);
6011
+ const selectedReasoningLevel = useMemo(() => {
6012
+ if (reasoningLevels.length === 0) return null;
6013
+ const activeOverrideId = reasoningOverride && reasoningOverride.modelId === selectedModel?.id ? reasoningOverride.id : null;
6014
+ const overrideLevel = activeOverrideId ? reasoningLevels.find((level) => level.id === activeOverrideId) : void 0;
6015
+ const agentDefault = defaultReasoningLevel ? reasoningLevels.find((level) => level.id === defaultReasoningLevel) : void 0;
6016
+ return overrideLevel ?? agentDefault ?? reasoningLevels.find((level) => level.default) ?? reasoningLevels[0];
6017
+ }, [
6018
+ reasoningLevels,
6019
+ reasoningOverride,
6020
+ selectedModel?.id,
6021
+ defaultReasoningLevel
6022
+ ]);
6010
6023
  const initialModelAppliedRef = useRef(false);
6011
6024
  useEffect(() => {
6012
6025
  if (initialModelId && models.length > 0 && !initialModelAppliedRef.current) {
@@ -6199,7 +6212,7 @@ var AIInputArea = ({
6199
6212
  thinkingActive,
6200
6213
  effectiveSupportWorkCanvas,
6201
6214
  workCanvasActive,
6202
- selectedReasoningLevel?.id,
6215
+ selectedReasoningLevel,
6203
6216
  activeMcpServers
6204
6217
  ]);
6205
6218
  const status = isLoading ? "streaming" : "ready";