Skip to content

Commit

Permalink
Pass selected folder to backend when searching for models.
Browse files Browse the repository at this point in the history
  • Loading branch information
dadmobile committed May 27, 2024
1 parent 61d74d3 commit 702efc5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/renderer/components/ModelZoo/ImportModelsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export default function ModelDetails({}) {
<Button
size="sm"
sx={{ height: '30px' }}
disabled={process.env.NODE_ENV != "development"}
endDecorator={<PlusIcon />}
onClick={() => {
setImportModelsModalOpen(true);
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/components/ModelZoo/ImportModelsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ const fetcher = (url) => fetch(url).then((res) => res.json());

export default function ImportModelsModal({ open, setOpen}) {
const [importing, setImporting] = useState(false);
const [modelFolder, setModelFolder] = useState(null); // Disabled folder support
const [modelFolder, setModelFolder] = useState("");

const {
data: modelsData,
error: modelsError,
isLoading: isLoading,
} = useSWR(
chatAPI.Endpoints.Models.GetLocalUninstalled(),
chatAPI.Endpoints.Models.SearchForLocalUninstalledModels(modelFolder),
fetcher
);
const models = modelsData?.data;
Expand Down Expand Up @@ -166,12 +166,12 @@ export default function ImportModelsModal({ open, setOpen}) {
const webkitRelativePath = firstfile.webkitRelativePath;
const parentPath = firstfilepath.slice(0, -1*webkitRelativePath.length);
const topRelativePathDir = webkitRelativePath.split('/')[0];
const fullPath = parentPath + '/' + topRelativePathDir;
const fullPath = parentPath + topRelativePathDir;
console.log(firstfile);
console.log(webkitRelativePath);
setModelFolder(fullPath);
} else {
setModelFolder(null);
setModelFolder("");
}
}}
/>
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/lib/transformerlab-api-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ Endpoints.Models = {
API_URL() + 'model/details/' + convertSlashInUrl(modelId),
GetLocalHFConfig: (modelId: string) =>
API_URL() + 'model/get_local_hfconfig?model_id=' + modelId,
GetLocalUninstalled: () => API_URL() + 'model/list_local_uninstalled',
SearchForLocalUninstalledModels: (path: string) =>
API_URL() + 'model/list_local_uninstalled?path=' + path,
ImportLocal: (modelSource: string, modelId: string) =>
API_URL() +
'model/import_local?model_source=' +
Expand Down

0 comments on commit 702efc5

Please sign in to comment.