@docyrus/ui-pro-ai-assistant 0.2.0 → 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 +17 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +9 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2593,7 +2593,13 @@ function useAssistantApi({
|
|
|
2593
2593
|
});
|
|
2594
2594
|
const response = await apiClient.get("/apps/base/data-sources/thread/items", apiParams);
|
|
2595
2595
|
if (response.success && response.data) {
|
|
2596
|
-
|
|
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
|
+
}
|
|
2597
2603
|
return items2.map((item) => ({
|
|
2598
2604
|
id: item.id,
|
|
2599
2605
|
title: item.subject,
|
|
@@ -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 = {
|
|
@@ -2627,7 +2633,13 @@ function useAssistantApi({
|
|
|
2627
2633
|
});
|
|
2628
2634
|
const response = await apiClient.get("/apps/base/data-sources/thread/items", apiParams);
|
|
2629
2635
|
if (response.success && response.data) {
|
|
2630
|
-
|
|
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
|
+
}
|
|
2631
2643
|
return items2.map((item) => ({
|
|
2632
2644
|
id: item.id,
|
|
2633
2645
|
title: item.subject,
|
|
@@ -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
|
] }),
|