@aria-framework/ai 0.19.0 → 0.21.0
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/package.json +1 -1
- package/usageStore.js +4 -1
- package/views/ai/job-card.ejs +14 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aria-framework/ai",
|
|
3
3
|
"description": "Aria App Framework — AI module. A dependency-injected model seam (createAiClient) over several providers (LM Studio / OpenAI-compatible / Anthropic), with a fact-preservation guard, generic Polish and Generate writing engines, and a browser polish widget. Prompts and config stay in the consuming app.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.21.0",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
package/usageStore.js
CHANGED
|
@@ -114,7 +114,10 @@ function createUsageStore(opts = {}) {
|
|
|
114
114
|
|
|
115
115
|
const placeholders = cols.map(() => '?').join(', ');
|
|
116
116
|
const r = await driver.run(
|
|
117
|
-
|
|
117
|
+
// RETURNING, because the id is read back. Empty on SQLite, ` RETURNING "id"` on Postgres —
|
|
118
|
+
// and without it lastId is undefined there, so every caller gets { id: undefined }.
|
|
119
|
+
`INSERT INTO ${table} (${cols.join(', ')}) VALUES (${placeholders})${driver.dialect.returning('id')}`,
|
|
120
|
+
values);
|
|
118
121
|
return { id: r.lastId };
|
|
119
122
|
},
|
|
120
123
|
|
package/views/ai/job-card.ejs
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
resolved [endpointId] what would actually serve right now, in order
|
|
26
26
|
endpoints [{ id, label, enabled }] every endpoint that exists
|
|
27
27
|
spend { calls, total_tokens } | null
|
|
28
|
+
spendDays how many days `spend` covers, for the label beside it (default 14)
|
|
28
29
|
canEdit render the edit affordance at all
|
|
29
30
|
csrfToken () => token
|
|
30
31
|
basePath where this app mounts its AI admin, e.g. '/admin/ai'
|
|
@@ -37,6 +38,9 @@
|
|
|
37
38
|
var _resolved = resolved || [];
|
|
38
39
|
var _eps = endpoints || [];
|
|
39
40
|
var _spend = (typeof spend !== 'undefined') ? spend : null;
|
|
41
|
+
// THE WINDOW THAT PRODUCED `spend`. Defaulted to what the label used to say as a literal, so a
|
|
42
|
+
// consumer that passes nothing renders exactly as it did before.
|
|
43
|
+
var _spendDays = (typeof spendDays !== 'undefined' && Number(spendDays) > 0) ? Number(spendDays) : 14;
|
|
40
44
|
var _isDefault = !_assigned.length;
|
|
41
45
|
var _byId = {};
|
|
42
46
|
_eps.forEach(function (e) { _byId[e.id] = e; });
|
|
@@ -81,11 +85,19 @@
|
|
|
81
85
|
<div class="text-end d-flex flex-column align-items-end gap-2 flex-shrink-0">
|
|
82
86
|
<%# WHAT THIS JOB COSTS, which is the number worth acting on: a job can be pointed at a
|
|
83
87
|
cheaper machine, run less often, or switched off. An endpoint total only says where the
|
|
84
|
-
money went, never what asked for it.
|
|
88
|
+
money went, never what asked for it.
|
|
89
|
+
|
|
90
|
+
THE WINDOW IS PRINTED FROM THE SAME PLACE THE FIGURE COMES FROM. It used to be the
|
|
91
|
+
literal "14 days" here, while the figure beside it was aggregated by the consuming app
|
|
92
|
+
over a window only that app knew — two halves of one sentence in two repositories. A
|
|
93
|
+
consumer changing its window relabelled nothing, and every card then stated a period
|
|
94
|
+
its own number had never covered. Support101 hit exactly that on the other side of the
|
|
95
|
+
same screen, where a total labelled "14 days" came from an unwindowed query and ran
|
|
96
|
+
139,792 tokens adrift of the tab beside it. %>
|
|
85
97
|
<% if (_spend && _spend.total_tokens) { %>
|
|
86
98
|
<div class="small text-body-secondary" style="font-variant-numeric: tabular-nums">
|
|
87
99
|
<%= Number(_spend.total_tokens).toLocaleString() %> tokens in <%= _spend.calls %> call<%= _spend.calls === 1 ? '' : 's' %>
|
|
88
|
-
<span class="text-body-tertiary">·
|
|
100
|
+
<span class="text-body-tertiary">· <%= _spendDays %> days</span>
|
|
89
101
|
</div>
|
|
90
102
|
<% } %>
|
|
91
103
|
<% if (_edit && _eps.length) { %>
|