@docyrus/ui-pro-ai-assistant 0.2.1 → 0.2.2

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,24 +2582,24 @@ function useAssistantApi({
2582
2582
  expand: "created_by",
2583
2583
  orderBy: JSON.stringify({ field: "created_on", direction: "desc" })
2584
2584
  };
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 });
2585
+ apiParams.filters = JSON.stringify({
2586
+ rules: [
2587
+ {
2588
+ field: "tenant_ai_agent_id",
2589
+ operator: "=",
2590
+ value: tenantAiAgentId
2591
+ }
2592
+ ]
2593
+ });
2600
2594
  const response = await apiClient.get("/apps/base/data-sources/thread/items", apiParams);
2601
2595
  if (response.success && response.data) {
2602
- const items2 = Array.isArray(response.data) ? response.data : response.data.items || [];
2596
+ let items2 = Array.isArray(response.data) ? response.data : response.data.items || [];
2597
+ if (configUser?.id) {
2598
+ items2 = items2.filter((item) => {
2599
+ const createdById = typeof item.created_by === "object" ? item.created_by?.id : item.created_by;
2600
+ return createdById === configUser.id;
2601
+ });
2602
+ }
2603
2603
  return items2.map((item) => ({
2604
2604
  id: item.id,
2605
2605
  title: item.subject,
@@ -2622,24 +2622,24 @@ function useAssistantApi({
2622
2622
  expand: "created_by",
2623
2623
  orderBy: JSON.stringify({ field: "created_on", direction: "desc" })
2624
2624
  };
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 });
2625
+ apiParams.filters = JSON.stringify({
2626
+ rules: [
2627
+ {
2628
+ field: "tenant_ai_project_id",
2629
+ operator: "=",
2630
+ value: projectId
2631
+ }
2632
+ ]
2633
+ });
2640
2634
  const response = await apiClient.get("/apps/base/data-sources/thread/items", apiParams);
2641
2635
  if (response.success && response.data) {
2642
- const items2 = Array.isArray(response.data) ? response.data : response.data.items || [];
2636
+ let items2 = Array.isArray(response.data) ? response.data : response.data.items || [];
2637
+ if (configUser?.id) {
2638
+ items2 = items2.filter((item) => {
2639
+ const createdById = typeof item.created_by === "object" ? item.created_by?.id : item.created_by;
2640
+ return createdById === configUser.id;
2641
+ });
2642
+ }
2643
2643
  return items2.map((item) => ({
2644
2644
  id: item.id,
2645
2645
  title: item.subject,