@arcgis/ai-components 5.1.0-next.87 → 5.1.0-next.89
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/cdn/4IESERNN.js +2 -0
- package/dist/cdn/{GJQVEIZF.js → 7AAA466K.js} +1 -1
- package/dist/cdn/B3E2XBTX.js +2 -0
- package/dist/cdn/E2MBKDZ2.js +2 -0
- package/dist/cdn/EUNEQNYC.js +2 -0
- package/dist/cdn/JEO7CHZM.js +2 -0
- package/dist/cdn/{KWBMH7LU.js → K35QKERW.js} +5 -0
- package/dist/cdn/KCSGJGUQ.js +2 -0
- package/dist/cdn/{FTUILS6R.js → KHCTRS6Z.js} +21 -21
- package/dist/cdn/O3Y4IPK5.js +2 -0
- package/dist/cdn/SOJ4DKGV.js +226 -0
- package/dist/cdn/TD74ZINA.js +2 -0
- package/dist/cdn/{NCMEKPIM.js → TFP2SGKU.js} +1 -1
- package/dist/cdn/{4TY43HO3.js → UTCN4YUI.js} +1 -1
- package/dist/cdn/VDGRXEK7.js +2 -0
- package/dist/cdn/VHOF6SUZ.js +120 -0
- package/dist/cdn/{2FQTU6HL.js → WBVJLC7F.js} +1 -1
- package/dist/cdn/X2GSYADT.js +2 -0
- package/dist/cdn/YUZDB6IX.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/slottableRequestUtils.js +11 -0
- package/dist/components/arcgis-assistant/customElement.d.ts +16 -1
- package/dist/components/arcgis-assistant/customElement.js +116 -112
- package/dist/components/arcgis-assistant/index.js +2 -0
- package/dist/components/arcgis-assistant/types.d.ts +2 -4
- package/dist/components/arcgis-assistant-message/customElement.js +26 -12
- package/dist/components/arcgis-assistant-message/index.js +0 -1
- 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/index.d.ts +0 -14
- package/dist/loader.js +0 -1
- package/dist/types/lumina.d.ts +1 -11
- package/dist/types/preact.d.ts +1 -13
- package/dist/types/react.d.ts +1 -15
- package/dist/types/stencil.d.ts +1 -11
- package/package.json +6 -6
- package/dist/cdn/3IWT4SEI.js +0 -2
- package/dist/cdn/AAOF7JQT.js +0 -2
- package/dist/cdn/ERCMPLS4.js +0 -82
- package/dist/cdn/HLDIWEWD.js +0 -2
- package/dist/cdn/KJFC3ZEP.js +0 -2
- package/dist/cdn/MDPF56RC.js +0 -2
- package/dist/cdn/OFWYCHDQ.js +0 -2
- package/dist/cdn/QTH2DYCO.js +0 -2
- package/dist/cdn/UWXD5PFQ.js +0 -2
- package/dist/cdn/VSZNNBU6.js +0 -2
- package/dist/cdn/XMI2K6YV.js +0 -2
- package/dist/cdn/ZIER3BNM.js +0 -226
- package/dist/components/arcgis-assistant-message/customElement.d.ts +0 -18
- package/dist/components/arcgis-assistant-message/index.d.ts +0 -1
- package/dist/components/arcgis-assistant-message-content/customElement.d.ts +0 -12
- package/dist/components/arcgis-assistant-message-content/customElement.js +0 -62
- package/dist/components/arcgis-assistant-message-content/index.d.ts +0 -1
- package/dist/components/arcgis-assistant-message-content/index.js +0 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./SOJ4DKGV.js";import b from"./KHCTRS6Z.js";import"./PLPJJRCP.js";import{a as e,c as a}from"./B4DEC7PH.js";import"./KVH3PDVW.js";import"./YGW7TUNX.js";import{v as s,y as r}from"./AKEZZ3RP.js";import"./CFDTXKJ6.js";export default $arcgis.t(([,{c:i}])=>{var t=class extends s{constructor(){super(...arguments),this.agent=i}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=e(this,"arcgis-assistant-layer-styling-agent"),a(this)}};r("arcgis-assistant-layer-styling-agent",t);return t},b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{a as _,b as f}from"./EUNEQNYC.js";import b from"./KHCTRS6Z.js";import{a as C}from"./YUZDB6IX.js";import"./B3E2XBTX.js";import"./PLPJJRCP.js";import{a as P}from"./KVH3PDVW.js";import"./YGW7TUNX.js";import{g as E,h as a,l as $,n,t as y,u as v,v as k,w as m,y as S}from"./AKEZZ3RP.js";import"./CFDTXKJ6.js";export default $arcgis.t(([R,{whenOnce:O,watch:M,when:A},V,q,{property:d,subclass:z},{d:I}])=>{var j=E`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}.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%}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}`,H=Object.defineProperty,N=Object.getOwnPropertyDescriptor,h=(g,t,e,i)=>{for(var s=i>1?void 0:i?N(t,e):t,r=g.length-1,o;r>=0;r--)(o=g[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&H(t,e,s),s},l=class extends q{constructor(g){super(g),this.view=null,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await O(()=>!this.view.updating),this._set("orchestrator",await I.init({agents:[...this.agents],view:this.view??void 0})),this.addHandles([M(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(g,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let e=[],i;try{let s=this.orchestrator.ask(g);for await(let r of s){let o=r.runId;if(t?.aborted){yield{type:"cancelled",runId:o};break}switch(r.type){case"trace":{this._set("processingStep",r.data.text),e.push(r.data.text);break}case"completed":{let c=r.result,p=!!c.content.length,b=!!i?.length;if(!p&&!b){yield{type:"completed",error:"Could not process the request.",log:e,runId:o};return}let u=c.content;this._set("processingStep",""),yield{type:"completed",response:u,blocks:i,log:e,runId:o};return}case"ux-suggestion":{let c=r.suggestion;i=i?[...i,c]:[c];break}case"interrupt":{let{kind:c,message:p,metadata:b}=r.interrupt,u=Array.isArray(b)?b.filter(L=>typeof L=="string"):[],x=(()=>{switch(c){case"booleanChoice":return{type:"boolean-choice",message:p,options:u};case"singleSelection":return{type:"single-select",message:p,options:u};case"multipleSelection":return{type:"multi-select",message:p,options:u};case"textInput":return{type:"text-input",message:p};default:return{type:c,message:p,options:u}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:x,runId:o};break}case"cancelled":{yield{type:"cancelled",runId:o};return}case"error":{yield{type:"completed",error:r.error.message,log:e,runId:o};return}default:{console.warn("Unknown event type:",r);break}}}}catch(s){console.warn("Error during message processing:",s),yield{type:"completed",error:"An error occurred during message processing.",log:e,runId:"error"};return}finally{this._set("processing",!1)}}};h([d({readOnly:!0})],l.prototype,"orchestrator",2);h([d()],l.prototype,"agents",2);h([d()],l.prototype,"portal",2);h([d()],l.prototype,"view",2);h([d({readOnly:!0})],l.prototype,"loading",2);h([d({readOnly:!0})],l.prototype,"processing",2);h([d({readOnly:!0})],l.prototype,"processingStep",2);l=h([z("OrchestratorController")],l);var D="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",B="Embeddings not found for this web map.",F="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",w=class extends k{constructor(){super(...arguments),this._messages=C({blocking:!0}),this.#t=y(),this.#n=y(),this.#e=y(),this.#s=null,this.#o=new Map,this.#r=V.getDefault(),this.#i=t=>{t.stopPropagation(),this.cancelInterrupt()},this.#a=t=>{t.stopPropagation();let e=t.detail;this.submitInterrupt(e)},this.#l=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let e=t.detail;this._inputValue="",this.arcgisSubmit.emit(e),this.submitMessage(e)},this.#c=t=>{if(t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this.#s?.abort()},this.#h=t=>{t.stopPropagation();let e=t.detail;this.arcgisFeedback.emit(e)},this.#g=t=>{t.stopPropagation();let e=t.detail;this._inputValue=e.prompt,this.arcgisPromptSelect.emit(e)},this.#p=t=>{this.arcgisSlottableRequest.emit(t.detail)},this._orchestratorController=null,this._interrupt=null,this._error=null,this._inputValue="",this.messages=new R([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.arcgisCancel=n(),this.arcgisError=n(),this.arcgisFeedback=n(),this.arcgisInterrupt=n(),this.arcgisInterruptCancel=n(),this.arcgisInterruptSubmit=n(),this.arcgisPromptSelect=n(),this.arcgisReady=n(),this.arcgisSubmit=n(),this.arcgisSlottableRequest=n({bubbles:!1,composed:!1})}static{this.properties={_orchestratorController:16,_interrupt:16,_error:16,_inputValue:16,_user:16,awaitingResponse:32,awaitingResponseStep:32,interrupt:32,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5}}static{this.styles=j}#t;#n;#e;#s;#o;#r;#i;#a;#l;#c;#h;#g;#p;async#d(){try{let t=P(this.el,this.referenceElement);await t?.componentOnReady();let e=[...this.#o.values()];return e.length?(this._orchestratorController=new l({agents:e,portal:this.#r,view:t?.view}),await this._orchestratorController.load(),!0):(this._error="No agents found.",!1)}catch(t){return this._error=t?.message??"Error initializing orchestrator.",$(this)(t),!1}}get _user(){return this.#r?.user?.fullName||this.#r?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}register(t){this.#o.set(t.agent.id,t)}async submitMessage(t){let e=t.trim();if(!e||(this.messages.push({id:Date.now().toString(),role:"user",content:e}),!this._orchestratorController))return;let i=this._orchestratorController.ask(e,this.#s?.signal);for await(let s of i){let r=s.runId;switch(s.type){case"completed":this.messages.push({role:"assistant",content:s.response,blocks:s.blocks,log:s.log,error:s.error,id:r});break;case"interrupt":this._interrupt={...s.payload,id:r},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":this.messages.push({role:"assistant",error:"Request cancelled.",id:r});break}}}submitInterrupt(t){this.arcgisInterruptSubmit.emit(t),this.orchestrator?.resumeInterrupt(t),this._interrupt=null}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisPromptSelect",this.#g),this.#t.value?.addEventListener("arcgisSubmit",this.#l),this.#t.value?.addEventListener("arcgisCancel",this.#c),this.#t.value?.addEventListener("arcgisFeedback",this.#h);let t=A(()=>!!this._interrupt&&!!this.#e.value,()=>{let e=this.#e.value;e.removeEventListener("arcgisSubmit",this.#a),e.removeEventListener("arcgisCancel",this.#i),e.addEventListener("arcgisSubmit",this.#a,{once:!0}),e.addEventListener("arcgisCancel",this.#i,{once:!0})});return queueMicrotask(()=>{this.#d().then(e=>{e?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{t.remove(),this.#t.value?.removeEventListener("arcgisPromptSelect",this.#g),this.#e.value?.removeEventListener("arcgisSubmit",this.#a),this.#e.value?.removeEventListener("arcgisCancel",this.#i),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}})}_reset(){this.#s?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._inputValue=""}_renderEntryMessage(){return this._interrupt?a`<slot name=interrupt><arcgis-assistant-interrupt .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${v(this.#e)}></arcgis-assistant-interrupt></slot>`:this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:a`<calcite-notice open kind=info closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:a`<slot name=entry-message></slot>`}_renderErrorNotice(){return this._error?a`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error===D?a`<div slot=message>${B}</div><calcite-link slot=link .href=${F} target=_blank title="Learn about web map embeddings">Read more</calcite-link>`:a`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}_renderSuggestedPrompts(){return this.suggestedPrompts?.length?a`<div class="suggested-prompts-container"><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>`:null}render(){return a`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${v(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}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map(t=>t.role==="assistant"?a`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p}><slot name=${_(t.id)??m} slot=${_(t.id)??m}>${t?.error?a`<calcite-notice class="error-notice" open icon kind=warning width=full><div slot=message>${t.error}</div></calcite-notice>`:a`<arcgis-assistant-message-text .content=${t?.content}></arcgis-assistant-message-text>`}</slot>${t.blocks?.map((e,i)=>a`<slot name=${f(t.id,i)??m} slot=${f(t.id,i)??m}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:a`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot><slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep}></arcgis-assistant-message-loading></slot></arcgis-assistant-chat></div>${this._renderSuggestedPrompts()}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} ${v(this.#n)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse?"circle-stop":"send"} @click=${()=>{this.#n.value?.submitMessage()}} round>${this.awaitingResponse?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`}};S("arcgis-assistant",w);return w},"core/Collection","core/reactiveUtils","portal/Portal","core/Accessor","core/accessorSupport/decorators",b)
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{p as s,x as e}from"./AKEZZ3RP.js";import"./CFDTXKJ6.js";var a=s(e,{"arcgis-assistant":[()=>import("./
|
|
2
|
+
import{p as s,x as e}from"./AKEZZ3RP.js";import"./CFDTXKJ6.js";var a=s(e,{"arcgis-assistant":[()=>import("./X2GSYADT.js"),"_messages:,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,suggestedPrompts:,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt"],"arcgis-assistant-agent":[()=>import("./FZWNOKWO.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./UTCN4YUI.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./TFP2SGKU.js"),"referenceElement;;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./WBVJLC7F.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./7AAA466K.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./XUCS7JNA.js"),"loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./VDGRXEK7.js"),"_messages:,awaitingResponse,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./KCSGJGUQ.js"),"_messages:,message,options:,type"],"arcgis-assistant-message":[()=>import("./TD74ZINA.js"),"copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./4MLHX7X5.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./O3Y4IPK5.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./4IESERNN.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./FFQBDX6W.js"),"loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./SNXQTZ5B.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./JEO7CHZM.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./6LFDWHQ4.js"),"content"],"arcgis-assistant-speech-input":[()=>import("./NY6TBJUU.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./E2MBKDZ2.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./QUVGX4PA.js"),"content,message:,user"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,e)
|
package/dist/cdn/main.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message
|
|
1
|
+
@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type Collection from "@arcgis/core/core/Collection.js";
|
|
3
3
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
4
|
-
import type { AssistantMessage, AssistantPromptSelectDetail, ChatMessage, Interrupt } from "./types.js";
|
|
4
|
+
import type { AssistantMessage, AssistantPromptSelectDetail, AssistantSlottableRequestDetail, ChatMessage, Interrupt } from "./types.js";
|
|
5
5
|
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
6
6
|
import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/arcgis-map";
|
|
7
7
|
|
|
@@ -420,6 +420,20 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
420
420
|
* ```
|
|
421
421
|
*/
|
|
422
422
|
readonly arcgisReady: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
423
|
+
/**
|
|
424
|
+
* Emitted when the assistant requests custom slotted content for an assistant message.
|
|
425
|
+
* The event detail includes the request name, the target slot name, and the data needed to render or update custom content.
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* ```js
|
|
429
|
+
* const assistant = document.querySelector("arcgis-assistant");
|
|
430
|
+
* assistant.addEventListener("arcgisSlottableRequest", (event) => {
|
|
431
|
+
* const { name, slotName, data } = event.detail;
|
|
432
|
+
* // Render or update custom content for the requested slot
|
|
433
|
+
* });
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
readonly arcgisSlottableRequest: import("@arcgis/lumina").TargetedEvent<this, AssistantSlottableRequestDetail>;
|
|
423
437
|
/**
|
|
424
438
|
* Emitted when the user submits a message. This is typically invoked when a user clicks the submit button in the chat interface or hits the Enter key.
|
|
425
439
|
*
|
|
@@ -442,6 +456,7 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
442
456
|
arcgisInterruptSubmit: ArcgisAssistant["arcgisInterruptSubmit"]["detail"];
|
|
443
457
|
arcgisPromptSelect: ArcgisAssistant["arcgisPromptSelect"]["detail"];
|
|
444
458
|
arcgisReady: ArcgisAssistant["arcgisReady"]["detail"];
|
|
459
|
+
arcgisSlottableRequest: ArcgisAssistant["arcgisSlottableRequest"]["detail"];
|
|
445
460
|
arcgisSubmit: ArcgisAssistant["arcgisSubmit"]["detail"];
|
|
446
461
|
};
|
|
447
462
|
}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import
|
|
5
|
-
import { whenOnce as
|
|
6
|
-
import
|
|
7
|
-
import { LitElement as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import { g as
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import { c as $ } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as k, html as a } from "lit";
|
|
4
|
+
import S from "@arcgis/core/core/Collection.js";
|
|
5
|
+
import { whenOnce as C, watch as L, when as I } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
|
+
import P from "@arcgis/core/portal/Portal.js";
|
|
7
|
+
import { LitElement as R, createEvent as o, nothing as b } from "@arcgis/lumina";
|
|
8
|
+
import { rethrowError as x } from "@arcgis/toolkit/log";
|
|
9
|
+
import { createRef as f, ref as y } from "lit/directives/ref.js";
|
|
10
|
+
import { u as M } from "../../chunks/useT9n.js";
|
|
11
|
+
import { Orchestrator as O } from "@arcgis/ai-orchestrator";
|
|
12
|
+
import A from "@arcgis/core/core/Accessor.js";
|
|
13
|
+
import { property as u, subclass as q } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
14
|
+
import { g as z } from "../../chunks/utils2.js";
|
|
15
|
+
import { g as v, a as _ } from "../../chunks/slottableRequestUtils.js";
|
|
16
|
+
const V = k`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}.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%}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}`;
|
|
17
|
+
var N = Object.defineProperty, j = Object.getOwnPropertyDescriptor, h = (g, t, e, i) => {
|
|
18
|
+
for (var s = i > 1 ? void 0 : i ? j(t, e) : t, r = g.length - 1, n; r >= 0; r--)
|
|
19
|
+
(n = g[r]) && (s = (i ? n(t, e, s) : n(s)) || s);
|
|
20
|
+
return i && s && N(t, e, s), s;
|
|
20
21
|
};
|
|
21
|
-
let
|
|
22
|
-
constructor(
|
|
23
|
-
super(
|
|
22
|
+
let l = class extends A {
|
|
23
|
+
constructor(g) {
|
|
24
|
+
super(g), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
|
|
24
25
|
}
|
|
25
26
|
async load() {
|
|
26
27
|
this._set("loading", !0);
|
|
@@ -34,14 +35,14 @@ let o = class extends P {
|
|
|
34
35
|
this.orchestrator?.dispose(), super.destroy();
|
|
35
36
|
}
|
|
36
37
|
async _initialize() {
|
|
37
|
-
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await
|
|
38
|
+
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await C(() => !this.view.updating), this._set(
|
|
38
39
|
"orchestrator",
|
|
39
|
-
await
|
|
40
|
+
await O.init({
|
|
40
41
|
agents: [...this.agents],
|
|
41
42
|
view: this.view ?? void 0
|
|
42
43
|
})
|
|
43
44
|
), this.addHandles([
|
|
44
|
-
|
|
45
|
+
L(
|
|
45
46
|
() => [this.view, this.agents],
|
|
46
47
|
() => {
|
|
47
48
|
this._initialize();
|
|
@@ -52,33 +53,33 @@ let o = class extends P {
|
|
|
52
53
|
clearChatHistory() {
|
|
53
54
|
this.orchestrator?.newConversation();
|
|
54
55
|
}
|
|
55
|
-
async *ask(
|
|
56
|
+
async *ask(g, t) {
|
|
56
57
|
if (!this.orchestrator)
|
|
57
58
|
throw new Error("Orchestrator not initialized yet.");
|
|
58
59
|
this._set("processing", !0), this._set("processingStep", "");
|
|
59
|
-
const
|
|
60
|
+
const e = [];
|
|
60
61
|
let i;
|
|
61
62
|
try {
|
|
62
|
-
const s = this.orchestrator.ask(
|
|
63
|
+
const s = this.orchestrator.ask(g);
|
|
63
64
|
for await (const r of s) {
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
yield { type: "cancelled", runId:
|
|
65
|
+
const n = r.runId;
|
|
66
|
+
if (t?.aborted) {
|
|
67
|
+
yield { type: "cancelled", runId: n };
|
|
67
68
|
break;
|
|
68
69
|
}
|
|
69
70
|
switch (r.type) {
|
|
70
71
|
case "trace": {
|
|
71
|
-
this._set("processingStep", r.data.text),
|
|
72
|
+
this._set("processingStep", r.data.text), e.push(r.data.text);
|
|
72
73
|
break;
|
|
73
74
|
}
|
|
74
75
|
case "completed": {
|
|
75
|
-
const c = r.result,
|
|
76
|
-
if (!
|
|
77
|
-
yield { type: "completed", error: "Could not process the request.", log:
|
|
76
|
+
const c = r.result, p = !!c.content.length, m = !!i?.length;
|
|
77
|
+
if (!p && !m) {
|
|
78
|
+
yield { type: "completed", error: "Could not process the request.", log: e, runId: n };
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
const d = c.content;
|
|
81
|
-
this._set("processingStep", ""), yield { type: "completed", response: d, blocks: i, log:
|
|
82
|
+
this._set("processingStep", ""), yield { type: "completed", response: d, blocks: i, log: e, runId: n };
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
84
85
|
case "ux-suggestion": {
|
|
@@ -87,29 +88,29 @@ let o = class extends P {
|
|
|
87
88
|
break;
|
|
88
89
|
}
|
|
89
90
|
case "interrupt": {
|
|
90
|
-
const { kind: c, message:
|
|
91
|
+
const { kind: c, message: p, metadata: m } = r.interrupt, d = Array.isArray(m) ? m.filter((E) => typeof E == "string") : [], w = (() => {
|
|
91
92
|
switch (c) {
|
|
92
93
|
case "booleanChoice":
|
|
93
|
-
return { type: "boolean-choice", message:
|
|
94
|
+
return { type: "boolean-choice", message: p, options: d };
|
|
94
95
|
case "singleSelection":
|
|
95
|
-
return { type: "single-select", message:
|
|
96
|
+
return { type: "single-select", message: p, options: d };
|
|
96
97
|
case "multipleSelection":
|
|
97
|
-
return { type: "multi-select", message:
|
|
98
|
+
return { type: "multi-select", message: p, options: d };
|
|
98
99
|
case "textInput":
|
|
99
|
-
return { type: "text-input", message:
|
|
100
|
+
return { type: "text-input", message: p };
|
|
100
101
|
default:
|
|
101
|
-
return { type: c, message:
|
|
102
|
+
return { type: c, message: p, options: d };
|
|
102
103
|
}
|
|
103
104
|
})();
|
|
104
|
-
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload:
|
|
105
|
+
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: w, runId: n };
|
|
105
106
|
break;
|
|
106
107
|
}
|
|
107
108
|
case "cancelled": {
|
|
108
|
-
yield { type: "cancelled", runId:
|
|
109
|
+
yield { type: "cancelled", runId: n };
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
112
|
case "error": {
|
|
112
|
-
yield { type: "completed", error: r.error.message, log:
|
|
113
|
+
yield { type: "completed", error: r.error.message, log: e, runId: n };
|
|
113
114
|
return;
|
|
114
115
|
}
|
|
115
116
|
default: {
|
|
@@ -119,7 +120,7 @@ let o = class extends P {
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
} catch (s) {
|
|
122
|
-
console.warn("Error during message processing:", s), yield { type: "completed", error: "An error occurred during message processing.", log:
|
|
123
|
+
console.warn("Error during message processing:", s), yield { type: "completed", error: "An error occurred during message processing.", log: e, runId: "error" };
|
|
123
124
|
return;
|
|
124
125
|
} finally {
|
|
125
126
|
this._set("processing", !1);
|
|
@@ -128,66 +129,68 @@ let o = class extends P {
|
|
|
128
129
|
};
|
|
129
130
|
h([
|
|
130
131
|
u({ readOnly: !0 })
|
|
131
|
-
],
|
|
132
|
+
], l.prototype, "orchestrator", 2);
|
|
132
133
|
h([
|
|
133
134
|
u()
|
|
134
|
-
],
|
|
135
|
+
], l.prototype, "agents", 2);
|
|
135
136
|
h([
|
|
136
137
|
u()
|
|
137
|
-
],
|
|
138
|
+
], l.prototype, "portal", 2);
|
|
138
139
|
h([
|
|
139
140
|
u()
|
|
140
|
-
],
|
|
141
|
+
], l.prototype, "view", 2);
|
|
141
142
|
h([
|
|
142
143
|
u({ readOnly: !0 })
|
|
143
|
-
],
|
|
144
|
+
], l.prototype, "loading", 2);
|
|
144
145
|
h([
|
|
145
146
|
u({ readOnly: !0 })
|
|
146
|
-
],
|
|
147
|
+
], l.prototype, "processing", 2);
|
|
147
148
|
h([
|
|
148
149
|
u({ readOnly: !0 })
|
|
149
|
-
],
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
],
|
|
153
|
-
const
|
|
154
|
-
class
|
|
150
|
+
], l.prototype, "processingStep", 2);
|
|
151
|
+
l = h([
|
|
152
|
+
q("OrchestratorController")
|
|
153
|
+
], l);
|
|
154
|
+
const B = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", H = "Embeddings not found for this web map.", D = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
155
|
+
class F extends R {
|
|
155
156
|
constructor() {
|
|
156
|
-
super(...arguments), this._messages =
|
|
157
|
-
|
|
158
|
-
}, this.#a = (
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
this.submitInterrupt(
|
|
162
|
-
}, this.#l = (
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
this._inputValue = "", this.arcgisSubmit.emit(
|
|
166
|
-
}, this.#c = (
|
|
167
|
-
if (
|
|
157
|
+
super(...arguments), this._messages = M({ blocking: !0 }), this.#t = f(), this.#n = f(), this.#e = f(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = P.getDefault(), this.#i = (t) => {
|
|
158
|
+
t.stopPropagation(), this.cancelInterrupt();
|
|
159
|
+
}, this.#a = (t) => {
|
|
160
|
+
t.stopPropagation();
|
|
161
|
+
const e = t.detail;
|
|
162
|
+
this.submitInterrupt(e);
|
|
163
|
+
}, this.#l = (t) => {
|
|
164
|
+
t.stopPropagation(), this.keepSuggestedPrompts || (this.suggestedPrompts = []);
|
|
165
|
+
const e = t.detail;
|
|
166
|
+
this._inputValue = "", this.arcgisSubmit.emit(e), this.submitMessage(e);
|
|
167
|
+
}, this.#c = (t) => {
|
|
168
|
+
if (t.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
|
|
168
169
|
this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
169
170
|
return;
|
|
170
171
|
}
|
|
171
172
|
this.#s?.abort();
|
|
172
|
-
}, this.#h = (
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
this.arcgisFeedback.emit(
|
|
176
|
-
}, this.#
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
this._inputValue =
|
|
180
|
-
}, this
|
|
173
|
+
}, this.#h = (t) => {
|
|
174
|
+
t.stopPropagation();
|
|
175
|
+
const e = t.detail;
|
|
176
|
+
this.arcgisFeedback.emit(e);
|
|
177
|
+
}, this.#g = (t) => {
|
|
178
|
+
t.stopPropagation();
|
|
179
|
+
const e = t.detail;
|
|
180
|
+
this._inputValue = e.prompt, this.arcgisPromptSelect.emit(e);
|
|
181
|
+
}, this.#p = (t) => {
|
|
182
|
+
this.arcgisSlottableRequest.emit(t.detail);
|
|
183
|
+
}, this._orchestratorController = null, this._interrupt = null, this._error = null, this._inputValue = "", this.messages = new S([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.arcgisCancel = o(), this.arcgisError = o(), this.arcgisFeedback = o(), this.arcgisInterrupt = o(), this.arcgisInterruptCancel = o(), this.arcgisInterruptSubmit = o(), this.arcgisPromptSelect = o(), this.arcgisReady = o(), this.arcgisSubmit = o(), this.arcgisSlottableRequest = o({ bubbles: !1, composed: !1 });
|
|
181
184
|
}
|
|
182
185
|
static {
|
|
183
186
|
this.properties = { _orchestratorController: 16, _interrupt: 16, _error: 16, _inputValue: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5 };
|
|
184
187
|
}
|
|
185
188
|
static {
|
|
186
|
-
this.styles =
|
|
189
|
+
this.styles = V;
|
|
187
190
|
}
|
|
188
|
-
#e;
|
|
189
|
-
#n;
|
|
190
191
|
#t;
|
|
192
|
+
#n;
|
|
193
|
+
#e;
|
|
191
194
|
#s;
|
|
192
195
|
#o;
|
|
193
196
|
#r;
|
|
@@ -196,19 +199,20 @@ class D extends I {
|
|
|
196
199
|
#l;
|
|
197
200
|
#c;
|
|
198
201
|
#h;
|
|
202
|
+
#g;
|
|
199
203
|
#p;
|
|
200
|
-
async #
|
|
204
|
+
async #u() {
|
|
201
205
|
try {
|
|
202
|
-
const
|
|
203
|
-
await
|
|
204
|
-
const
|
|
205
|
-
return
|
|
206
|
-
agents:
|
|
206
|
+
const t = z(this.el, this.referenceElement);
|
|
207
|
+
await t?.componentOnReady();
|
|
208
|
+
const e = [...this.#o.values()];
|
|
209
|
+
return e.length ? (this._orchestratorController = new l({
|
|
210
|
+
agents: e,
|
|
207
211
|
portal: this.#r,
|
|
208
|
-
view:
|
|
212
|
+
view: t?.view
|
|
209
213
|
}), await this._orchestratorController.load(), !0) : (this._error = "No agents found.", !1);
|
|
210
|
-
} catch (
|
|
211
|
-
return this._error =
|
|
214
|
+
} catch (t) {
|
|
215
|
+
return this._error = t?.message ?? "Error initializing orchestrator.", x(this)(t), !1;
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
218
|
get _user() {
|
|
@@ -232,19 +236,19 @@ class D extends I {
|
|
|
232
236
|
cancelInterrupt() {
|
|
233
237
|
this.arcgisInterruptCancel.emit(), this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
234
238
|
}
|
|
235
|
-
register(
|
|
236
|
-
this.#o.set(
|
|
239
|
+
register(t) {
|
|
240
|
+
this.#o.set(t.agent.id, t);
|
|
237
241
|
}
|
|
238
|
-
async submitMessage(
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
242
|
+
async submitMessage(t) {
|
|
243
|
+
const e = t.trim();
|
|
244
|
+
if (!e || (this.messages.push({
|
|
241
245
|
id: Date.now().toString(),
|
|
242
246
|
// TODO: Replace with a more robust ID generation method or get from orchestrator
|
|
243
247
|
role: "user",
|
|
244
|
-
content:
|
|
248
|
+
content: e
|
|
245
249
|
}), !this._orchestratorController))
|
|
246
250
|
return;
|
|
247
|
-
const i = this._orchestratorController.ask(
|
|
251
|
+
const i = this._orchestratorController.ask(e, this.#s?.signal);
|
|
248
252
|
for await (const s of i) {
|
|
249
253
|
const r = s.runId;
|
|
250
254
|
switch (s.type) {
|
|
@@ -271,25 +275,25 @@ class D extends I {
|
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
277
|
}
|
|
274
|
-
submitInterrupt(
|
|
275
|
-
this.arcgisInterruptSubmit.emit(
|
|
278
|
+
submitInterrupt(t) {
|
|
279
|
+
this.arcgisInterruptSubmit.emit(t), this.orchestrator?.resumeInterrupt(t), this._interrupt = null;
|
|
276
280
|
}
|
|
277
281
|
load() {
|
|
278
282
|
this.manager.onLifecycle(this._reset.bind(this));
|
|
279
283
|
}
|
|
280
284
|
loaded() {
|
|
281
285
|
this.manager.onLifecycle(() => {
|
|
282
|
-
this.#
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
+
this.#t.value?.addEventListener("arcgisPromptSelect", this.#g), this.#t.value?.addEventListener("arcgisSubmit", this.#l), this.#t.value?.addEventListener("arcgisCancel", this.#c), this.#t.value?.addEventListener("arcgisFeedback", this.#h);
|
|
287
|
+
const t = I(() => !!this._interrupt && !!this.#e.value, () => {
|
|
288
|
+
const e = this.#e.value;
|
|
289
|
+
e.removeEventListener("arcgisSubmit", this.#a), e.removeEventListener("arcgisCancel", this.#i), e.addEventListener("arcgisSubmit", this.#a, { once: !0 }), e.addEventListener("arcgisCancel", this.#i, { once: !0 });
|
|
286
290
|
});
|
|
287
291
|
return queueMicrotask(() => {
|
|
288
|
-
this.#
|
|
289
|
-
|
|
292
|
+
this.#u().then((e) => {
|
|
293
|
+
e ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
290
294
|
});
|
|
291
295
|
}), () => {
|
|
292
|
-
|
|
296
|
+
t.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#g), this.#e.value?.removeEventListener("arcgisSubmit", this.#a), this.#e.value?.removeEventListener("arcgisCancel", this.#i), 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;
|
|
293
297
|
};
|
|
294
298
|
});
|
|
295
299
|
}
|
|
@@ -297,21 +301,21 @@ class D extends I {
|
|
|
297
301
|
this.#s?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "";
|
|
298
302
|
}
|
|
299
303
|
_renderEntryMessage() {
|
|
300
|
-
return this._interrupt ?
|
|
304
|
+
return this._interrupt ? a`<slot name=interrupt><arcgis-assistant-interrupt .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#e)}></arcgis-assistant-interrupt></slot>` : this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : a`<calcite-notice open kind=info closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : a`<slot name=entry-message></slot>`;
|
|
301
305
|
}
|
|
302
306
|
_renderErrorNotice() {
|
|
303
|
-
return this._error ?
|
|
307
|
+
return this._error ? a`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error === B ? a`<div slot=message>${H}</div><calcite-link slot=link .href=${D} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : a`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
304
308
|
}
|
|
305
309
|
_renderSuggestedPrompts() {
|
|
306
|
-
return this.suggestedPrompts?.length ?
|
|
310
|
+
return this.suggestedPrompts?.length ? a`<div class="suggested-prompts-container"><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null;
|
|
307
311
|
}
|
|
308
312
|
render() {
|
|
309
|
-
return
|
|
313
|
+
return a`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${y(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}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((t) => t.role === "assistant" ? a`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p}><slot name=${v(t.id) ?? b} slot=${v(t.id) ?? b}>${t?.error ? a`<calcite-notice class="error-notice" open icon kind=warning width=full><div slot=message>${t.error}</div></calcite-notice>` : a`<arcgis-assistant-message-text .content=${t?.content}></arcgis-assistant-message-text>`}</slot>${t.blocks?.map((e, i) => a`<slot name=${_(t.id, i) ?? b} slot=${_(t.id, i) ?? b}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : a`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot><slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep}></arcgis-assistant-message-loading></slot></arcgis-assistant-chat></div>${this._renderSuggestedPrompts()}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} ${y(this.#n)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse ? "circle-stop" : "send"} @click=${() => {
|
|
310
314
|
this.#n.value?.submitMessage();
|
|
311
315
|
}} round>${this.awaitingResponse ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
|
|
312
316
|
}
|
|
313
317
|
}
|
|
314
|
-
|
|
318
|
+
$("arcgis-assistant", F);
|
|
315
319
|
export {
|
|
316
|
-
|
|
320
|
+
F as ArcgisAssistant
|
|
317
321
|
};
|
|
@@ -5,6 +5,8 @@ import "../arcgis-assistant-suggested-prompts/index.js";
|
|
|
5
5
|
import "@esri/calcite-components/components/calcite-panel";
|
|
6
6
|
import "../arcgis-assistant-chat/index.js";
|
|
7
7
|
import "../arcgis-assistant-message/index.js";
|
|
8
|
+
import "../arcgis-assistant-message-text/index.js";
|
|
9
|
+
import "../arcgis-assistant-message-block/index.js";
|
|
8
10
|
import "../arcgis-assistant-user-message/index.js";
|
|
9
11
|
import "../arcgis-assistant-message-loading/index.js";
|
|
10
12
|
import "../arcgis-assistant-chat-entry/index.js";
|
|
@@ -85,16 +85,14 @@ export type AssistantPromptSelectDetail = {
|
|
|
85
85
|
prompt: string;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
/** Detail payload emitted
|
|
88
|
+
/** Detail payload emitted by the assistant slottable request event. */
|
|
89
89
|
export type AssistantSlottableRequestDetail = {
|
|
90
90
|
/** The request name describing the slot being requested. */
|
|
91
91
|
name: AssistantSlottableRequestName;
|
|
92
|
-
/** Element that owns the requested slot. Use this instead of event.target across shadow boundaries. */
|
|
93
|
-
slotOwner: HTMLElement;
|
|
94
92
|
/** The slot name consumers should target when appending light DOM content. */
|
|
95
93
|
slotName: string;
|
|
96
94
|
/** Data describing the current slot request. */
|
|
97
|
-
data
|
|
95
|
+
data?: AssistantSlottableRequestData;
|
|
98
96
|
};
|
|
99
97
|
|
|
100
98
|
/** The base interface for chat messages exchanged between the user and the assistant. */
|
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { c as d } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as m, html as a } from "lit";
|
|
4
|
+
import { LitElement as g, nothing as i } from "@arcgis/lumina";
|
|
5
|
+
import { useSlottableRequest as b } from "@arcgis/lumina/controllers";
|
|
6
|
+
import { g as c, a as r } from "../../chunks/slottableRequestUtils.js";
|
|
7
|
+
const f = m`:host{display:block;container-type:inline-size}.container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.content-container{display:flex;flex:1;flex-direction:column;width:100%;gap:var(--calcite-spacing-md)}.content,.blocks{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm)}@container (min-width: 480px){.container{max-width:80%}}`;
|
|
8
|
+
function p({ message: t }) {
|
|
9
|
+
const e = /* @__PURE__ */ new Map();
|
|
10
|
+
if (!t)
|
|
11
|
+
return e;
|
|
12
|
+
const s = c(t.id);
|
|
13
|
+
return e.set(s, { data: { message: t }, name: "message", slotName: s }), t.blocks?.forEach((l, o) => {
|
|
14
|
+
const n = r(t.id, o);
|
|
15
|
+
e.set(n, { data: { block: l, index: o, message: t }, name: "block", slotName: n });
|
|
16
|
+
}), e;
|
|
17
|
+
}
|
|
18
|
+
class h extends g {
|
|
7
19
|
constructor() {
|
|
8
|
-
super(...arguments), this.feedbackEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.readAloudEnabled = !1, this.footerDisabled = !1;
|
|
20
|
+
super(...arguments), this.arcgisSlottableRequest = b(this, ["message"], p), this.feedbackEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.readAloudEnabled = !1, this.footerDisabled = !1;
|
|
9
21
|
}
|
|
10
22
|
static {
|
|
11
23
|
this.properties = { feedbackEnabled: 5, logEnabled: 5, copyEnabled: 5, readAloudEnabled: 5, footerDisabled: 5, message: 0 };
|
|
12
24
|
}
|
|
13
25
|
static {
|
|
14
|
-
this.styles =
|
|
26
|
+
this.styles = f;
|
|
15
27
|
}
|
|
16
28
|
_renderContent() {
|
|
17
|
-
|
|
29
|
+
const e = this.message, s = e?.id;
|
|
30
|
+
if (s)
|
|
31
|
+
return a`<div class="content"><slot name=${c(s) ?? i}></slot>${e.blocks?.length ? a`<div class="blocks">${e.blocks.map((l, o) => a`<slot name=${r(s, o) ?? i}></slot>`)}</div>` : null}</div>`;
|
|
18
32
|
}
|
|
19
33
|
_renderFooter() {
|
|
20
|
-
return
|
|
34
|
+
return a`<arcgis-assistant-message-footer .message=${this.message} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-message-footer>`;
|
|
21
35
|
}
|
|
22
36
|
render() {
|
|
23
|
-
return
|
|
37
|
+
return a`<div class="container"><slot name=icon><calcite-icon icon=effects class="icon" scale=s></calcite-icon></slot><div class="content-container"><slot name=content>${this._renderContent()}</slot>${this.footerDisabled ? null : a`<slot name=footer>${this._renderFooter()}</slot>`}</div></div>`;
|
|
24
38
|
}
|
|
25
39
|
}
|
|
26
|
-
|
|
40
|
+
d("arcgis-assistant-message", h);
|
|
27
41
|
export {
|
|
28
|
-
|
|
42
|
+
h as ArcgisAssistantMessage
|
|
29
43
|
};
|