Skip to content

Commit

Permalink
Merge pull request #116 from zamm-dev/mac-import
Browse files Browse the repository at this point in the history
Fix import file filter on Mac OS
  • Loading branch information
amosjyng authored Aug 17, 2024
2 parents e5a7a8e + cbc40f9 commit 2cbd1ce
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src-svelte/src/routes/settings/Database.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import InfoBox from "$lib/InfoBox.svelte";
import { importDb, exportDb, type DatabaseCounts } from "$lib/bindings";
import { snackbarInfo, snackbarError } from "$lib/snackbar/Snackbar.svelte";
import { systemInfo } from "$lib/system-info";
import Button from "$lib/controls/Button.svelte";
import ButtonGroup from "$lib/controls/ButtonGroup.svelte";
import Warning from "$lib/Warning.svelte";
Expand All @@ -12,6 +13,11 @@
extensions: ["zamm.yaml"],
};
const MAC_ZAMM_DB_FILTER: DialogFilter = {
name: "ZAMM Database",
extensions: ["yaml"],
};
function nounify(counts: DatabaseCounts): string {
let noun: string;
if (counts.num_api_keys > 0 && counts.num_llm_calls === 0) {
Expand All @@ -28,13 +34,18 @@
}
async function importData() {
const defaultImportFilter =
$systemInfo?.os === "Mac" ? MAC_ZAMM_DB_FILTER : ZAMM_DB_FILTER;
const filePath =
window.WEBDRIVER_FILE_PATH ??
(await open({
title: "Import ZAMM data",
directory: false,
multiple: false,
filters: [ZAMM_DB_FILTER, { name: "All Files", extensions: ["*"] }],
filters: [
defaultImportFilter,
{ name: "All Files", extensions: ["*"] },
],
}));
if (filePath === null) {
return;
Expand Down

0 comments on commit 2cbd1ce

Please sign in to comment.