@kwirthmagnify/kwirth-common-ai 0.5.49 → 0.5.50
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/front.js +23 -7
- package/package.json +1 -1
package/dist/front.js
CHANGED
|
@@ -32,11 +32,27 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.ToolSelector = exports.AiConfigProvider = exports.AiConfigLlm = exports.LlmSelector = void 0;
|
|
37
40
|
const react_1 = __importStar(require("react"));
|
|
38
41
|
const material_1 = require("@mui/material");
|
|
39
|
-
|
|
42
|
+
/*
|
|
43
|
+
DEEP IMPORTS A PROPOSITO, no es un descuido.
|
|
44
|
+
|
|
45
|
+
common-ai lo BUNDLEA el front (webpack), y '@mui/icons-material' es un barrel CommonJS que no se
|
|
46
|
+
puede tree-shakear: importar de la raiz se lleva los ~2000 iconos al bundle. Medido: pasar estas
|
|
47
|
+
cuatro lineas al barrel raiz engordo el main del front en 1,62 MB.
|
|
48
|
+
|
|
49
|
+
Por eso la regla de "nada de deep imports" es solo para PLUGINS —ahi rompe @emotion, que carga su
|
|
50
|
+
propia copia—, y common-front y common-ai son la excepcion documentada.
|
|
51
|
+
*/
|
|
52
|
+
const Download_1 = __importDefault(require("@mui/icons-material/Download"));
|
|
53
|
+
const FileUpload_1 = __importDefault(require("@mui/icons-material/FileUpload"));
|
|
54
|
+
const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
55
|
+
const VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
|
|
40
56
|
const downloadJson = async (data, filename) => {
|
|
41
57
|
var _a;
|
|
42
58
|
const json = JSON.stringify(data, null, 2);
|
|
@@ -161,7 +177,7 @@ const AiConfigLlm = (props) => {
|
|
|
161
177
|
react_1.default.createElement(material_1.Checkbox, { checked: useProviderKey, onChange: e => setUseProviderKey(e.target.checked) })),
|
|
162
178
|
react_1.default.createElement(material_1.TextField, { value: key, onChange: e => setKey(e.target.value), disabled: useProviderKey, label: 'API Key', placeholder: 'Enter API Key', variant: 'standard', fullWidth: true, type: showPassword ? 'text' : 'password', InputProps: {
|
|
163
179
|
endAdornment: (react_1.default.createElement(material_1.InputAdornment, { position: 'end' },
|
|
164
|
-
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(
|
|
180
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(VisibilityOff_1.default, null) : react_1.default.createElement(Visibility_1.default, null))))
|
|
165
181
|
} })),
|
|
166
182
|
react_1.default.createElement(material_1.Stack, { direction: 'row', spacing: 1 },
|
|
167
183
|
react_1.default.createElement(material_1.Button, { variant: 'outlined', size: 'small', onClick: onNew }, "New"),
|
|
@@ -182,8 +198,8 @@ const AiConfigLlm = (props) => {
|
|
|
182
198
|
reader.readAsText(f);
|
|
183
199
|
e.target.value = '';
|
|
184
200
|
} }),
|
|
185
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
186
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
201
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileUpload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importLlmRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
202
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(Download_1.default, { fontSize: 'small' }), onClick: () => downloadJson(llms, 'kwirth-llms.json') }, "Export"),
|
|
187
203
|
react_1.default.createElement(material_1.Box, { flex: 1 }),
|
|
188
204
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(llms), variant: 'contained' }, "OK"),
|
|
189
205
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined), color: 'inherit' }, "Cancel"))));
|
|
@@ -287,7 +303,7 @@ const AiConfigProvider = (props) => {
|
|
|
287
303
|
setProviderName(e.target.value); }, variant: 'standard', fullWidth: true }, props.providersAvailable.map(t => (react_1.default.createElement(material_1.MenuItem, { key: t, value: t }, t))))),
|
|
288
304
|
react_1.default.createElement(material_1.TextField, { label: 'API Key / Token', type: showPassword ? 'text' : 'password', variant: 'standard', fullWidth: true, value: providerKey, onChange: e => setProviderKey(e.target.value), helperText: 'This key can be afterwards linked to specific uses.', InputProps: {
|
|
289
305
|
endAdornment: (react_1.default.createElement(material_1.InputAdornment, { position: 'end' },
|
|
290
|
-
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(
|
|
306
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowPassword(!showPassword), edge: 'end' }, showPassword ? react_1.default.createElement(VisibilityOff_1.default, null) : react_1.default.createElement(Visibility_1.default, null))))
|
|
291
307
|
} }),
|
|
292
308
|
providerType === 'openai-compat' && (react_1.default.createElement(material_1.TextField, { label: 'Base URL', variant: 'standard', fullWidth: true, placeholder: 'https://your-maas-host/v1', value: providerEndpoint, onChange: e => setProviderEndpoint(e.target.value), helperText: 'OpenAI-compatible API base URL (e.g. Huawei MaaS, vLLM, LM Studio\u2026)' })),
|
|
293
309
|
react_1.default.createElement(material_1.Box, { sx: { flexGrow: 1 } }),
|
|
@@ -311,8 +327,8 @@ const AiConfigProvider = (props) => {
|
|
|
311
327
|
reader.readAsText(f);
|
|
312
328
|
e.target.value = '';
|
|
313
329
|
} }),
|
|
314
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
315
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(
|
|
330
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileUpload_1.default, { fontSize: 'small' }), onClick: () => { var _a; return (_a = importProvRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }, "Import"),
|
|
331
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(Download_1.default, { fontSize: 'small' }), onClick: () => downloadJson(providers.map(p => { var _a; return (Object.assign({ name: p.name, type: (_a = p.type) !== null && _a !== void 0 ? _a : p.name, key: p.key }, (p.endpoint ? { endpoint: p.endpoint } : {}))); }), 'kwirth-providers.json') }, "Export"),
|
|
316
332
|
react_1.default.createElement(material_1.Box, { flex: 1 }),
|
|
317
333
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(providers), color: 'primary', variant: 'contained' }, "Save"),
|
|
318
334
|
react_1.default.createElement(material_1.Button, { onClick: () => props.onClose(undefined), color: 'inherit' }, "Cancel"))));
|