@arcgis/ai-components 5.2.0-next.114 → 5.2.0-next.115
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/agent-utils/types.d.ts +13 -3
- package/dist/cdn/{HXEAVHLM.js → 23CPLCYW.js} +1 -1
- package/dist/cdn/{64IWQ7A4.js → 2NODROJN.js} +1 -1
- package/dist/cdn/{6P44KOKX.js → 4WYNWR6R.js} +1 -1
- package/dist/cdn/{6OOZSZRJ.js → 5QXGQW2N.js} +1 -1
- package/dist/cdn/{TGYRNH5D.js → 6KSMVYBS.js} +1 -1
- package/dist/cdn/{H5DD7DRB.js → 6XZYQ74A.js} +1 -1
- package/dist/cdn/{TAWMLPK2.js → 6YRLY5TX.js} +1 -1
- package/dist/cdn/{WSWB3B7B.js → 7ELUGB4X.js} +1 -1
- package/dist/cdn/{QXOOEBIR.js → BJNYJCS5.js} +1 -1
- package/dist/cdn/{Q5WITJ3L.js → BKAXFQIS.js} +1 -1
- package/dist/cdn/{JO7U7E24.js → BN7CIVBD.js} +1 -1
- package/dist/cdn/{V6HOUZPZ.js → C7P6MHMZ.js} +1 -1
- package/dist/cdn/{PMILRLSD.js → CESQ3SFP.js} +1 -1
- package/dist/cdn/{L3K457Y6.js → CLTV27HJ.js} +1 -1
- package/dist/cdn/{F5NIRETW.js → CSTXLFCP.js} +1 -1
- package/dist/cdn/{HHQTKKYE.js → CVAVY7R2.js} +1 -1
- package/dist/cdn/{AKOLZ4JN.js → CZIAU7PC.js} +1 -1
- package/dist/cdn/{J3D2JL4H.js → DEPD7PJL.js} +1 -1
- package/dist/cdn/{C2RSZ3VK.js → H4N7VNL5.js} +1 -1
- package/dist/cdn/{XOULSLM7.js → HAHL6K4X.js} +1 -1
- package/dist/cdn/{H4BVWDNV.js → HFHRMM6Q.js} +1 -1
- package/dist/cdn/{TAMMDFVT.js → HSILCMAR.js} +1 -1
- package/dist/cdn/{4XTSGMV7.js → ITCZC2VY.js} +1 -1
- package/dist/cdn/{U7SYNCYR.js → JTEY4E7E.js} +1 -1
- package/dist/cdn/{3UEKINYC.js → JTKVVKZK.js} +1 -1
- package/dist/cdn/{O4NVW75A.js → K5FWDMTV.js} +1 -1
- package/dist/cdn/{EYOWRGDP.js → KPJHQ424.js} +1 -1
- package/dist/cdn/{MXTXJKFE.js → KQGC2FCP.js} +1 -1
- package/dist/cdn/{YYDZAPJP.js → LDIUJUI7.js} +1 -1
- package/dist/cdn/NR2O3AP2.js +2 -0
- package/dist/cdn/NWJQ7KTC.js +2 -0
- package/dist/cdn/{YR7EYQ4X.js → PGVLC374.js} +1 -1
- package/dist/cdn/{SXM4NUT5.js → PQRE67OM.js} +1 -1
- package/dist/cdn/QZL4SAYR.js +6 -0
- package/dist/cdn/{2642ADON.js → SLD4ZVT6.js} +1 -1
- package/dist/cdn/{Y5O6VNSQ.js → UZ6OAU3F.js} +2 -2
- package/dist/cdn/{RMLCWLJC.js → VBEZDXBV.js} +1 -1
- package/dist/cdn/VJRJ2HAM.js +3 -0
- package/dist/cdn/{UDRKUVZP.js → VYOIFJVE.js} +1 -1
- package/dist/cdn/{ZGQ27DU2.js → XUYARLRP.js} +1 -1
- package/dist/cdn/{CLRFKSAT.js → ZA2WIUWH.js} +1 -1
- package/dist/cdn/{LUYP76B7.js → ZCFYGCCV.js} +1 -1
- package/dist/cdn/{Y27GVWWU.js → ZGZX7GR5.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.en.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/baseAgentState.js +7 -6
- package/dist/chunks/orchestrator.js +9 -6
- package/dist/components/arcgis-assistant/customElement.d.ts +23 -3
- package/dist/components/arcgis-assistant/customElement.js +213 -187
- package/dist/components/arcgis-assistant/types.d.ts +108 -0
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +15 -4
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +344 -45
- package/dist/components/arcgis-assistant-chat-entry/index.js +3 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/index.d.ts +20 -0
- package/package.json +5 -5
- package/dist/cdn/2O4DON37.js +0 -2
- package/dist/cdn/AXY6RA5N.js +0 -3
- package/dist/cdn/FS7GXTTQ.js +0 -6
- package/dist/cdn/RLEHNAIA.js +0 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as L } from "../../chunks/runtime.js";
|
|
3
|
-
import { css as T, html as
|
|
3
|
+
import { css as T, html as h } from "lit";
|
|
4
4
|
import M from "@arcgis/core/core/Collection.js";
|
|
5
5
|
import { whenOnce as R, watch as D, when as O } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
6
|
import U from "@arcgis/core/portal/Portal.js";
|
|
7
|
-
import { LitElement as B, createEvent as
|
|
7
|
+
import { LitElement as B, createEvent as m, nothing as v } from "@arcgis/lumina";
|
|
8
8
|
import * as z from "@arcgis/toolkit/log";
|
|
9
9
|
import { rethrowError as N } from "@arcgis/toolkit/log";
|
|
10
10
|
import { createRef as w, ref as E } from "lit/directives/ref.js";
|
|
11
|
-
import { u as
|
|
12
|
-
import { O as
|
|
11
|
+
import { u as q } from "../../chunks/useT9n.js";
|
|
12
|
+
import { O as F } from "../../chunks/orchestrator.js";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
14
|
import "@langchain/core/prompts";
|
|
15
15
|
import "@langchain/openai";
|
|
16
16
|
import "@arcgis/core/request.js";
|
|
17
|
-
import
|
|
17
|
+
import $ from "@arcgis/core/identity/IdentityManager.js";
|
|
18
18
|
import "@arcgis/toolkit/string";
|
|
19
19
|
import "@arcgis/core/config.js";
|
|
20
20
|
import "@langchain/core/messages";
|
|
@@ -22,15 +22,15 @@ import "@arcgis/core/layers/FeatureLayer.js";
|
|
|
22
22
|
import "../../chunks/generateLayerDescriptions.js";
|
|
23
23
|
import "@langchain/langgraph/web";
|
|
24
24
|
import H from "@arcgis/core/core/Accessor.js";
|
|
25
|
-
import { property as
|
|
26
|
-
import { marked as
|
|
25
|
+
import { property as _, subclass as V } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
26
|
+
import { marked as S } from "marked";
|
|
27
27
|
import { g as j } from "../../chunks/utils3.js";
|
|
28
|
-
import { g as
|
|
28
|
+
import { g as I } from "../../chunks/slottableRequestUtils.js";
|
|
29
29
|
const W = T`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;
|
|
30
|
-
function k(
|
|
31
|
-
return
|
|
30
|
+
function k(l) {
|
|
31
|
+
return l.trim() ? S.lexer(l).filter((t) => t.type !== "space").map((t) => S.parser([t])) : [];
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class C {
|
|
34
34
|
constructor() {
|
|
35
35
|
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
36
36
|
}
|
|
@@ -67,10 +67,10 @@ class P {
|
|
|
67
67
|
_lastSafeBoundary(t) {
|
|
68
68
|
const e = t.split(`
|
|
69
69
|
`);
|
|
70
|
-
let s = !1,
|
|
71
|
-
for (const
|
|
72
|
-
/^\s*(```|~~~)/u.test(
|
|
73
|
-
return
|
|
70
|
+
let s = !1, i = 0, r = 0;
|
|
71
|
+
for (const d of e)
|
|
72
|
+
/^\s*(```|~~~)/u.test(d) && (s = !s), r += d.length + 1, d.trim() === "" && !s && (i = r);
|
|
73
|
+
return i < t.length ? i : 0;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Remove incomplete syntax at the end so we do not render partial markup.
|
|
@@ -86,11 +86,11 @@ class P {
|
|
|
86
86
|
const s = this._earliestUnclosedTag(t);
|
|
87
87
|
if (s !== -1)
|
|
88
88
|
return t.slice(0, s);
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
if (!/\[[^\]]*\]\([^)]*\)/u.test(
|
|
93
|
-
return t.slice(0,
|
|
89
|
+
const i = t.lastIndexOf("[");
|
|
90
|
+
if (i !== -1) {
|
|
91
|
+
const r = t.slice(i);
|
|
92
|
+
if (!/\[[^\]]*\]\([^)]*\)/u.test(r))
|
|
93
|
+
return t.slice(0, i);
|
|
94
94
|
}
|
|
95
95
|
return t;
|
|
96
96
|
}
|
|
@@ -113,59 +113,59 @@ class P {
|
|
|
113
113
|
"source",
|
|
114
114
|
"track",
|
|
115
115
|
"wbr"
|
|
116
|
-
]), s = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,
|
|
117
|
-
for (let
|
|
118
|
-
const [,
|
|
119
|
-
if (!(e.has(c) ||
|
|
120
|
-
if (
|
|
121
|
-
for (let
|
|
122
|
-
if (
|
|
123
|
-
|
|
116
|
+
]), s = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, i = [];
|
|
117
|
+
for (let r = s.exec(t); r; r = s.exec(t)) {
|
|
118
|
+
const [, d, p, o] = r, c = p.toLowerCase();
|
|
119
|
+
if (!(e.has(c) || o === "/"))
|
|
120
|
+
if (d === "/") {
|
|
121
|
+
for (let a = i.length - 1; a >= 0; a--)
|
|
122
|
+
if (i[a].name === c) {
|
|
123
|
+
i.splice(a);
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
} else
|
|
127
|
-
|
|
127
|
+
i.push({ name: c, index: r.index });
|
|
128
128
|
}
|
|
129
|
-
return
|
|
129
|
+
return i.length ? i[0].index : -1;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
function G(
|
|
133
|
-
const t = new
|
|
134
|
-
return t.push(
|
|
132
|
+
function G(l) {
|
|
133
|
+
const t = new C();
|
|
134
|
+
return t.push(l), t.finalize();
|
|
135
135
|
}
|
|
136
|
-
const Z = async (
|
|
137
|
-
async function* J(
|
|
138
|
-
const s = new
|
|
139
|
-
for (let
|
|
140
|
-
yield s.push(
|
|
136
|
+
const Z = async (l) => await new Promise((t) => setTimeout(t, l));
|
|
137
|
+
async function* J(l, { chunkSize: t = 15, delay: e = 50 } = {}) {
|
|
138
|
+
const s = new C();
|
|
139
|
+
for (let i = 0; i < l.length; i += t)
|
|
140
|
+
yield s.push(l.slice(i, i + t)), await Z(e);
|
|
141
141
|
yield s.finalize();
|
|
142
142
|
}
|
|
143
|
-
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor,
|
|
144
|
-
for (var
|
|
145
|
-
(
|
|
146
|
-
return s &&
|
|
143
|
+
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (l, t, e, s) => {
|
|
144
|
+
for (var i = s > 1 ? void 0 : s ? Q(t, e) : t, r = l.length - 1, d; r >= 0; r--)
|
|
145
|
+
(d = l[r]) && (i = (s ? d(t, e, i) : d(i)) || i);
|
|
146
|
+
return s && i && K(t, e, i), i;
|
|
147
147
|
};
|
|
148
|
-
const A = (
|
|
149
|
-
async function*
|
|
150
|
-
if (
|
|
148
|
+
const A = (l) => !l || typeof l != "object" ? !1 : l.name === "AbortError";
|
|
149
|
+
async function* P(l, t, e, s, i = !1) {
|
|
150
|
+
if (i) {
|
|
151
151
|
if (s?.aborted) {
|
|
152
152
|
yield { type: "cancelled", log: e, runId: t };
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
yield { type: "block-data", blockType: "text", data: { parts: G(
|
|
155
|
+
yield { type: "block-data", blockType: "text", data: { parts: G(l) }, runId: t };
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
for await (const
|
|
158
|
+
for await (const r of J(l)) {
|
|
159
159
|
if (s?.aborted) {
|
|
160
160
|
yield { type: "cancelled", log: e, runId: t };
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
yield { type: "block-data", blockType: "text", data: { parts:
|
|
163
|
+
yield { type: "block-data", blockType: "text", data: { parts: r }, runId: t };
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
let
|
|
167
|
-
constructor(
|
|
168
|
-
super(
|
|
166
|
+
let b = class extends H {
|
|
167
|
+
constructor(l) {
|
|
168
|
+
super(l), this.view = null, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.loading = !1, this.processing = !1, this.processingStep = "";
|
|
169
169
|
}
|
|
170
170
|
async load() {
|
|
171
171
|
this._set("loading", !0);
|
|
@@ -181,7 +181,7 @@ let p = class extends H {
|
|
|
181
181
|
async _initialize() {
|
|
182
182
|
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await R(() => !this.view.updating), this._set(
|
|
183
183
|
"orchestrator",
|
|
184
|
-
await
|
|
184
|
+
await F.init({
|
|
185
185
|
agents: [...this.agents],
|
|
186
186
|
runtimeEventsEnabled: this.runtimeEventsEnabled,
|
|
187
187
|
view: this.view ?? void 0
|
|
@@ -198,95 +198,95 @@ let p = class extends H {
|
|
|
198
198
|
clearChatHistory() {
|
|
199
199
|
this.orchestrator?.newConversation();
|
|
200
200
|
}
|
|
201
|
-
async *ask(
|
|
201
|
+
async *ask(l, t, e) {
|
|
202
202
|
if (!this.orchestrator)
|
|
203
203
|
throw new Error("Orchestrator not initialized yet.");
|
|
204
204
|
this._set("processing", !0), this._set("processingStep", "");
|
|
205
205
|
const s = [];
|
|
206
|
-
let
|
|
206
|
+
let i, r = "pending";
|
|
207
207
|
try {
|
|
208
|
-
const
|
|
209
|
-
for await (const
|
|
210
|
-
switch (
|
|
208
|
+
const d = this.orchestrator.ask(l, t);
|
|
209
|
+
for await (const p of d)
|
|
210
|
+
switch (r = p.runId, p.type) {
|
|
211
211
|
case "runtime": {
|
|
212
|
-
yield { type: "runtime", event:
|
|
212
|
+
yield { type: "runtime", event: p, runId: r };
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
215
|
case "trace": {
|
|
216
|
-
this._set("processingStep",
|
|
216
|
+
this._set("processingStep", p.data.text), s.push(p.data.text);
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
219
|
case "completed": {
|
|
220
220
|
this._set("processing", !1), this._set("processingStep", "");
|
|
221
|
-
const
|
|
222
|
-
if (!c && !
|
|
223
|
-
yield { type: "completed", error: "No response received.", log: s, runId:
|
|
221
|
+
const o = p.result, c = !!o.content.length, a = !!i?.length;
|
|
222
|
+
if (!c && !a) {
|
|
223
|
+
yield { type: "completed", error: "No response received.", log: s, runId: r };
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
if (yield { type: "block-start", blockType: "text", runId:
|
|
228
|
-
for (const
|
|
226
|
+
const n = o.content;
|
|
227
|
+
if (yield { type: "block-start", blockType: "text", runId: r }, yield* P(n, r, s, e, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: r }, a)
|
|
228
|
+
for (const g of i) {
|
|
229
229
|
if (e?.aborted) {
|
|
230
|
-
yield { type: "cancelled", log: s, runId:
|
|
230
|
+
yield { type: "cancelled", log: s, runId: r };
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
|
-
const { type:
|
|
234
|
-
if (yield { type: "block-start", blockType:
|
|
235
|
-
const x = typeof
|
|
236
|
-
yield*
|
|
233
|
+
const { type: u, data: y } = g;
|
|
234
|
+
if (yield { type: "block-start", blockType: u, runId: r }, u === "text") {
|
|
235
|
+
const x = typeof y?.content == "string" ? y.content : "";
|
|
236
|
+
yield* P(x, r, s, e, this.streamingDisabled);
|
|
237
237
|
} else
|
|
238
|
-
yield { type: "block-data", blockType:
|
|
239
|
-
yield { type: "block-end", blockType:
|
|
238
|
+
yield { type: "block-data", blockType: u, data: y, runId: r };
|
|
239
|
+
yield { type: "block-end", blockType: u, runId: r };
|
|
240
240
|
}
|
|
241
|
-
yield { type: "completed", response:
|
|
241
|
+
yield { type: "completed", response: n, blocks: i, log: s, runId: r };
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
case "ux-suggestion": {
|
|
245
|
-
const
|
|
246
|
-
|
|
245
|
+
const o = p.suggestion;
|
|
246
|
+
i = i ? [...i, o] : [o];
|
|
247
247
|
break;
|
|
248
248
|
}
|
|
249
249
|
case "interrupt": {
|
|
250
|
-
const { kind:
|
|
251
|
-
switch (
|
|
250
|
+
const { kind: o, message: c, metadata: a } = p.interrupt, n = Array.isArray(a) ? a.filter((u) => typeof u == "string") : [], g = (() => {
|
|
251
|
+
switch (o) {
|
|
252
252
|
case "booleanChoice":
|
|
253
|
-
return { type: "boolean-choice", message: c, options:
|
|
253
|
+
return { type: "boolean-choice", message: c, options: n };
|
|
254
254
|
case "singleSelection":
|
|
255
|
-
return { type: "single-select", message: c, options:
|
|
255
|
+
return { type: "single-select", message: c, options: n };
|
|
256
256
|
case "multipleSelection":
|
|
257
|
-
return { type: "multi-select", message: c, options:
|
|
257
|
+
return { type: "multi-select", message: c, options: n };
|
|
258
258
|
case "textInput":
|
|
259
259
|
return { type: "text-input", message: c };
|
|
260
260
|
default:
|
|
261
|
-
return { type:
|
|
261
|
+
return { type: o, message: c, options: n };
|
|
262
262
|
}
|
|
263
263
|
})();
|
|
264
|
-
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload:
|
|
264
|
+
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: g, runId: r };
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
case "cancelled": {
|
|
268
|
-
yield { type: "cancelled", log: s, runId:
|
|
268
|
+
yield { type: "cancelled", log: s, runId: r };
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
case "error": {
|
|
272
|
-
if (e?.aborted || A(
|
|
273
|
-
yield { type: "cancelled", log: s, runId:
|
|
272
|
+
if (e?.aborted || A(p.error)) {
|
|
273
|
+
yield { type: "cancelled", log: s, runId: r };
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
yield { type: "completed", error:
|
|
276
|
+
yield { type: "completed", error: p.error.message, log: s, runId: r };
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
default: {
|
|
280
|
-
console.warn("Unknown event type:",
|
|
280
|
+
console.warn("Unknown event type:", p);
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
} catch (
|
|
285
|
-
if (e?.aborted || A(
|
|
286
|
-
yield { type: "cancelled", log: s, runId:
|
|
284
|
+
} catch (d) {
|
|
285
|
+
if (e?.aborted || A(d)) {
|
|
286
|
+
yield { type: "cancelled", log: s, runId: r };
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
console.warn("Error during message processing:",
|
|
289
|
+
console.warn("Error during message processing:", d), yield { type: "completed", error: "An error occurred during message processing.", log: s, runId: "error" };
|
|
290
290
|
return;
|
|
291
291
|
} finally {
|
|
292
292
|
this._set("processing", !1);
|
|
@@ -296,49 +296,58 @@ let p = class extends H {
|
|
|
296
296
|
this.orchestrator?.cancel();
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
],
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
],
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
],
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
],
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
],
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
],
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
],
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
],
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
],
|
|
326
|
-
|
|
299
|
+
f([
|
|
300
|
+
_({ readOnly: !0 })
|
|
301
|
+
], b.prototype, "orchestrator", 2);
|
|
302
|
+
f([
|
|
303
|
+
_()
|
|
304
|
+
], b.prototype, "agents", 2);
|
|
305
|
+
f([
|
|
306
|
+
_()
|
|
307
|
+
], b.prototype, "portal", 2);
|
|
308
|
+
f([
|
|
309
|
+
_()
|
|
310
|
+
], b.prototype, "view", 2);
|
|
311
|
+
f([
|
|
312
|
+
_()
|
|
313
|
+
], b.prototype, "streamingDisabled", 2);
|
|
314
|
+
f([
|
|
315
|
+
_()
|
|
316
|
+
], b.prototype, "runtimeEventsEnabled", 2);
|
|
317
|
+
f([
|
|
318
|
+
_({ readOnly: !0 })
|
|
319
|
+
], b.prototype, "loading", 2);
|
|
320
|
+
f([
|
|
321
|
+
_({ readOnly: !0 })
|
|
322
|
+
], b.prototype, "processing", 2);
|
|
323
|
+
f([
|
|
324
|
+
_({ readOnly: !0 })
|
|
325
|
+
], b.prototype, "processingStep", 2);
|
|
326
|
+
b = f([
|
|
327
327
|
V("OrchestratorController")
|
|
328
|
-
],
|
|
328
|
+
], b);
|
|
329
329
|
const X = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", Y = "Embeddings not found for this web map.", tt = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
330
330
|
class et extends B {
|
|
331
331
|
constructor() {
|
|
332
|
-
super(...arguments), this._messages =
|
|
332
|
+
super(...arguments), this._messages = q({ blocking: !0 }), this.#t = w(), this.#o = w(), this.#i = w(), this.#e = null, this.#r = /* @__PURE__ */ new Map(), this.#s = U.getDefault(), this.#a = (t) => {
|
|
333
333
|
t.stopPropagation(), this.cancelInterrupt();
|
|
334
334
|
}, this.#n = (t) => {
|
|
335
335
|
t.stopPropagation();
|
|
336
336
|
const e = t.detail;
|
|
337
337
|
this.submitInterrupt(e);
|
|
338
338
|
}, this.#l = (t) => {
|
|
339
|
-
t.stopPropagation(),
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
if (t.stopPropagation(), t.defaultPrevented)
|
|
340
|
+
return;
|
|
341
|
+
const e = t.detail, s = typeof e == "string" ? e : e.prompt, i = typeof e == "string" ? void 0 : { displayText: e.displayText, parts: e.parts };
|
|
342
|
+
if (!this.#b(s, i?.parts ?? [])) {
|
|
343
|
+
t.preventDefault();
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (this.arcgisSubmit.emit(e).defaultPrevented) {
|
|
347
|
+
t.preventDefault();
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
this.keepSuggestedPrompts || (this.suggestedPrompts = []), this._inputValue = "", this.submitMessage(s, i);
|
|
342
351
|
}, this.#c = (t) => {
|
|
343
352
|
if (this._canceling = !0, t.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
|
|
344
353
|
this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
@@ -349,16 +358,16 @@ class et extends B {
|
|
|
349
358
|
t.stopPropagation();
|
|
350
359
|
const e = t.detail;
|
|
351
360
|
this.arcgisFeedback.emit(e);
|
|
352
|
-
}, this.#
|
|
361
|
+
}, this.#d = (t) => {
|
|
353
362
|
t.stopPropagation();
|
|
354
363
|
const e = t.detail;
|
|
355
364
|
this._inputValue = e.prompt, this.arcgisPromptSelect.emit(e);
|
|
356
365
|
}, this.#u = (t) => {
|
|
357
366
|
this.arcgisSlottableRequest.emit(t.detail);
|
|
358
|
-
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new M([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.userAvatarEnabled = !1, this.arcgisCancel =
|
|
367
|
+
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._submissionError = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new M([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.userAvatarEnabled = !1, this.arcgisCancel = m(), this.arcgisError = m(), this.arcgisFeedback = m(), this.arcgisInterrupt = m(), this.arcgisInterruptCancel = m(), this.arcgisInterruptSubmit = m(), this.arcgisPromptSelect = m(), this.arcgisReady = m(), this.arcgisResponse = m(), this.arcgisRuntime = m({ bubbles: !1, composed: !1 }), this.arcgisSlottableRequest = m({ bubbles: !1, composed: !1 }), this.arcgisSubmit = m({ cancelable: !0 });
|
|
359
368
|
}
|
|
360
369
|
static {
|
|
361
|
-
this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, alwaysUseAgentId: 1, allowedAgentIds: 0, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, streamingDisabled: 5, runtimeEventsEnabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5, userAvatarEnabled: 5 };
|
|
370
|
+
this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _submissionError: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, alwaysUseAgentId: 1, allowedAgentIds: 0, commandProvider: 0, entityProviders: 0, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, streamingDisabled: 5, runtimeEventsEnabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5, userAvatarEnabled: 5 };
|
|
362
371
|
}
|
|
363
372
|
static {
|
|
364
373
|
this.styles = W;
|
|
@@ -374,7 +383,7 @@ class et extends B {
|
|
|
374
383
|
#l;
|
|
375
384
|
#c;
|
|
376
385
|
#h;
|
|
377
|
-
#
|
|
386
|
+
#d;
|
|
378
387
|
#u;
|
|
379
388
|
get _isSignedIn() {
|
|
380
389
|
return !!this.#s?.user || !!this._signedInUserId;
|
|
@@ -401,99 +410,103 @@ class et extends B {
|
|
|
401
410
|
this._reset(), this._orchestratorController?.clearChatHistory();
|
|
402
411
|
}
|
|
403
412
|
register(t) {
|
|
404
|
-
this.#r.set(t.agent.id, t), this._orchestratorController && this.#
|
|
413
|
+
this.#r.set(t.agent.id, t), this._orchestratorController && this.#g();
|
|
405
414
|
}
|
|
406
415
|
submitInterrupt(t) {
|
|
407
416
|
this.arcgisInterruptSubmit.emit(t), this._interrupt && (this._interruptDetails = [...this._interruptDetails, { interrupt: this._interrupt, response: t }]), this.orchestrator?.resumeInterrupt(t), this._interrupt = null;
|
|
408
417
|
}
|
|
409
|
-
async submitMessage(t) {
|
|
410
|
-
const
|
|
411
|
-
if (!
|
|
418
|
+
async submitMessage(t, e) {
|
|
419
|
+
const s = t.trim(), i = e?.parts ?? [];
|
|
420
|
+
if (!s && !i.length || !this.#b(s, i) || (this.messages.push({
|
|
412
421
|
id: Date.now().toString(),
|
|
413
422
|
// TODO: Replace with a more robust ID generation method or get from orchestrator
|
|
414
423
|
role: "user",
|
|
415
|
-
content: e
|
|
424
|
+
content: e?.displayText?.trim() || s || i.map((o) => this.#f(o)).join(" "),
|
|
425
|
+
parts: i
|
|
416
426
|
}), !this._orchestratorController))
|
|
417
427
|
return;
|
|
418
428
|
this.#e = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
429
|
+
const r = this.#m(i), d = {
|
|
430
|
+
...e?.parts ? { inputParts: e.parts } : {},
|
|
431
|
+
...r ? { routing: "direct", agentId: r } : { routing: "auto", agentIds: this.allowedAgentIds }
|
|
432
|
+
}, p = this._orchestratorController.ask(s, d, this.#e?.signal);
|
|
433
|
+
for await (const o of p) {
|
|
434
|
+
const c = o.runId, a = this.messages.at(-1);
|
|
435
|
+
switch (o.type) {
|
|
423
436
|
case "runtime":
|
|
424
|
-
this.arcgisRuntime.emit(
|
|
437
|
+
this.arcgisRuntime.emit(o.event);
|
|
425
438
|
break;
|
|
426
439
|
case "block-start": {
|
|
427
440
|
this._isAnswering = !0;
|
|
428
|
-
const n = { type:
|
|
429
|
-
if (a?.role === "assistant" && a.id ===
|
|
430
|
-
const
|
|
431
|
-
this.messages.splice(-1, 1, { ...a, blocks:
|
|
441
|
+
const n = { type: o.blockType, isPending: !0 };
|
|
442
|
+
if (a?.role === "assistant" && a.id === c) {
|
|
443
|
+
const g = [...a.blocks ?? [], n];
|
|
444
|
+
this.messages.splice(-1, 1, { ...a, blocks: g });
|
|
432
445
|
} else
|
|
433
446
|
this.messages.push({
|
|
434
447
|
role: "assistant",
|
|
435
448
|
blocks: [n],
|
|
436
|
-
id:
|
|
449
|
+
id: c,
|
|
437
450
|
isStreaming: !0,
|
|
438
451
|
interrupts: this._interruptDetails
|
|
439
452
|
}), this._interruptDetails = [];
|
|
440
453
|
break;
|
|
441
454
|
}
|
|
442
455
|
case "block-data": {
|
|
443
|
-
if (a?.role !== "assistant" || a?.id !==
|
|
456
|
+
if (a?.role !== "assistant" || a?.id !== c)
|
|
444
457
|
break;
|
|
445
|
-
const n = [...a.blocks ?? []],
|
|
446
|
-
if (
|
|
458
|
+
const n = [...a.blocks ?? []], g = n[n.length - 1], { blockType: u, data: y } = o;
|
|
459
|
+
if (g?.type !== u || !g.isPending)
|
|
447
460
|
break;
|
|
448
|
-
|
|
449
|
-
...
|
|
461
|
+
u === "text" ? n[n.length - 1] = {
|
|
462
|
+
...g,
|
|
450
463
|
data: {
|
|
451
|
-
...
|
|
452
|
-
parts:
|
|
464
|
+
...g.data,
|
|
465
|
+
parts: y?.parts
|
|
453
466
|
}
|
|
454
|
-
} : n[n.length - 1] = { ...
|
|
467
|
+
} : n[n.length - 1] = { ...g, data: { ...g.data, ...y ?? {} } }, this.messages.splice(-1, 1, { ...a, blocks: n });
|
|
455
468
|
break;
|
|
456
469
|
}
|
|
457
470
|
case "block-end": {
|
|
458
|
-
if (a?.role !== "assistant" || a?.id !==
|
|
471
|
+
if (a?.role !== "assistant" || a?.id !== c)
|
|
459
472
|
break;
|
|
460
|
-
const n = [...a.blocks ?? []],
|
|
461
|
-
if (
|
|
473
|
+
const n = [...a.blocks ?? []], g = n[n.length - 1];
|
|
474
|
+
if (g?.type !== o.blockType || !g.isPending)
|
|
462
475
|
break;
|
|
463
|
-
const
|
|
464
|
-
n[n.length - 1] = { ...
|
|
476
|
+
const u = g;
|
|
477
|
+
n[n.length - 1] = { ...u, data: { ...u.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...a, blocks: n });
|
|
465
478
|
break;
|
|
466
479
|
}
|
|
467
480
|
case "completed":
|
|
468
|
-
|
|
481
|
+
o.error ? (this.messages.push({
|
|
469
482
|
role: "assistant",
|
|
470
|
-
log:
|
|
471
|
-
error:
|
|
472
|
-
id:
|
|
483
|
+
log: o.log,
|
|
484
|
+
error: o.error,
|
|
485
|
+
id: c,
|
|
473
486
|
interrupts: this._interruptDetails
|
|
474
|
-
}), this._interruptDetails = []) : a?.role === "assistant" && a.id ===
|
|
487
|
+
}), this._interruptDetails = []) : a?.role === "assistant" && a.id === c && this.messages.splice(-1, 1, {
|
|
475
488
|
...a,
|
|
476
|
-
content:
|
|
489
|
+
content: o.response,
|
|
477
490
|
blocks: a.blocks?.map((n) => ({ ...n, data: { ...n.data }, isPending: !1 })) ?? [],
|
|
478
491
|
isStreaming: !1,
|
|
479
|
-
log:
|
|
492
|
+
log: o.log
|
|
480
493
|
}), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
481
494
|
break;
|
|
482
495
|
case "interrupt":
|
|
483
|
-
this._interrupt = { ...
|
|
496
|
+
this._interrupt = { ...o.payload, id: c }, this.arcgisInterrupt.emit(this._interrupt);
|
|
484
497
|
break;
|
|
485
498
|
case "cancelled":
|
|
486
|
-
a?.role === "assistant" && a.id ===
|
|
499
|
+
a?.role === "assistant" && a.id === c ? this.messages.splice(-1, 1, {
|
|
487
500
|
...a,
|
|
488
501
|
blocks: a.blocks?.filter((n) => n.type === "text" || !n.isPending) ?? [],
|
|
489
502
|
isStreaming: !1,
|
|
490
|
-
log:
|
|
503
|
+
log: o.log,
|
|
491
504
|
error: `(${this._messages.stoppedByUserLabel})`
|
|
492
505
|
}) : (this.messages.push({
|
|
493
506
|
role: "assistant",
|
|
494
|
-
log:
|
|
507
|
+
log: o.log,
|
|
495
508
|
error: `(${this._messages.stoppedByUserLabel})`,
|
|
496
|
-
id:
|
|
509
|
+
id: c,
|
|
497
510
|
interrupts: this._interruptDetails
|
|
498
511
|
}), this._interruptDetails = []), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
499
512
|
break;
|
|
@@ -501,50 +514,63 @@ class et extends B {
|
|
|
501
514
|
}
|
|
502
515
|
}
|
|
503
516
|
unregister(t) {
|
|
504
|
-
this.#r.delete(t), this._orchestratorController && this.#
|
|
517
|
+
this.#r.delete(t), this._orchestratorController && this.#g();
|
|
505
518
|
}
|
|
506
519
|
load() {
|
|
507
520
|
this.manager.onLifecycle(this._reset.bind(this));
|
|
508
521
|
}
|
|
509
522
|
loaded() {
|
|
510
523
|
this.manager.onLifecycle(() => {
|
|
511
|
-
this.#t.value?.addEventListener("arcgisPromptSelect", this.#
|
|
524
|
+
this.#t.value?.addEventListener("arcgisPromptSelect", this.#d), this.#t.value?.addEventListener("arcgisSubmit", this.#l), this.#t.value?.addEventListener("arcgisCancel", this.#c), this.#t.value?.addEventListener("arcgisFeedback", this.#h);
|
|
512
525
|
const t = O(() => !!this._interrupt && !!this.#i.value, () => {
|
|
513
526
|
const s = this.#i.value;
|
|
514
527
|
s.removeEventListener("arcgisSubmit", this.#n), s.removeEventListener("arcgisCancel", this.#a), s.addEventListener("arcgisSubmit", this.#n, { once: !0 }), s.addEventListener("arcgisCancel", this.#a, { once: !0 });
|
|
515
528
|
}), e = this.messages.on("after-add", (s) => {
|
|
516
|
-
const
|
|
517
|
-
|
|
529
|
+
const i = s.item;
|
|
530
|
+
i.role === "assistant" && (i.error || i.content) && this.arcgisResponse.emit(i);
|
|
518
531
|
});
|
|
519
532
|
return queueMicrotask(() => {
|
|
520
533
|
this.#p();
|
|
521
534
|
}), () => {
|
|
522
|
-
t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#
|
|
535
|
+
t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#d), this.#i.value?.removeEventListener("arcgisSubmit", this.#n), this.#i.value?.removeEventListener("arcgisCancel", this.#a), this.#t.value?.removeEventListener("arcgisSubmit", this.#l), this.#t.value?.removeEventListener("arcgisCancel", this.#c), this.#t.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
|
|
523
536
|
};
|
|
524
537
|
});
|
|
525
538
|
}
|
|
526
539
|
willUpdate(t) {
|
|
527
540
|
this.hasUpdated && t.has("runtimeEventsEnabled") && this._orchestratorController && (this._orchestratorController.destroy(), this._orchestratorController = null, this.#p());
|
|
528
541
|
}
|
|
529
|
-
|
|
530
|
-
|
|
542
|
+
#f(t) {
|
|
543
|
+
return t.kind === "command" ? `/${t.id}` : `${t.trigger}${t.id}`;
|
|
544
|
+
}
|
|
545
|
+
#m(t) {
|
|
546
|
+
for (const e of t)
|
|
547
|
+
if (e.kind === "command" && e.agentId)
|
|
548
|
+
return e.agentId;
|
|
549
|
+
return this.alwaysUseAgentId;
|
|
550
|
+
}
|
|
551
|
+
#b(t, e) {
|
|
552
|
+
const s = e.filter((i) => i.kind === "command").length > 1;
|
|
553
|
+
return this._submissionError = s ? this._messages.multipleCommands : !t.trim() && e.length > 0 && !this.#m(e) ? this._messages.partsOnlyRequiresAgent : null, this._submissionError ? (this.arcgisError.emit(new Error(this._submissionError)), !1) : !0;
|
|
554
|
+
}
|
|
555
|
+
async #_() {
|
|
556
|
+
await $.checkSignInStatus(this.#s.url);
|
|
531
557
|
const t = await this.#s.load();
|
|
532
558
|
if (!t.helperServices?.aiAssistantServices?.url)
|
|
533
559
|
throw new Error(this._messages.serviceUrlNotAvailableMessage);
|
|
534
560
|
let s = !1;
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
561
|
+
const i = await t.fetchSettings();
|
|
562
|
+
if (i.aiConfig ? s = i.aiConfig.aiForOrg?.enabled === !0 && i.aiConfig.aiForOrg?.aiCapabilities?.aiAgents?.enabled === !0 : s = i.aiAssistantsEnabled === !0, !s)
|
|
537
563
|
throw new Error(this._messages.aiAssistantsNotEnabledMessage);
|
|
538
564
|
if (!t.isPortal && !(t?.user?.privileges?.includes("portal:user:useAIAssistants") === !0))
|
|
539
565
|
throw new Error(this._messages.userPrivilegesNotSufficientMessage);
|
|
540
566
|
}
|
|
541
|
-
async #
|
|
567
|
+
async #g() {
|
|
542
568
|
try {
|
|
543
569
|
this._error = null;
|
|
544
570
|
const t = j(this.el, this.referenceElement);
|
|
545
571
|
await t?.componentOnReady();
|
|
546
572
|
const e = [...this.#r.values()];
|
|
547
|
-
return e.length ? (await this.#
|
|
573
|
+
return e.length ? (await this.#_(), this._orchestratorController?.destroy(), this._orchestratorController = new b({
|
|
548
574
|
agents: e,
|
|
549
575
|
portal: this.#s,
|
|
550
576
|
runtimeEventsEnabled: this.runtimeEventsEnabled,
|
|
@@ -556,30 +582,30 @@ class et extends B {
|
|
|
556
582
|
}
|
|
557
583
|
}
|
|
558
584
|
async #p() {
|
|
559
|
-
await this.#
|
|
585
|
+
await this.#g() ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
560
586
|
}
|
|
561
587
|
_reset() {
|
|
562
|
-
this._orchestratorController?.cancel(), this.#e?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "", this._signedInUserId = void 0;
|
|
588
|
+
this._orchestratorController?.cancel(), this.#e?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._submissionError = null, this._inputValue = "", this._signedInUserId = void 0;
|
|
563
589
|
}
|
|
564
590
|
_renderEntryMessage() {
|
|
565
|
-
return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null :
|
|
591
|
+
return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : h`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : h`<slot name=entry-message></slot>` : this._renderSignInNotice();
|
|
566
592
|
}
|
|
567
593
|
_renderSignInNotice() {
|
|
568
594
|
const t = this.#s;
|
|
569
|
-
return
|
|
595
|
+
return h`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t ? h`<calcite-link slot=link @click=${async () => {
|
|
570
596
|
try {
|
|
571
|
-
const e = await
|
|
597
|
+
const e = await $.getCredential(`${t.url}/sharing`);
|
|
572
598
|
this._signedInUserId = e.userId, this._error = null, this.requestUpdate(), await this.#p();
|
|
573
599
|
} catch (e) {
|
|
574
600
|
this._error = e?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)), z.log("error", this, "Error signing in:", { detail: { error: e } });
|
|
575
601
|
}
|
|
576
|
-
}} target=_blank title=${this._messages.signInToArcGISOnlineLabel ??
|
|
602
|
+
}} target=_blank title=${this._messages.signInToArcGISOnlineLabel ?? v}>${this._messages.signInLabel}</calcite-link>` : h`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`;
|
|
577
603
|
}
|
|
578
604
|
_renderErrorNotice() {
|
|
579
|
-
return this._error ?
|
|
605
|
+
return this._error ? h`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === X ? h`<div slot=message>${Y}</div><calcite-link slot=link .href=${tt} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel ?? v}>${this._messages.readMoreLabel}</calcite-link>` : h`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
580
606
|
}
|
|
581
607
|
render() {
|
|
582
|
-
return
|
|
608
|
+
return h`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${E(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((t) => t.role === "assistant" ? h`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#u} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e, s) => h`<slot name=${I(t.id, s) ?? v} slot=${I(t.id, s) ?? v}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : h`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? h`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>` : h`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt ? h`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${E(this.#i)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? h`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}${this._submissionError ? h`<div role=alert>${this._submissionError}</div>` : null}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse || this._isAnswering} .commandProvider=${this.commandProvider} .entityProviders=${this.entityProviders} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling || !this._isSignedIn || !!this._interrupt || !!this._error} ${E(this.#o)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse || this._isAnswering ? "circle-stop" : "send"} @click=${() => {
|
|
583
609
|
this.#o.value?.submitMessage();
|
|
584
610
|
}} round>${this.awaitingResponse || this._isAnswering ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
|
|
585
611
|
}
|