@kwirthmagnify/kwirth-common-ai 0.5.11 → 0.5.12

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.
Files changed (2) hide show
  1. package/dist/front.js +11 -2
  2. package/package.json +1 -1
package/dist/front.js CHANGED
@@ -37,8 +37,17 @@ exports.AiConfigProvider = exports.AiConfigLlm = exports.LlmSelector = void 0;
37
37
  const react_1 = __importStar(require("react"));
38
38
  const material_1 = require("@mui/material");
39
39
  const icons_material_1 = require("@mui/icons-material");
40
- const downloadJson = (data, filename) => {
41
- const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
40
+ const downloadJson = async (data, filename) => {
41
+ var _a, _b;
42
+ const json = JSON.stringify(data, null, 2);
43
+ const tauri = window.__TAURI__;
44
+ if (((_a = tauri === null || tauri === void 0 ? void 0 : tauri.dialog) === null || _a === void 0 ? void 0 : _a.save) && ((_b = tauri === null || tauri === void 0 ? void 0 : tauri.fs) === null || _b === void 0 ? void 0 : _b.writeTextFile)) {
45
+ const path = await tauri.dialog.save({ defaultPath: filename, filters: [{ name: 'JSON', extensions: ['json'] }] });
46
+ if (path)
47
+ await tauri.fs.writeTextFile(path, json);
48
+ return;
49
+ }
50
+ const blob = new Blob([json], { type: 'application/json' });
42
51
  const url = URL.createObjectURL(blob);
43
52
  const a = document.createElement('a');
44
53
  a.href = url;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-ai",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "Shared AI/LLM types and utilities for Kwirth AI plugins",
5
5
  "scripts": {
6
6
  "build": "del .\\dist\\* /s /q 2>nul & tsc"