@docyrus/ui-pro-ai-assistant 0.2.0 → 0.2.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.
package/dist/index.js CHANGED
@@ -2582,15 +2582,21 @@ function useAssistantApi({
2582
2582
  expand: "created_by",
2583
2583
  orderBy: JSON.stringify({ field: "created_on", direction: "desc" })
2584
2584
  };
2585
- apiParams.filters = JSON.stringify({
2586
- rules: [
2587
- {
2588
- field: "tenant_ai_agent_id",
2589
- operator: "=",
2590
- value: tenantAiAgentId
2591
- }
2592
- ]
2593
- });
2585
+ const rules = [
2586
+ {
2587
+ field: "tenant_ai_agent_id",
2588
+ operator: "=",
2589
+ value: tenantAiAgentId
2590
+ }
2591
+ ];
2592
+ if (configUser?.id) {
2593
+ rules.push({
2594
+ field: "created_by",
2595
+ operator: "=",
2596
+ value: configUser.id
2597
+ });
2598
+ }
2599
+ apiParams.filters = JSON.stringify({ rules });
2594
2600
  const response = await apiClient.get("/apps/base/data-sources/thread/items", apiParams);
2595
2601
  if (response.success && response.data) {
2596
2602
  const items2 = Array.isArray(response.data) ? response.data : response.data.items || [];
@@ -2608,7 +2614,7 @@ function useAssistantApi({
2608
2614
  console.error("Failed to fetch threads:", error);
2609
2615
  return [];
2610
2616
  }
2611
- }, [apiClient, tenantAiAgentId]);
2617
+ }, [apiClient, tenantAiAgentId, configUser?.id]);
2612
2618
  const fetchProjectThreads2 = useCallback(async (projectId) => {
2613
2619
  try {
2614
2620
  const apiParams = {
@@ -2616,15 +2622,21 @@ function useAssistantApi({
2616
2622
  expand: "created_by",
2617
2623
  orderBy: JSON.stringify({ field: "created_on", direction: "desc" })
2618
2624
  };
2619
- apiParams.filters = JSON.stringify({
2620
- rules: [
2621
- {
2622
- field: "tenant_ai_project_id",
2623
- operator: "=",
2624
- value: projectId
2625
- }
2626
- ]
2627
- });
2625
+ const rules = [
2626
+ {
2627
+ field: "tenant_ai_project_id",
2628
+ operator: "=",
2629
+ value: projectId
2630
+ }
2631
+ ];
2632
+ if (configUser?.id) {
2633
+ rules.push({
2634
+ field: "created_by",
2635
+ operator: "=",
2636
+ value: configUser.id
2637
+ });
2638
+ }
2639
+ apiParams.filters = JSON.stringify({ rules });
2628
2640
  const response = await apiClient.get("/apps/base/data-sources/thread/items", apiParams);
2629
2641
  if (response.success && response.data) {
2630
2642
  const items2 = Array.isArray(response.data) ? response.data : response.data.items || [];
@@ -2642,7 +2654,7 @@ function useAssistantApi({
2642
2654
  console.error("Failed to fetch project threads:", error);
2643
2655
  return [];
2644
2656
  }
2645
- }, [apiClient]);
2657
+ }, [apiClient, configUser?.id]);
2646
2658
  const loadThreadMessages2 = useCallback(async (threadId) => {
2647
2659
  try {
2648
2660
  const response = await apiClient.get("/apps/base/data-sources/message/items", {
@@ -22470,7 +22482,7 @@ var AssistantView = ({ ref, ...props }) => {
22470
22482
  variant: "ghost",
22471
22483
  className: "h-8 px-2 gap-1.5 text-sm font-medium text-foreground hover:bg-accent rounded-md max-w-[260px]",
22472
22484
  children: [
22473
- (activeAgent?.avatar || commonProps.logo) && /* @__PURE__ */ jsxs(Avatar$1, { className: "w-5 h-5 shrink-0", children: [
22485
+ (activeAgent?.avatar || commonProps.logo) && /* @__PURE__ */ jsxs(Avatar$1, { className: "w-5 h-5 shrink-0 after:border-0", children: [
22474
22486
  /* @__PURE__ */ jsx(AvatarImage$1, { src: activeAgent?.avatar || commonProps.logo, alt: activeAgent?.name ?? commonProps.title ?? "Assistant" }),
22475
22487
  /* @__PURE__ */ jsx(AvatarFallback$1, { className: "text-[10px]", children: (activeAgent?.name ?? commonProps.title ?? "A").slice(0, 2).toUpperCase() })
22476
22488
  ] }),