@g9tm/aiassistant-svelte 1.3.0 → 1.4.1
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/pages/Page.svelte
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
// The assistant's pages, each from its own endpoint, read with type checks only.
|
|
7
7
|
import { arr, num, obj, str } from "@g9tm/aiassistant";
|
|
8
|
+
import { pageTexts } from "@g9tm/aiassistant/pages";
|
|
8
9
|
import { cls, override, useUi } from "../context.js";
|
|
9
10
|
import History from "./History.svelte";
|
|
10
11
|
import RoutineWizard from "./RoutineWizard.svelte";
|
|
@@ -15,6 +16,8 @@
|
|
|
15
16
|
const api = ui.assistant.api;
|
|
16
17
|
let data = $state<Record<string, unknown>>({});
|
|
17
18
|
let error = $state<string | null>(null);
|
|
19
|
+
let loaded = $state(false); // an empty page says so only once its answer came
|
|
20
|
+
const empty = $derived(pageTexts(ui.texts).t("page." + kind + ".empty"));
|
|
18
21
|
let purpose = $state("");
|
|
19
22
|
let code = $state("");
|
|
20
23
|
let token = $state<string | null>(null);
|
|
@@ -31,6 +34,7 @@
|
|
|
31
34
|
} catch (e) {
|
|
32
35
|
error = e instanceof Error ? e.message : "error.network";
|
|
33
36
|
}
|
|
37
|
+
loaded = true;
|
|
34
38
|
}
|
|
35
39
|
// History and the routine wizard are their own (replaceable) pages and read their own data.
|
|
36
40
|
const Own = $derived(kind === "history" ? override(ui, "History") ?? History : kind === "routines" ? override(ui, "RoutineWizard") ?? RoutineWizard : null);
|
|
@@ -52,11 +56,12 @@
|
|
|
52
56
|
<ul>{#each arr(g["tools"]).map(obj) as tool (str(tool["name"]))}<li>{str(tool["title"], str(tool["name"]))}</li>{/each}</ul>
|
|
53
57
|
{/each}
|
|
54
58
|
{#each arr(data["closed"]).map(obj) as c (str(c["name"]))}<p class="g9a-note">{str(c["name"])} · {str(c["layer"])}</p>{/each}
|
|
59
|
+
{#if loaded && arr(data["groups"]).length === 0 && arr(data["closed"]).length === 0}<p class="g9a-note g9a-empty">{empty}</p>{/if}
|
|
55
60
|
{:else if kind === "knowledge"}
|
|
56
|
-
<ul>{#each arr(data["notes"] ?? data["items"]).map(obj) as n, i (i)}<li>{str(n["text"], str(n["name"]))}</li>{/each}</ul>
|
|
61
|
+
<ul>{#each arr(data["notes"] ?? data["items"]).map(obj) as n, i (i)}<li>{str(n["text"], str(n["name"]))}</li>{:else}{#if loaded}<li class="g9a-note g9a-empty">{empty}</li>{/if}{/each}</ul>
|
|
57
62
|
{:else if kind === "learned"}
|
|
58
63
|
<p>{Math.round(num(data["modelFreeRate"]) * 100)}% · {num(data["tokensSaved"])}</p>
|
|
59
|
-
<ul>{#each arr(data["items"]).map(obj) as it, i (i)}<li data-status={str(it["status"])}>{str(it["signature"])} · {str(it["status"])} · {num(it["hits"])}</li>{/each}</ul>
|
|
64
|
+
<ul>{#each arr(data["items"]).map(obj) as it, i (i)}<li data-status={str(it["status"])}>{str(it["signature"])} · {str(it["status"])} · {num(it["hits"])}</li>{:else}{#if loaded}<li class="g9a-note g9a-empty">{empty}</li>{/if}{/each}</ul>
|
|
60
65
|
{:else if kind === "findings"}
|
|
61
66
|
<ul>
|
|
62
67
|
{#each arr(data["findings"]).map(obj) as f (str(f["id"]))}
|
|
@@ -65,10 +70,12 @@
|
|
|
65
70
|
<button type="button" onclick={() => act("findings/" + encodeURIComponent(str(f["id"])) + "/fixed")}>✓</button>
|
|
66
71
|
<button type="button" onclick={() => act("findings/" + encodeURIComponent(str(f["id"])) + "/dismiss", { reason: "—" })}>{t("no")}</button>
|
|
67
72
|
</li>
|
|
73
|
+
{:else}
|
|
74
|
+
{#if loaded}<li class="g9a-note g9a-empty">{empty}</li>{/if}
|
|
68
75
|
{/each}
|
|
69
76
|
</ul>
|
|
70
77
|
{:else if kind === "actions"}
|
|
71
|
-
<ul>{#each [...ui.assistant.snapshot().plans.values()].filter((p) => p.answered === "confirmed") as p (p.id)}<li>{p.title} <button type="button" onclick={() => ui.assistant.undo(p.id)}>{t("undo.all")}</button></li>{/each}</ul>
|
|
78
|
+
<ul>{#each [...ui.assistant.snapshot().plans.values()].filter((p) => p.answered === "confirmed") as p (p.id)}<li>{p.title} <button type="button" onclick={() => ui.assistant.undo(p.id)}>{t("undo.all")}</button></li>{:else}<li class="g9a-note g9a-empty">{empty}</li>{/each}</ul>
|
|
72
79
|
{:else if kind === "admin"}
|
|
73
80
|
<form onsubmit={async (e) => { e.preventDefault(); const r = obj(await api.post("gates", { purpose, code }).catch(() => null)); token = str(r["token"]) || null; purpose = ""; code = ""; await load(); }}>
|
|
74
81
|
<input bind:value={purpose} placeholder="purpose" aria-label="purpose" />
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
let q = $state("");
|
|
14
14
|
let found = $state<{ id: string; label: string }[]>([]);
|
|
15
15
|
let asked = $state(false);
|
|
16
|
+
let askedFor = $state(""); // before anything is typed an empty answer is a hint, not "nothing found"
|
|
16
17
|
let failed = $state(false);
|
|
17
18
|
let handle: ReturnType<typeof setTimeout> | undefined;
|
|
18
19
|
let seq = 0;
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
pageCalls.pick(ui.assistant.api, slot.kind, text.trim()).then((raw) => {
|
|
25
26
|
if (mine !== seq) return;
|
|
26
27
|
found = readPicks(raw);
|
|
28
|
+
askedFor = text.trim();
|
|
27
29
|
asked = true;
|
|
28
30
|
failed = false;
|
|
29
31
|
}, () => {
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
{/each}
|
|
50
52
|
</ul>
|
|
51
53
|
{:else if asked}
|
|
52
|
-
<p class="g9a-note">{t("routine.none_found")}</p>
|
|
54
|
+
<p class="g9a-note">{t(askedFor.length === 0 ? "routine.type_to_search" : "routine.none_found")}</p>
|
|
53
55
|
{/if}
|
|
54
56
|
{/if}
|
|
55
57
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g9tm/aiassistant-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Svelte 5 components for the G9 AI assistant, fully customisable (layouts, tokens, per-part classes, overrides, parts).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@g9tm/aiassistant": "1.
|
|
34
|
+
"@g9tm/aiassistant": "1.4.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@sveltejs/package": "2.5.8",
|