@axiom-lattice/react-sdk 2.1.64 → 2.1.66
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 +31 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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,27 @@ var WorkspaceContextProvider = ({
|
|
|
18154
18154
|
[client, workspaceId, projectId]
|
|
18155
18155
|
);
|
|
18156
18156
|
const listPathByFolder = (0, import_react56.useCallback)(
|
|
18157
|
-
async (folder) => {
|
|
18158
|
-
|
|
18159
|
-
|
|
18157
|
+
async (folder, assistantId) => {
|
|
18158
|
+
let normalizedPath = folder;
|
|
18159
|
+
if (normalizedPath.startsWith("~/")) {
|
|
18160
|
+
normalizedPath = `/${normalizedPath.slice(2)}`;
|
|
18161
|
+
}
|
|
18162
|
+
if (!normalizedPath.startsWith("/")) {
|
|
18163
|
+
normalizedPath = `/${normalizedPath}`;
|
|
18164
|
+
}
|
|
18165
|
+
return listPath(normalizedPath, assistantId);
|
|
18160
18166
|
},
|
|
18161
18167
|
[listPath]
|
|
18162
18168
|
);
|
|
18163
18169
|
const uploadFile = (0, import_react56.useCallback)(
|
|
18164
|
-
async (path, file) => {
|
|
18170
|
+
async (path, file, assistantId) => {
|
|
18165
18171
|
if (!workspaceId || !projectId) {
|
|
18166
18172
|
throw new Error("Workspace and project must be selected before uploading files");
|
|
18167
18173
|
}
|
|
18168
18174
|
setLoading(true);
|
|
18169
18175
|
setError(null);
|
|
18170
18176
|
try {
|
|
18171
|
-
const item = await client.uploadFile(workspaceId, projectId, file, path);
|
|
18177
|
+
const item = await client.uploadFile(workspaceId, projectId, file, path, assistantId);
|
|
18172
18178
|
return item;
|
|
18173
18179
|
} catch (e) {
|
|
18174
18180
|
const errMsg = e instanceof Error ? e.message : "Failed to upload file";
|
|
@@ -18181,17 +18187,21 @@ var WorkspaceContextProvider = ({
|
|
|
18181
18187
|
[client, workspaceId, projectId]
|
|
18182
18188
|
);
|
|
18183
18189
|
const uploadFileToFolder = (0, import_react56.useCallback)(
|
|
18184
|
-
async (folder, file) => {
|
|
18185
|
-
|
|
18190
|
+
async (folder, file, assistantId) => {
|
|
18191
|
+
let normalizedFolder = folder;
|
|
18192
|
+
if (normalizedFolder.startsWith("~/")) {
|
|
18193
|
+
normalizedFolder = `/${normalizedFolder.slice(2)}`;
|
|
18194
|
+
}
|
|
18195
|
+
return uploadFile(normalizedFolder, file, assistantId);
|
|
18186
18196
|
},
|
|
18187
18197
|
[uploadFile]
|
|
18188
18198
|
);
|
|
18189
18199
|
const getFileViewUrl = (0, import_react56.useCallback)(
|
|
18190
|
-
(filePath) => {
|
|
18200
|
+
(filePath, assistantId) => {
|
|
18191
18201
|
if (!workspaceId || !projectId) {
|
|
18192
18202
|
return "";
|
|
18193
18203
|
}
|
|
18194
|
-
return client.getFileViewUrl(workspaceId, projectId, filePath);
|
|
18204
|
+
return client.getFileViewUrl(workspaceId, projectId, filePath, assistantId);
|
|
18195
18205
|
},
|
|
18196
18206
|
[client, workspaceId, projectId]
|
|
18197
18207
|
);
|
|
@@ -19850,7 +19860,7 @@ var Chating = ({
|
|
|
19850
19860
|
const folders = config.resourceFolders?.length ? config.resourceFolders : [{ name: "/", displayName: "Root Directory", allowUpload: true }];
|
|
19851
19861
|
const allFilesPromises = folders.map(async (folder) => {
|
|
19852
19862
|
try {
|
|
19853
|
-
const files = await listPathByFolder(folder.name);
|
|
19863
|
+
const files = await listPathByFolder(folder.name, assistantId);
|
|
19854
19864
|
return files.filter((f) => !f.is_dir);
|
|
19855
19865
|
} catch (e) {
|
|
19856
19866
|
console.error(`Failed to load files from folder ${folder.name}:`, e);
|
|
@@ -27145,6 +27155,7 @@ var ToolPanelFiles = () => {
|
|
|
27145
27155
|
getFileViewUrl,
|
|
27146
27156
|
uploadFileToFolder
|
|
27147
27157
|
} = useWorkspaceContext();
|
|
27158
|
+
const { currentAssistant } = useAssistantContext();
|
|
27148
27159
|
const [folderEntries, setFolderEntries] = (0, import_react82.useState)({});
|
|
27149
27160
|
const [folderLoading, setFolderLoading] = (0, import_react82.useState)({});
|
|
27150
27161
|
const [directoryChildren, setDirectoryChildren] = (0, import_react82.useState)({});
|
|
@@ -27162,7 +27173,7 @@ var ToolPanelFiles = () => {
|
|
|
27162
27173
|
}
|
|
27163
27174
|
setFolderLoading((prev) => ({ ...prev, [folder.name]: true }));
|
|
27164
27175
|
try {
|
|
27165
|
-
const items = await listPathByFolder(folder.name);
|
|
27176
|
+
const items = await listPathByFolder(folder.name, currentAssistant?.id);
|
|
27166
27177
|
setFolderEntries((prev) => ({ ...prev, [folder.name]: items }));
|
|
27167
27178
|
if (clearSubdirectoryCache) {
|
|
27168
27179
|
const folderPath = folder.name === "/" ? "/" : folder.name.replace(/\/$/, "");
|
|
@@ -27192,7 +27203,7 @@ var ToolPanelFiles = () => {
|
|
|
27192
27203
|
setFolderLoading((prev) => ({ ...prev, [folder.name]: false }));
|
|
27193
27204
|
}
|
|
27194
27205
|
},
|
|
27195
|
-
[workspaceId, projectId, listPathByFolder]
|
|
27206
|
+
[workspaceId, projectId, listPathByFolder, currentAssistant?.id]
|
|
27196
27207
|
);
|
|
27197
27208
|
const handleToggleDirectory = (0, import_react82.useCallback)(async (path) => {
|
|
27198
27209
|
const isExpanded = directoryExpanded[path] || false;
|
|
@@ -27203,7 +27214,7 @@ var ToolPanelFiles = () => {
|
|
|
27203
27214
|
setDirectoryExpanded((prev) => ({ ...prev, [path]: true }));
|
|
27204
27215
|
setDirectoryLoading((prev) => ({ ...prev, [path]: true }));
|
|
27205
27216
|
try {
|
|
27206
|
-
const items = await listPath(path);
|
|
27217
|
+
const items = await listPath(path, currentAssistant?.id);
|
|
27207
27218
|
setDirectoryChildren((prev) => ({ ...prev, [path]: items }));
|
|
27208
27219
|
} catch (error) {
|
|
27209
27220
|
console.error(`Failed to load directory ${path}:`, error);
|
|
@@ -27211,14 +27222,14 @@ var ToolPanelFiles = () => {
|
|
|
27211
27222
|
} finally {
|
|
27212
27223
|
setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
|
|
27213
27224
|
}
|
|
27214
|
-
}, [directoryExpanded, listPath]);
|
|
27225
|
+
}, [directoryExpanded, listPath, currentAssistant?.id]);
|
|
27215
27226
|
(0, import_react82.useEffect)(() => {
|
|
27216
27227
|
resourceFolders.forEach((folder) => {
|
|
27217
27228
|
void loadAssetsForFolder(folder, false);
|
|
27218
27229
|
});
|
|
27219
27230
|
}, [resourceFolders, loadAssetsForFolder]);
|
|
27220
27231
|
const handleAssetClick = (0, import_react82.useCallback)((asset) => {
|
|
27221
|
-
const fileUrl = getFileViewUrl(asset.path);
|
|
27232
|
+
const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
|
|
27222
27233
|
if (!fileUrl) {
|
|
27223
27234
|
import_antd81.message.warning("Please select a workspace and project first.");
|
|
27224
27235
|
return;
|
|
@@ -27232,7 +27243,7 @@ var ToolPanelFiles = () => {
|
|
|
27232
27243
|
},
|
|
27233
27244
|
message: `Preview: ${asset.name || asset.path}`
|
|
27234
27245
|
});
|
|
27235
|
-
}, [getFileViewUrl, openSideApp]);
|
|
27246
|
+
}, [getFileViewUrl, openSideApp, currentAssistant?.id]);
|
|
27236
27247
|
const handleUploadFolder = (0, import_react82.useCallback)(async (folderName) => {
|
|
27237
27248
|
if (!workspaceId || !projectId) {
|
|
27238
27249
|
import_antd81.message.warning("Please select a workspace and project before uploading.");
|
|
@@ -27248,7 +27259,7 @@ var ToolPanelFiles = () => {
|
|
|
27248
27259
|
}
|
|
27249
27260
|
setUploadingFolder(folderName);
|
|
27250
27261
|
try {
|
|
27251
|
-
await uploadFileToFolder(folderName, file);
|
|
27262
|
+
await uploadFileToFolder(folderName, file, currentAssistant?.id);
|
|
27252
27263
|
import_antd81.message.success(`Uploaded "${file.name}" successfully`);
|
|
27253
27264
|
const folder = resourceFolders.find((item) => item.name === folderName);
|
|
27254
27265
|
if (folder) {
|
|
@@ -27263,7 +27274,7 @@ var ToolPanelFiles = () => {
|
|
|
27263
27274
|
}
|
|
27264
27275
|
};
|
|
27265
27276
|
input.click();
|
|
27266
|
-
}, [workspaceId, projectId, uploadFileToFolder, resourceFolders, loadAssetsForFolder]);
|
|
27277
|
+
}, [workspaceId, projectId, uploadFileToFolder, resourceFolders, loadAssetsForFolder, currentAssistant?.id]);
|
|
27267
27278
|
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
27268
27279
|
FileDirectoryPanel,
|
|
27269
27280
|
{
|