@axium/ai 0.1.0 → 0.1.2
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/common.js +4 -4
- package/dist/node/models.js +2 -1
- package/package.json +1 -1
package/dist/common.js
CHANGED
|
@@ -7,15 +7,15 @@ import * as memory from './memory.js';
|
|
|
7
7
|
export const ModelId = z
|
|
8
8
|
.string()
|
|
9
9
|
.max(64)
|
|
10
|
-
.regex(/^[a-z0-9]+(
|
|
10
|
+
.regex(/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/, 'Model IDs may only contain lowercase letters, numbers, and single dots or dashes between them');
|
|
11
11
|
/** Turns a display name into a model ID */
|
|
12
12
|
export function modelIdFrom(name) {
|
|
13
13
|
return name
|
|
14
14
|
.toLowerCase()
|
|
15
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
16
|
-
.replace(
|
|
15
|
+
.replace(/[^a-z0-9]+/g, separator => (separator == '.' ? '.' : '-'))
|
|
16
|
+
.replace(/^[.-]+|[.-]+$/g, '')
|
|
17
17
|
.slice(0, 64)
|
|
18
|
-
.replace(
|
|
18
|
+
.replace(/[.-]+$/, '');
|
|
19
19
|
}
|
|
20
20
|
/** A display name for a model from its repository, e.g. "Gemma 4 E4B" from "org/Gemma-4-E4B-GGUF" */
|
|
21
21
|
export function nameFromRepo(repo) {
|
package/dist/node/models.js
CHANGED
|
@@ -225,7 +225,8 @@ export function track({ model: name, event, data }) {
|
|
|
225
225
|
switch (event) {
|
|
226
226
|
case 'download_progress': {
|
|
227
227
|
const progress = { done: 0, total: 0 };
|
|
228
|
-
|
|
228
|
+
const files = data?.progress ?? {};
|
|
229
|
+
for (const file of Object.values(files)) {
|
|
229
230
|
progress.done += file.done;
|
|
230
231
|
progress.total += file.total;
|
|
231
232
|
}
|