@ottocode/web-sdk 0.1.256 → 0.1.257
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/components/chat/ChatInput.d.ts.map +1 -1
- package/dist/components/file-browser/FileBrowserSidebar.d.ts.map +1 -1
- package/dist/components/index.js +27 -12
- package/dist/components/index.js.map +8 -8
- package/dist/hooks/index.js +13 -4
- package/dist/hooks/index.js.map +5 -5
- package/dist/hooks/useFileBrowser.d.ts +3 -0
- package/dist/hooks/useFileBrowser.d.ts.map +1 -1
- package/dist/hooks/useFiles.d.ts +4 -1
- package/dist/hooks/useFiles.d.ts.map +1 -1
- package/dist/index.js +27 -12
- package/dist/index.js.map +8 -8
- package/dist/lib/api-client/files.d.ts +12 -0
- package/dist/lib/api-client/files.d.ts.map +1 -1
- package/dist/lib/api-client/index.d.ts +12 -0
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/index.js +9 -1
- package/dist/lib/index.js.map +4 -4
- package/package.json +3 -3
package/dist/hooks/index.js
CHANGED
|
@@ -422,6 +422,7 @@ var configMixin = {
|
|
|
422
422
|
// src/lib/api-client/files.ts
|
|
423
423
|
import {
|
|
424
424
|
listFiles as apiListFiles,
|
|
425
|
+
searchFiles as apiSearchFiles,
|
|
425
426
|
getFileTree as apiGetFileTree,
|
|
426
427
|
readFile as apiReadFile,
|
|
427
428
|
getSessionFiles as apiGetSessionFiles
|
|
@@ -433,6 +434,12 @@ var filesMixin = {
|
|
|
433
434
|
throw new Error(extractErrorMessage(response.error));
|
|
434
435
|
return response.data;
|
|
435
436
|
},
|
|
437
|
+
async searchFiles(query = "") {
|
|
438
|
+
const response = await apiSearchFiles({ query: { q: query } });
|
|
439
|
+
if (response.error)
|
|
440
|
+
throw new Error(extractErrorMessage(response.error));
|
|
441
|
+
return response.data;
|
|
442
|
+
},
|
|
436
443
|
async getFileTree(dirPath = ".") {
|
|
437
444
|
const response = await apiGetFileTree({
|
|
438
445
|
query: { path: dirPath }
|
|
@@ -899,6 +906,7 @@ class ApiClient {
|
|
|
899
906
|
deleteProviderSettings = configMixin.deleteProviderSettings;
|
|
900
907
|
updateDefaults = configMixin.updateDefaults;
|
|
901
908
|
listFiles = filesMixin.listFiles;
|
|
909
|
+
searchFiles = filesMixin.searchFiles;
|
|
902
910
|
getFileTree = filesMixin.getFileTree;
|
|
903
911
|
readFileContent = filesMixin.readFileContent;
|
|
904
912
|
getSessionFiles = filesMixin.getSessionFiles;
|
|
@@ -1108,13 +1116,14 @@ function usePreferences() {
|
|
|
1108
1116
|
}
|
|
1109
1117
|
// src/hooks/useFiles.ts
|
|
1110
1118
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
1111
|
-
function useFiles() {
|
|
1119
|
+
function useFiles(options = {}) {
|
|
1112
1120
|
return useQuery2({
|
|
1113
|
-
queryKey: ["files"],
|
|
1121
|
+
queryKey: ["files", options.query ?? ""],
|
|
1114
1122
|
queryFn: async () => {
|
|
1115
|
-
const result = await apiClient.
|
|
1123
|
+
const result = await apiClient.searchFiles(options.query ?? "");
|
|
1116
1124
|
return result;
|
|
1117
1125
|
},
|
|
1126
|
+
enabled: options.enabled ?? true,
|
|
1118
1127
|
staleTime: 1e4,
|
|
1119
1128
|
refetchOnWindowFocus: true,
|
|
1120
1129
|
retry: 1
|
|
@@ -5188,4 +5197,4 @@ export {
|
|
|
5188
5197
|
sessionsQueryKey
|
|
5189
5198
|
};
|
|
5190
5199
|
|
|
5191
|
-
//# debugId=
|
|
5200
|
+
//# debugId=02311377E35A942C64756E2164756E21
|