@axiom-lattice/react-sdk 2.1.64 → 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.js CHANGED
@@ -18135,14 +18135,14 @@ var WorkspaceContextProvider = ({
18135
18135
  }
18136
18136
  }, [client, projectId, refreshProjects]);
18137
18137
  const listPath = (0, import_react56.useCallback)(
18138
- async (path = "/") => {
18138
+ async (path = "/", assistantId) => {
18139
18139
  if (!workspaceId || !projectId) {
18140
18140
  return [];
18141
18141
  }
18142
18142
  setLoading(true);
18143
18143
  setError(null);
18144
18144
  try {
18145
- const data = await client.listPath(workspaceId, projectId, path);
18145
+ const data = await client.listPath(workspaceId, projectId, path, assistantId);
18146
18146
  return data;
18147
18147
  } catch (e) {
18148
18148
  setError(e instanceof Error ? e.message : "Failed to load files");
@@ -18154,21 +18154,21 @@ var WorkspaceContextProvider = ({
18154
18154
  [client, workspaceId, projectId]
18155
18155
  );
18156
18156
  const listPathByFolder = (0, import_react56.useCallback)(
18157
- async (folder) => {
18157
+ async (folder, assistantId) => {
18158
18158
  const normalizedPath = folder.startsWith("/") || folder.startsWith("~/") ? folder : `/${folder}`;
18159
- return listPath(normalizedPath);
18159
+ return listPath(normalizedPath, assistantId);
18160
18160
  },
18161
18161
  [listPath]
18162
18162
  );
18163
18163
  const uploadFile = (0, import_react56.useCallback)(
18164
- async (path, file) => {
18164
+ async (path, file, assistantId) => {
18165
18165
  if (!workspaceId || !projectId) {
18166
18166
  throw new Error("Workspace and project must be selected before uploading files");
18167
18167
  }
18168
18168
  setLoading(true);
18169
18169
  setError(null);
18170
18170
  try {
18171
- const item = await client.uploadFile(workspaceId, projectId, file, path);
18171
+ const item = await client.uploadFile(workspaceId, projectId, file, path, assistantId);
18172
18172
  return item;
18173
18173
  } catch (e) {
18174
18174
  const errMsg = e instanceof Error ? e.message : "Failed to upload file";
@@ -18181,17 +18181,17 @@ var WorkspaceContextProvider = ({
18181
18181
  [client, workspaceId, projectId]
18182
18182
  );
18183
18183
  const uploadFileToFolder = (0, import_react56.useCallback)(
18184
- async (folder, file) => {
18185
- return uploadFile(folder, file);
18184
+ async (folder, file, assistantId) => {
18185
+ return uploadFile(folder, file, assistantId);
18186
18186
  },
18187
18187
  [uploadFile]
18188
18188
  );
18189
18189
  const getFileViewUrl = (0, import_react56.useCallback)(
18190
- (filePath) => {
18190
+ (filePath, assistantId) => {
18191
18191
  if (!workspaceId || !projectId) {
18192
18192
  return "";
18193
18193
  }
18194
- return client.getFileViewUrl(workspaceId, projectId, filePath);
18194
+ return client.getFileViewUrl(workspaceId, projectId, filePath, assistantId);
18195
18195
  },
18196
18196
  [client, workspaceId, projectId]
18197
18197
  );
@@ -19850,7 +19850,7 @@ var Chating = ({
19850
19850
  const folders = config.resourceFolders?.length ? config.resourceFolders : [{ name: "/", displayName: "Root Directory", allowUpload: true }];
19851
19851
  const allFilesPromises = folders.map(async (folder) => {
19852
19852
  try {
19853
- const files = await listPathByFolder(folder.name);
19853
+ const files = await listPathByFolder(folder.name, assistantId);
19854
19854
  return files.filter((f) => !f.is_dir);
19855
19855
  } catch (e) {
19856
19856
  console.error(`Failed to load files from folder ${folder.name}:`, e);
@@ -27145,6 +27145,7 @@ var ToolPanelFiles = () => {
27145
27145
  getFileViewUrl,
27146
27146
  uploadFileToFolder
27147
27147
  } = useWorkspaceContext();
27148
+ const { currentAssistant } = useAssistantContext();
27148
27149
  const [folderEntries, setFolderEntries] = (0, import_react82.useState)({});
27149
27150
  const [folderLoading, setFolderLoading] = (0, import_react82.useState)({});
27150
27151
  const [directoryChildren, setDirectoryChildren] = (0, import_react82.useState)({});
@@ -27162,7 +27163,7 @@ var ToolPanelFiles = () => {
27162
27163
  }
27163
27164
  setFolderLoading((prev) => ({ ...prev, [folder.name]: true }));
27164
27165
  try {
27165
- const items = await listPathByFolder(folder.name);
27166
+ const items = await listPathByFolder(folder.name, currentAssistant?.id);
27166
27167
  setFolderEntries((prev) => ({ ...prev, [folder.name]: items }));
27167
27168
  if (clearSubdirectoryCache) {
27168
27169
  const folderPath = folder.name === "/" ? "/" : folder.name.replace(/\/$/, "");
@@ -27192,7 +27193,7 @@ var ToolPanelFiles = () => {
27192
27193
  setFolderLoading((prev) => ({ ...prev, [folder.name]: false }));
27193
27194
  }
27194
27195
  },
27195
- [workspaceId, projectId, listPathByFolder]
27196
+ [workspaceId, projectId, listPathByFolder, currentAssistant?.id]
27196
27197
  );
27197
27198
  const handleToggleDirectory = (0, import_react82.useCallback)(async (path) => {
27198
27199
  const isExpanded = directoryExpanded[path] || false;
@@ -27203,7 +27204,7 @@ var ToolPanelFiles = () => {
27203
27204
  setDirectoryExpanded((prev) => ({ ...prev, [path]: true }));
27204
27205
  setDirectoryLoading((prev) => ({ ...prev, [path]: true }));
27205
27206
  try {
27206
- const items = await listPath(path);
27207
+ const items = await listPath(path, currentAssistant?.id);
27207
27208
  setDirectoryChildren((prev) => ({ ...prev, [path]: items }));
27208
27209
  } catch (error) {
27209
27210
  console.error(`Failed to load directory ${path}:`, error);
@@ -27211,14 +27212,14 @@ var ToolPanelFiles = () => {
27211
27212
  } finally {
27212
27213
  setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
27213
27214
  }
27214
- }, [directoryExpanded, listPath]);
27215
+ }, [directoryExpanded, listPath, currentAssistant?.id]);
27215
27216
  (0, import_react82.useEffect)(() => {
27216
27217
  resourceFolders.forEach((folder) => {
27217
27218
  void loadAssetsForFolder(folder, false);
27218
27219
  });
27219
27220
  }, [resourceFolders, loadAssetsForFolder]);
27220
27221
  const handleAssetClick = (0, import_react82.useCallback)((asset) => {
27221
- const fileUrl = getFileViewUrl(asset.path);
27222
+ const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
27222
27223
  if (!fileUrl) {
27223
27224
  import_antd81.message.warning("Please select a workspace and project first.");
27224
27225
  return;
@@ -27232,7 +27233,7 @@ var ToolPanelFiles = () => {
27232
27233
  },
27233
27234
  message: `Preview: ${asset.name || asset.path}`
27234
27235
  });
27235
- }, [getFileViewUrl, openSideApp]);
27236
+ }, [getFileViewUrl, openSideApp, currentAssistant?.id]);
27236
27237
  const handleUploadFolder = (0, import_react82.useCallback)(async (folderName) => {
27237
27238
  if (!workspaceId || !projectId) {
27238
27239
  import_antd81.message.warning("Please select a workspace and project before uploading.");
@@ -27248,7 +27249,7 @@ var ToolPanelFiles = () => {
27248
27249
  }
27249
27250
  setUploadingFolder(folderName);
27250
27251
  try {
27251
- await uploadFileToFolder(folderName, file);
27252
+ await uploadFileToFolder(folderName, file, currentAssistant?.id);
27252
27253
  import_antd81.message.success(`Uploaded "${file.name}" successfully`);
27253
27254
  const folder = resourceFolders.find((item) => item.name === folderName);
27254
27255
  if (folder) {
@@ -27263,7 +27264,7 @@ var ToolPanelFiles = () => {
27263
27264
  }
27264
27265
  };
27265
27266
  input.click();
27266
- }, [workspaceId, projectId, uploadFileToFolder, resourceFolders, loadAssetsForFolder]);
27267
+ }, [workspaceId, projectId, uploadFileToFolder, resourceFolders, loadAssetsForFolder, currentAssistant?.id]);
27267
27268
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
27268
27269
  FileDirectoryPanel,
27269
27270
  {