@ai-ecoverse/slicc-spectrum 1.11.0 → 1.12.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/README.md +2 -2
- package/dist/slicc-dummy.js +34 -1
- package/dist/slicc-dummy.js.map +3 -3
- package/dist/slicc-ui.js +26 -5
- package/dist/slicc-ui.js.map +2 -2
- package/dist/types/app/composer.d.ts +2 -1
- package/dist/types/app/messages.d.ts +1 -1
- package/dist/types/dummy/agent.d.ts +1 -0
- package/dist/types/model/types.d.ts +2 -1
- package/package.json +1 -1
package/dist/slicc-ui.js
CHANGED
|
@@ -7824,7 +7824,8 @@ var actionLabels = {
|
|
|
7824
7824
|
retry: "Retry",
|
|
7825
7825
|
settings: "Open settings",
|
|
7826
7826
|
"change-model": "Change model",
|
|
7827
|
-
login: "Log in"
|
|
7827
|
+
login: "Log in",
|
|
7828
|
+
"drop-turn": "Drop the last turn"
|
|
7828
7829
|
};
|
|
7829
7830
|
function time(at) {
|
|
7830
7831
|
return new Date(at).toISOString().slice(11, 16);
|
|
@@ -8026,7 +8027,12 @@ function assistant(message, name, model, handlers, showThinking) {
|
|
|
8026
8027
|
${message.status === "stopped" ? b`<span class="tag">stopped</span>` : A}
|
|
8027
8028
|
${message.status === "error" ? b`<span class="tag negative">failed</span>` : A}
|
|
8028
8029
|
</div>
|
|
8029
|
-
${parts(
|
|
8030
|
+
${parts(
|
|
8031
|
+
message.parts,
|
|
8032
|
+
{ ...handlers, action: (action) => handlers.action(action, message.id) },
|
|
8033
|
+
showThinking,
|
|
8034
|
+
message.status === "streaming"
|
|
8035
|
+
)}
|
|
8030
8036
|
${message.status === "streaming" ? b`<span class="caret" aria-hidden="true"></span>` : A}
|
|
8031
8037
|
</article>`;
|
|
8032
8038
|
}
|
|
@@ -8049,7 +8055,7 @@ function system(message, handlers) {
|
|
|
8049
8055
|
}
|
|
8050
8056
|
return b`<div class="error-card system-error" role="alert" data-id=${message.id}>
|
|
8051
8057
|
<div class="error-text"><strong>${message.title}</strong><span>${message.text}</span></div>
|
|
8052
|
-
${message.action ? b`<sp-button size="s" variant="secondary" treatment="outline" @click=${() => handlers.action(message.action)}>${actionLabels[message.action]}</sp-button>` : A}
|
|
8058
|
+
${message.action ? b`<sp-button size="s" variant="secondary" treatment="outline" @click=${() => handlers.action(message.action, message.id)}>${actionLabels[message.action]}</sp-button>` : A}
|
|
8053
8059
|
</div>`;
|
|
8054
8060
|
}
|
|
8055
8061
|
function lick(message, handlers) {
|
|
@@ -8707,7 +8713,7 @@ var SliccChat = class extends ThemedElement {
|
|
|
8707
8713
|
model: null,
|
|
8708
8714
|
answer: (questionId, answer) => this.model?.agent.answer(this.#id(), questionId, answer),
|
|
8709
8715
|
resolve: (messageId, state) => this.model?.agent.resolveLick(this.#id(), messageId, state),
|
|
8710
|
-
action: (action) => this.#action(action),
|
|
8716
|
+
action: (action, messageId) => this.#action(action, messageId),
|
|
8711
8717
|
open: (path) => this.dispatchEvent(
|
|
8712
8718
|
new CustomEvent("open-file", { detail: { path }, bubbles: true, composed: true })
|
|
8713
8719
|
)
|
|
@@ -8749,10 +8755,19 @@ var SliccChat = class extends ThemedElement {
|
|
|
8749
8755
|
const id = this.#id();
|
|
8750
8756
|
return this.model?.agent.list().find((agent) => agent.id === id);
|
|
8751
8757
|
}
|
|
8752
|
-
#
|
|
8758
|
+
async #rewind(id, messageId) {
|
|
8759
|
+
const restored = await this.model?.agent.rewind?.(id, messageId);
|
|
8760
|
+
if (!restored) return;
|
|
8761
|
+
this.renderRoot.querySelector("slicc-composer")?.restore(restored);
|
|
8762
|
+
}
|
|
8763
|
+
#action(action, messageId = "") {
|
|
8753
8764
|
const model = this.model;
|
|
8754
8765
|
if (!model) return;
|
|
8755
8766
|
const id = this.#id();
|
|
8767
|
+
if (action === "drop-turn") {
|
|
8768
|
+
void this.#rewind(id, messageId);
|
|
8769
|
+
return;
|
|
8770
|
+
}
|
|
8756
8771
|
if (action === "retry") {
|
|
8757
8772
|
const last = model.agent.messages(id).filter((message) => message.role === "user").at(-1);
|
|
8758
8773
|
if (last) void model.agent.send(id, { text: last.text, attachments: last.attachments });
|
|
@@ -9157,6 +9172,12 @@ var SliccComposer = class extends ModelElement {
|
|
|
9157
9172
|
focus() {
|
|
9158
9173
|
this.focusOn("textarea");
|
|
9159
9174
|
}
|
|
9175
|
+
restore(message) {
|
|
9176
|
+
this.value = message.text;
|
|
9177
|
+
this.attachments = [...message.attachments ?? []];
|
|
9178
|
+
this.#history = -1;
|
|
9179
|
+
this.focus();
|
|
9180
|
+
}
|
|
9160
9181
|
get #textarea() {
|
|
9161
9182
|
return this.renderRoot.querySelector("textarea");
|
|
9162
9183
|
}
|