@axiom-lattice/react-sdk 2.1.63 → 2.1.65

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.mjs CHANGED
@@ -18266,14 +18266,14 @@ var WorkspaceContextProvider = ({
18266
18266
  }
18267
18267
  }, [client, projectId, refreshProjects]);
18268
18268
  const listPath = useCallback24(
18269
- async (path = "/") => {
18269
+ async (path = "/", assistantId) => {
18270
18270
  if (!workspaceId || !projectId) {
18271
18271
  return [];
18272
18272
  }
18273
18273
  setLoading(true);
18274
18274
  setError(null);
18275
18275
  try {
18276
- const data = await client.listPath(workspaceId, projectId, path);
18276
+ const data = await client.listPath(workspaceId, projectId, path, assistantId);
18277
18277
  return data;
18278
18278
  } catch (e) {
18279
18279
  setError(e instanceof Error ? e.message : "Failed to load files");
@@ -18285,21 +18285,21 @@ var WorkspaceContextProvider = ({
18285
18285
  [client, workspaceId, projectId]
18286
18286
  );
18287
18287
  const listPathByFolder = useCallback24(
18288
- async (folder) => {
18289
- const normalizedPath = folder.startsWith("/") ? folder : `/${folder}`;
18290
- return listPath(normalizedPath);
18288
+ async (folder, assistantId) => {
18289
+ const normalizedPath = folder.startsWith("/") || folder.startsWith("~/") ? folder : `/${folder}`;
18290
+ return listPath(normalizedPath, assistantId);
18291
18291
  },
18292
18292
  [listPath]
18293
18293
  );
18294
18294
  const uploadFile = useCallback24(
18295
- async (path, file) => {
18295
+ async (path, file, assistantId) => {
18296
18296
  if (!workspaceId || !projectId) {
18297
18297
  throw new Error("Workspace and project must be selected before uploading files");
18298
18298
  }
18299
18299
  setLoading(true);
18300
18300
  setError(null);
18301
18301
  try {
18302
- const item = await client.uploadFile(workspaceId, projectId, file, path);
18302
+ const item = await client.uploadFile(workspaceId, projectId, file, path, assistantId);
18303
18303
  return item;
18304
18304
  } catch (e) {
18305
18305
  const errMsg = e instanceof Error ? e.message : "Failed to upload file";
@@ -18312,17 +18312,17 @@ var WorkspaceContextProvider = ({
18312
18312
  [client, workspaceId, projectId]
18313
18313
  );
18314
18314
  const uploadFileToFolder = useCallback24(
18315
- async (folder, file) => {
18316
- return uploadFile(folder, file);
18315
+ async (folder, file, assistantId) => {
18316
+ return uploadFile(folder, file, assistantId);
18317
18317
  },
18318
18318
  [uploadFile]
18319
18319
  );
18320
18320
  const getFileViewUrl = useCallback24(
18321
- (filePath) => {
18321
+ (filePath, assistantId) => {
18322
18322
  if (!workspaceId || !projectId) {
18323
18323
  return "";
18324
18324
  }
18325
- return client.getFileViewUrl(workspaceId, projectId, filePath);
18325
+ return client.getFileViewUrl(workspaceId, projectId, filePath, assistantId);
18326
18326
  },
18327
18327
  [client, workspaceId, projectId]
18328
18328
  );
@@ -20003,7 +20003,7 @@ var Chating = ({
20003
20003
  const folders = config.resourceFolders?.length ? config.resourceFolders : [{ name: "/", displayName: "Root Directory", allowUpload: true }];
20004
20004
  const allFilesPromises = folders.map(async (folder) => {
20005
20005
  try {
20006
- const files = await listPathByFolder(folder.name);
20006
+ const files = await listPathByFolder(folder.name, assistantId);
20007
20007
  return files.filter((f) => !f.is_dir);
20008
20008
  } catch (e) {
20009
20009
  console.error(`Failed to load files from folder ${folder.name}:`, e);
@@ -27373,6 +27373,7 @@ var ToolPanelFiles = () => {
27373
27373
  getFileViewUrl,
27374
27374
  uploadFileToFolder
27375
27375
  } = useWorkspaceContext();
27376
+ const { currentAssistant } = useAssistantContext();
27376
27377
  const [folderEntries, setFolderEntries] = useState65({});
27377
27378
  const [folderLoading, setFolderLoading] = useState65({});
27378
27379
  const [directoryChildren, setDirectoryChildren] = useState65({});
@@ -27390,7 +27391,7 @@ var ToolPanelFiles = () => {
27390
27391
  }
27391
27392
  setFolderLoading((prev) => ({ ...prev, [folder.name]: true }));
27392
27393
  try {
27393
- const items = await listPathByFolder(folder.name);
27394
+ const items = await listPathByFolder(folder.name, currentAssistant?.id);
27394
27395
  setFolderEntries((prev) => ({ ...prev, [folder.name]: items }));
27395
27396
  if (clearSubdirectoryCache) {
27396
27397
  const folderPath = folder.name === "/" ? "/" : folder.name.replace(/\/$/, "");
@@ -27420,7 +27421,7 @@ var ToolPanelFiles = () => {
27420
27421
  setFolderLoading((prev) => ({ ...prev, [folder.name]: false }));
27421
27422
  }
27422
27423
  },
27423
- [workspaceId, projectId, listPathByFolder]
27424
+ [workspaceId, projectId, listPathByFolder, currentAssistant?.id]
27424
27425
  );
27425
27426
  const handleToggleDirectory = useCallback32(async (path) => {
27426
27427
  const isExpanded = directoryExpanded[path] || false;
@@ -27431,7 +27432,7 @@ var ToolPanelFiles = () => {
27431
27432
  setDirectoryExpanded((prev) => ({ ...prev, [path]: true }));
27432
27433
  setDirectoryLoading((prev) => ({ ...prev, [path]: true }));
27433
27434
  try {
27434
- const items = await listPath(path);
27435
+ const items = await listPath(path, currentAssistant?.id);
27435
27436
  setDirectoryChildren((prev) => ({ ...prev, [path]: items }));
27436
27437
  } catch (error) {
27437
27438
  console.error(`Failed to load directory ${path}:`, error);
@@ -27439,14 +27440,14 @@ var ToolPanelFiles = () => {
27439
27440
  } finally {
27440
27441
  setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
27441
27442
  }
27442
- }, [directoryExpanded, listPath]);
27443
+ }, [directoryExpanded, listPath, currentAssistant?.id]);
27443
27444
  useEffect40(() => {
27444
27445
  resourceFolders.forEach((folder) => {
27445
27446
  void loadAssetsForFolder(folder, false);
27446
27447
  });
27447
27448
  }, [resourceFolders, loadAssetsForFolder]);
27448
27449
  const handleAssetClick = useCallback32((asset) => {
27449
- const fileUrl = getFileViewUrl(asset.path);
27450
+ const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
27450
27451
  if (!fileUrl) {
27451
27452
  message17.warning("Please select a workspace and project first.");
27452
27453
  return;
@@ -27460,7 +27461,7 @@ var ToolPanelFiles = () => {
27460
27461
  },
27461
27462
  message: `Preview: ${asset.name || asset.path}`
27462
27463
  });
27463
- }, [getFileViewUrl, openSideApp]);
27464
+ }, [getFileViewUrl, openSideApp, currentAssistant?.id]);
27464
27465
  const handleUploadFolder = useCallback32(async (folderName) => {
27465
27466
  if (!workspaceId || !projectId) {
27466
27467
  message17.warning("Please select a workspace and project before uploading.");
@@ -27476,7 +27477,7 @@ var ToolPanelFiles = () => {
27476
27477
  }
27477
27478
  setUploadingFolder(folderName);
27478
27479
  try {
27479
- await uploadFileToFolder(folderName, file);
27480
+ await uploadFileToFolder(folderName, file, currentAssistant?.id);
27480
27481
  message17.success(`Uploaded "${file.name}" successfully`);
27481
27482
  const folder = resourceFolders.find((item) => item.name === folderName);
27482
27483
  if (folder) {
@@ -27491,7 +27492,7 @@ var ToolPanelFiles = () => {
27491
27492
  }
27492
27493
  };
27493
27494
  input.click();
27494
- }, [workspaceId, projectId, uploadFileToFolder, resourceFolders, loadAssetsForFolder]);
27495
+ }, [workspaceId, projectId, uploadFileToFolder, resourceFolders, loadAssetsForFolder, currentAssistant?.id]);
27495
27496
  return /* @__PURE__ */ jsx106(
27496
27497
  FileDirectoryPanel,
27497
27498
  {