@inkeep/agents-ui 0.0.0-dev-20260721222136 → 0.0.0-dev-20260721224224
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/primitives/components/embedded-chat/chat-error-helpers.cjs +2 -2
- package/dist/primitives/components/embedded-chat/chat-error-helpers.d.ts +1 -0
- package/dist/primitives/components/embedded-chat/chat-error-helpers.js +15 -14
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +169 -169
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../hooks/use-inkeep-api-client.cjs");function
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../hooks/use-inkeep-api-client.cjs");function n(t){const e=Number(t.code)||Number(t.statusCode);if(e&&!Number.isNaN(e))return e;try{const r=Number(JSON.parse(t.message??"").status);return r&&!Number.isNaN(r)?r:null}catch{return null}}function E(t){const e=n(t),r=o.parseAuthError(e??0,{detail:t.message??""});return r!==null?r:e===401?"session":e===403?"captcha":null}function a(t){const e=n(t);return e===400||e===413||e===429}function i(t){if(n(t)!==null)return!1;const e=(t.message??"").toLowerCase();return e.includes("failed to fetch")||e.includes("load failed")||e.includes("networkerror")||e.includes("network request failed")}const u="Something went wrong sending your message. Check your connection and try again.",c="Your message could not be sent. If you attached large files, try removing one. Otherwise, check your connection and try again.",_=`Hmm..
|
|
2
2
|
|
|
3
|
-
It seems I might be having some issues right now. Please clear the chat and try again.`,l="Please try again.",
|
|
3
|
+
It seems I might be having some issues right now. Please clear the chat and try again.`,l="Please try again.",R="You're sending requests too quickly. Please wait a moment and try again.",A="Your message or attachments are too large. Remove a file or shorten your message and try again.",S=43e5,s=4/3;function d(t){return new TextEncoder().encode(t.text).length+Math.ceil(t.rawFileBytes*s)+t.encodedPartsBytes}const O=8e3;exports.BASE64_SIZE_FACTOR=s;exports.DEFAULT_ERROR_MESSAGE=_;exports.MAX_REQUEST_BODY_BYTES=S;exports.NETWORK_ERROR_MESSAGE=u;exports.NETWORK_ERROR_WITH_FILES_MESSAGE=c;exports.PAYLOAD_TOO_LARGE_MESSAGE=A;exports.RATE_LIMIT_MESSAGE=R;exports.RECOVERABLE_FALLBACK_MESSAGE=l;exports.RECOVERABLE_NOTIFICATION_DURATION_MS=O;exports.estimateRequestBodyBytes=d;exports.isNetworkError=i;exports.isRecoverableError=a;exports.resolveHttpStatusCode=n;exports.resolveStreamingAuthError=E;
|
|
@@ -41,6 +41,7 @@ export declare function isRecoverableError(error: Error): boolean;
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function isNetworkError(error: Error): boolean;
|
|
43
43
|
export declare const NETWORK_ERROR_MESSAGE = "Something went wrong sending your message. Check your connection and try again.";
|
|
44
|
+
export declare const NETWORK_ERROR_WITH_FILES_MESSAGE = "Your message could not be sent. If you attached large files, try removing one. Otherwise, check your connection and try again.";
|
|
44
45
|
export declare const DEFAULT_ERROR_MESSAGE = "Hmm.. \n\nIt seems I might be having some issues right now. Please clear the chat and try again.";
|
|
45
46
|
export declare const RECOVERABLE_FALLBACK_MESSAGE = "Please try again.";
|
|
46
47
|
export declare const RATE_LIMIT_MESSAGE = "You're sending requests too quickly. Please wait a moment and try again.";
|
|
@@ -10,11 +10,11 @@ function s(t) {
|
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function c(t) {
|
|
14
14
|
const e = s(t), n = r(e ?? 0, { detail: t.message ?? "" });
|
|
15
15
|
return n !== null ? n : e === 401 ? "session" : e === 403 ? "captcha" : null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function i(t) {
|
|
18
18
|
const e = s(t);
|
|
19
19
|
return e === 400 || e === 413 || e === 429;
|
|
20
20
|
}
|
|
@@ -26,25 +26,26 @@ function u(t) {
|
|
|
26
26
|
e.includes("networkerror") || // Firefox
|
|
27
27
|
e.includes("network request failed");
|
|
28
28
|
}
|
|
29
|
-
const l = "Something went wrong sending your message. Check your connection and try again.", E = `Hmm..
|
|
29
|
+
const l = "Something went wrong sending your message. Check your connection and try again.", E = "Your message could not be sent. If you attached large files, try removing one. Otherwise, check your connection and try again.", d = `Hmm..
|
|
30
30
|
|
|
31
|
-
It seems I might be having some issues right now. Please clear the chat and try again.`, m = "Please try again.",
|
|
32
|
-
function
|
|
31
|
+
It seems I might be having some issues right now. Please clear the chat and try again.`, m = "Please try again.", g = "You're sending requests too quickly. Please wait a moment and try again.", R = "Your message or attachments are too large. Remove a file or shorten your message and try again.", _ = 43e5, o = 4 / 3;
|
|
32
|
+
function A(t) {
|
|
33
33
|
return new TextEncoder().encode(t.text).length + Math.ceil(t.rawFileBytes * o) + t.encodedPartsBytes;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const S = 8e3;
|
|
36
36
|
export {
|
|
37
37
|
o as BASE64_SIZE_FACTOR,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
d as DEFAULT_ERROR_MESSAGE,
|
|
39
|
+
_ as MAX_REQUEST_BODY_BYTES,
|
|
40
40
|
l as NETWORK_ERROR_MESSAGE,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
E as NETWORK_ERROR_WITH_FILES_MESSAGE,
|
|
42
|
+
R as PAYLOAD_TOO_LARGE_MESSAGE,
|
|
43
|
+
g as RATE_LIMIT_MESSAGE,
|
|
43
44
|
m as RECOVERABLE_FALLBACK_MESSAGE,
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
S as RECOVERABLE_NOTIFICATION_DURATION_MS,
|
|
46
|
+
A as estimateRequestBodyBytes,
|
|
46
47
|
u as isNetworkError,
|
|
47
|
-
|
|
48
|
+
i as isRecoverableError,
|
|
48
49
|
s as resolveHttpStatusCode,
|
|
49
|
-
|
|
50
|
+
c as resolveStreamingAuthError
|
|
50
51
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xe=require("@ai-sdk/react"),Ze=require("./file-upload-input.cjs"),et=require("ai"),t=require("react"),tt=require("../../providers/config-provider.cjs"),st=require("../../providers/chat-auth-provider.cjs"),rt=require("../../hooks/use-media-query.cjs"),nt=require("../../hooks/use-conversation-loader.cjs"),at=require("../../hooks/use-initial-conversation.cjs"),O=require("../../utils/generate-uid.cjs"),ot=require("../../providers/base-events-provider.cjs"),it=require("../../providers/chat-form-provider.cjs"),ct=require("../../providers/widget-provider.cjs"),ut=require("@radix-ui/react-use-controllable-state"),lt=require("../../hooks/use-streaming-events.cjs"),dt=require("../../hooks/use-input-notification.cjs"),
|
|
2
|
-
`)??"";t.useEffect(()=>{
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xe=require("@ai-sdk/react"),Ze=require("./file-upload-input.cjs"),et=require("ai"),t=require("react"),tt=require("../../providers/config-provider.cjs"),st=require("../../providers/chat-auth-provider.cjs"),rt=require("../../hooks/use-media-query.cjs"),nt=require("../../hooks/use-conversation-loader.cjs"),at=require("../../hooks/use-initial-conversation.cjs"),O=require("../../utils/generate-uid.cjs"),ot=require("../../providers/base-events-provider.cjs"),it=require("../../providers/chat-form-provider.cjs"),ct=require("../../providers/widget-provider.cjs"),ut=require("@radix-ui/react-use-controllable-state"),lt=require("../../hooks/use-streaming-events.cjs"),dt=require("../../hooks/use-input-notification.cjs"),s=require("./chat-error-helpers.cjs"),ft=()=>{const{baseSettings:se,aiChatSettings:R}=tt.useInkeepConfig(),[u="",v]=ut.useControllableState({prop:R.conversationIdOverride,defaultProp:R.conversationIdOverride??""}),{logEvent:m}=ot.useBaseEvents(),{setConversationId:we,emitToParent:k}=lt.useStreamingEvents(),re=t.useRef(u);t.useEffect(()=>{const e=re.current;re.current=u,e!==u&&m({eventName:"chat_conversation_changed",properties:{conversationId:u,previousConversationId:e}})},[u,m]);const[_,C]=t.useState(""),Oe=e=>C(e.target.value),{shouldBypassCaptcha:ke,filters:ne,userProperties:B,analyticsProperties:D}=se,{authToken:ae,isAuthenticated:S,isAuthConfigured:oe,refreshAuthToken:ie,sessionToken:ce,refreshSession:ue,getCaptchaHeader:F,invalidateCaptcha:f,effectiveAuthToken:le,applicableRefreshSession:Fe}=st.useChatAuth(),{onInputMessageChange:Le,filters:de,baseUrl:fe,agentUrl:Ne,context:pe,headers:ge,appId:L,apiKey:U,files:T}=R,he=t.useRef(F);he.current=F;const me=Ne||`${fe}/run/api/chat`,{loadConversation:Ee}=nt.useConversationLoader({baseUrl:fe,appId:L,authToken:le,getCaptchaHeader:F,invalidateCaptcha:f,refreshSession:Fe}),[Pe,Re]=t.useState(!1),G=t.useRef(null);G.current=ce;const $=t.useRef(null);$.current=ae;const K=t.useRef(void 0);K.current=B&&Object.keys(B).length>0?B:void 0;const H=t.useRef(void 0);H.current=D&&Object.keys(D).length>0?D:void 0;const y=t.useRef(0),N=t.useRef(null),W=t.useRef(null),E=t.useRef(void 0),xe=T?.map(e=>`${e.filename??""}:${e.mediaType}:${e.url.length}:${e.url.slice(0,64)}:${e.url.slice(-32)}`).join(`
|
|
2
|
+
`)??"";t.useEffect(()=>{E.current=T?.length?T:void 0},[xe]);const ve=t.useRef(ge);ve.current=ge;const z=t.useRef(void 0);z.current=ne||de?JSON.stringify({...ne,...de}):void 0;const qe=e=>{if(s.isNetworkError(e))return N.current?.files?.length?s.NETWORK_ERROR_WITH_FILES_MESSAGE:s.NETWORK_ERROR_MESSAGE;switch(s.resolveHttpStatusCode(e)){case 400:try{const r=JSON.parse(e.message??"");return r.detail??r.error?.message??s.RECOVERABLE_FALLBACK_MESSAGE}catch{return e.message?.trim()||s.RECOVERABLE_FALLBACK_MESSAGE}case 401:return oe?"Authentication failed. Please try again.":s.DEFAULT_ERROR_MESSAGE;case 403:return`There seems to be a configuration error. Please contact ${se.organizationDisplayName??"Administrator"}`;case 413:return s.PAYLOAD_TOO_LARGE_MESSAGE;case 429:return s.RATE_LIMIT_MESSAGE;default:return s.DEFAULT_ERROR_MESSAGE}},[A,V]=t.useState([]),Be=t.useMemo(()=>new et.DefaultChatTransport({api:me,headers:()=>{const e=U??$.current??G.current;return{"x-inkeep-client-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone,"x-inkeep-client-timestamp":new Date().toISOString(),"x-inkeep-invocation-type":"chat_widget",...L?{"x-inkeep-app-id":L}:{},...e?{Authorization:`Bearer ${e}`}:{},...z.current?{"inkeep-filters":z.current}:{},...ve.current}},prepareSendMessagesRequest:async e=>{const l=await he.current(),r=e.messages[e.messages.length-1];return r||console.warn("[useInkeepChat] prepareSendMessagesRequest called with empty messages array"),{body:{...e.body,id:e.id,messages:r?[r]:[],trigger:e.trigger,messageId:e.messageId,...K.current?{userProperties:K.current}:{},...H.current?{properties:H.current}:{}},headers:{...e.headers,...l}}},body:{requestContext:pe}}),[me,pe,L,U]),{messages:M,sendMessage:Y,addToolApprovalResponse:j,status:Se,setMessages:h,stop:P,error:x}=Xe.useChat({transport:Be,onData(e){k(e.type,e.data)},async onFinish({message:e}){k("completion",{conversationId:u}),await m({eventName:"assistant_message_received",properties:{conversationId:u,messageId:e.id}}),m({eventName:"assistant_answer_displayed",properties:{conversationId:u,messageId:e.id}})},onError(e){console.error("onError",{code:e.code,message:e.message});const l=ke||U?null:s.resolveStreamingAuthError(e);if(l!==null&&y.current<1){y.current++;const i=W.current,a=N.current;(async()=>{if(l==="session"&&oe){const o=await ie();if(!o)throw new Error("Auth token refresh failed");$.current=o}else if(l==="session"){const o=await ue();o&&(G.current=o)}else f();if(i){j(i);return}a&&(h(o=>{let c=[...o];return c.at(-1)?.role==="assistant"&&(c=c.slice(0,-1)),c.at(-1)?.role==="user"&&(c=c.slice(0,-1)),c}),Y({id:a.messageId,parts:[...a.content.trim()?[{type:"text",text:a.content}]:[],...a.files??[]]},{body:a.body}))})().catch(()=>{y.current=0,f(),h(o=>{const c=[...o],g=c[c.length-1];if(!g)return c;const d=s.DEFAULT_ERROR_MESSAGE;return g.role==="user"?c.push({id:O.generateUid(16),role:"assistant",parts:[{type:"text",text:d}]}):g.parts=[{type:"text",text:d}],c})});return}y.current=0,l!==null&&f();const r=s.isRecoverableError(e)||s.isNetworkError(e),n=qe(e);if(m({eventName:"chat_error",properties:{conversationId:u,messageId:M.at(-1)?.id,error:e.message}}),r){const i=n===s.PAYLOAD_TOO_LARGE_MESSAGE?"Message too large":n===s.RATE_LIMIT_MESSAGE?"Rate limit reached":n===s.NETWORK_ERROR_MESSAGE||n===s.NETWORK_ERROR_WITH_FILES_MESSAGE?"Connection error":"Request failed";q({title:i,message:n},s.RECOVERABLE_NOTIFICATION_DURATION_MS),h(p=>{let o=[...p];return o.at(-1)?.role==="assistant"&&(o=o.slice(0,-1)),o.at(-1)?.role==="user"&&(o=o.slice(0,-1)),o});const a=N.current?.content;a&&C(a),Z.current=e;return}h(i=>{const a=[...i],p=a[a.length-1];return p&&(p.role==="user"?a.push({id:O.generateUid(16),role:"assistant",parts:[{type:"text",text:n}]}):p.parts=[{type:"text",text:n}]),a})}}),ye=t.useRef(S);t.useEffect(()=>{const e=ye.current;ye.current=S,e!==S&&(P(),b(null),h([]),v(""),C(""),V([]),f())},[S,P,h,v,f]);const Ae=Se==="submitted",Q=Se==="streaming",De=t.useMemo(()=>{const e=i=>{if(!i||typeof i!="object")return!1;const a=i;return typeof a.type=="string"&&a.type.startsWith("tool-")},r=[...M??[]].reverse().find(i=>i.role==="assistant");if(!r)return!1;const n=r.parts?.at(-1);return!(!e(n)||n.state!=="output-available"||!n.approval?.id||Q)},[M,Q]),[Ue,J]=t.useState(!1),Ie=Q||De&&!Ue,_e=Ae||Ie,Ge=M.length===0,X=!_.trim()&&A.length===0||_e,$e=rt.useMediaQuery("(max-width: 768px)"),[Ke,b]=t.useState(null),Z=t.useRef(null);t.useEffect(()=>{if(x){if(Z.current===x){Z.current=null;return}b(x)}},[x]);const He=()=>b(null),{inputNotification:We,showInputNotification:q,clearInputNotification:ze}=dt.useInputNotification(),Ce=t.useRef(null);t.useEffect(()=>{Le?.(_)},[_]);const Ve=e=>{e.key==="Enter"&&!e.shiftKey&&!X&&!e.nativeEvent.isComposing&&(e.preventDefault(),ee())},ee=async(e=_)=>{if(X&&(!e||e.trim().length===0)&&A.length===0||!e.trim()&&!A.length&&!E.current?.length)return;if(s.estimateRequestBodyBytes({text:e,rawFileBytes:A.reduce((g,d)=>g+d.size,0),encodedPartsBytes:(E.current??[]).reduce((g,d)=>g+d.url.length,0)})>s.MAX_REQUEST_BODY_BYTES){q({title:"Message too large",message:s.PAYLOAD_TOO_LARGE_MESSAGE},s.RECOVERABLE_NOTIFICATION_DURATION_MS);return}const r=A;V([]),C(""),y.current=0,W.current=null,J(!1);let n=u;n||(n=`conv_${O.generateUid(16)}`,v(n));const i=O.generateUid(21);we(n),await m({eventName:"user_message_submitted",properties:{conversationId:n,messageId:i}});const a=E.current;E.current=void 0;let p=[];if(r.length>0)try{p=await Promise.all(r.map(g=>{const d=Ze.normalizeFileType(g);return new Promise((Je,be)=>{const w=new FileReader;w.onload=()=>{if(typeof w.result!="string"){be(new Error(`Failed to read file "${d.name}"`));return}Je({type:"file",url:w.result,mediaType:d.type,filename:d.name})},w.onerror=()=>be(new Error(`Failed to read file "${d.name}"`)),w.readAsDataURL(d)})}))}catch{q({title:"Failed to attach files",message:"Could not read one or more files. Please try again."});return}const o=p.length||a?.length?[...p,...a??[]]:void 0,c=[...e.trim()?[{type:"text",text:e}]:[],...o??[]];N.current={content:e,messageId:i,body:{conversationId:n},files:o},Y({id:i,parts:c},{body:{conversationId:n}})},Ye=t.useCallback(e=>{y.current=0,W.current=e,J(!1),j(e)},[j]),te=t.useCallback(()=>{J(!0),P().then(()=>{k("aborted",{conversationId:u})})},[P,u,k]),Te=()=>{He(),h([]),v(""),f(),E.current=T?.length?T:void 0,m({eventName:"chat_clear_button_clicked",properties:{conversationId:u}})},I=t.useCallback((e,l)=>{b(null),h(l),v(e),f(),E.current=void 0},[h,v,f]),Me=t.useCallback(async(e,l)=>{te(),I(e,[]),Re(!0);try{const r=await Ee(e,l);if(r===null)return!1;const i=r[r.length-1]?.role==="user"?[...r,{id:O.generateUid(16),role:"assistant",parts:[{type:"text",text:"This session was interrupted. Please check back in a few minutes or start a new conversation."}]}]:r;return I(e,i),!0}finally{l?.aborted||Re(!1)}},[I,Ee,te]);at.useInitialConversation({conversationId:R.conversationId,fetchedConversation:R.fetchedConversation,effectiveAuthToken:le,restoreSession:I,loadAndRestoreSession:Me,onLoadFailed:()=>I("",[])});const{openForm:je}=it.useChatForm(),Qe=ct.useWidget();return t.useImperativeHandle(R.chatFunctionsRef,()=>({submitMessage:ee,updateInputMessage(e){C(e)},clearChat:Te,openForm:e=>{Qe?.setView("chat"),je(e,void 0)},focusInput:()=>{Ce.current?.focus()}})),{messages:M,sendMessage:Y,addToolApprovalResponse:Ye,isLoading:Ae,isStreaming:Ie,isBusy:_e,error:Ke,setError:b,isSubmitDisabled:X,input:_,handleInputChange:Oe,handleInputKeyDown:Ve,handleSubmit:ee,stop:te,clear:Te,inputRef:Ce,isMobile:$e,files:A,setFiles:V,isNewChat:Ge,conversationId:u,restoreSession:I,loadAndRestoreSession:Me,isSessionLoading:Pe,authToken:S?ae:ce,refreshSession:S?ie:ue,getCaptchaHeader:F,invalidateCaptcha:f,inputNotification:We,showInputNotification:q,clearInputNotification:ze}};exports.useInkeepChat=ft;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useChat as
|
|
3
|
-
import { normalizeFileType as
|
|
4
|
-
import { DefaultChatTransport as
|
|
5
|
-
import { useRef as i, useEffect as _, useState as k, useMemo as Oe, useCallback as $, useImperativeHandle as
|
|
6
|
-
import { useInkeepConfig as
|
|
7
|
-
import { useChatAuth as
|
|
8
|
-
import { useMediaQuery as
|
|
9
|
-
import { useConversationLoader as
|
|
10
|
-
import { useInitialConversation as
|
|
2
|
+
import { useChat as lt } from "@ai-sdk/react";
|
|
3
|
+
import { normalizeFileType as ut } from "./file-upload-input.js";
|
|
4
|
+
import { DefaultChatTransport as dt } from "ai";
|
|
5
|
+
import { useRef as i, useEffect as _, useState as k, useMemo as Oe, useCallback as $, useImperativeHandle as pt } from "react";
|
|
6
|
+
import { useInkeepConfig as ft } from "../../providers/config-provider.js";
|
|
7
|
+
import { useChatAuth as mt } from "../../providers/chat-auth-provider.js";
|
|
8
|
+
import { useMediaQuery as gt } from "../../hooks/use-media-query.js";
|
|
9
|
+
import { useConversationLoader as ht } from "../../hooks/use-conversation-loader.js";
|
|
10
|
+
import { useInitialConversation as vt } from "../../hooks/use-initial-conversation.js";
|
|
11
11
|
import { generateUid as F } from "../../utils/generate-uid.js";
|
|
12
|
-
import { useBaseEvents as
|
|
13
|
-
import { useChatForm as
|
|
14
|
-
import { useWidget as
|
|
15
|
-
import { useControllableState as
|
|
16
|
-
import { useStreamingEvents as
|
|
12
|
+
import { useBaseEvents as yt } from "../../providers/base-events-provider.js";
|
|
13
|
+
import { useChatForm as Rt } from "../../providers/chat-form-provider.js";
|
|
14
|
+
import { useWidget as Et } from "../../providers/widget-provider.js";
|
|
15
|
+
import { useControllableState as It } from "@radix-ui/react-use-controllable-state";
|
|
16
|
+
import { useStreamingEvents as St } from "../../hooks/use-streaming-events.js";
|
|
17
17
|
import { useInputNotification as Ct } from "../../hooks/use-input-notification.js";
|
|
18
|
-
import { resolveStreamingAuthError as
|
|
19
|
-
const
|
|
20
|
-
const { baseSettings: ae, aiChatSettings: v } =
|
|
18
|
+
import { resolveStreamingAuthError as At, DEFAULT_ERROR_MESSAGE as ne, isRecoverableError as Tt, isNetworkError as Ne, RECOVERABLE_NOTIFICATION_DURATION_MS as Pe, PAYLOAD_TOO_LARGE_MESSAGE as oe, RATE_LIMIT_MESSAGE as Be, NETWORK_ERROR_MESSAGE as De, NETWORK_ERROR_WITH_FILES_MESSAGE as Le, resolveHttpStatusCode as wt, RECOVERABLE_FALLBACK_MESSAGE as $e, estimateRequestBodyBytes as bt, MAX_REQUEST_BODY_BYTES as Mt } from "./chat-error-helpers.js";
|
|
19
|
+
const Wt = () => {
|
|
20
|
+
const { baseSettings: ae, aiChatSettings: v } = ft(), [c = "", y] = It({
|
|
21
21
|
prop: v.conversationIdOverride,
|
|
22
22
|
defaultProp: v.conversationIdOverride ?? ""
|
|
23
|
-
}), { logEvent: g } =
|
|
23
|
+
}), { logEvent: g } = yt(), { setConversationId: Ue, emitToParent: x } = St(), ie = i(c);
|
|
24
24
|
_(() => {
|
|
25
25
|
const e = ie.current;
|
|
26
26
|
ie.current = c, e !== c && g({
|
|
@@ -31,10 +31,10 @@ const Ht = () => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
}, [c, g]);
|
|
34
|
-
const [
|
|
35
|
-
shouldBypassCaptcha:
|
|
34
|
+
const [C, A] = k(""), Ge = (e) => A(e.target.value), {
|
|
35
|
+
shouldBypassCaptcha: Ke,
|
|
36
36
|
filters: ce,
|
|
37
|
-
userProperties:
|
|
37
|
+
userProperties: U,
|
|
38
38
|
analyticsProperties: G
|
|
39
39
|
} = ae, {
|
|
40
40
|
authToken: le,
|
|
@@ -47,79 +47,79 @@ const Ht = () => {
|
|
|
47
47
|
invalidateCaptcha: d,
|
|
48
48
|
effectiveAuthToken: me,
|
|
49
49
|
applicableRefreshSession: ze
|
|
50
|
-
} =
|
|
51
|
-
onInputMessageChange:
|
|
50
|
+
} = mt(), {
|
|
51
|
+
onInputMessageChange: He,
|
|
52
52
|
filters: ge,
|
|
53
53
|
baseUrl: he,
|
|
54
|
-
agentUrl:
|
|
54
|
+
agentUrl: qe,
|
|
55
55
|
context: ve,
|
|
56
56
|
headers: ye,
|
|
57
57
|
appId: N,
|
|
58
58
|
apiKey: K,
|
|
59
|
-
files:
|
|
59
|
+
files: T
|
|
60
60
|
} = v, Re = i(O);
|
|
61
61
|
Re.current = O;
|
|
62
|
-
const
|
|
62
|
+
const Ee = qe || `${he}/run/api/chat`, { loadConversation: Ie } = ht({
|
|
63
63
|
baseUrl: he,
|
|
64
64
|
appId: N,
|
|
65
65
|
authToken: me,
|
|
66
66
|
getCaptchaHeader: O,
|
|
67
67
|
invalidateCaptcha: d,
|
|
68
68
|
refreshSession: ze
|
|
69
|
-
}), [
|
|
70
|
-
|
|
69
|
+
}), [We, Se] = k(!1), z = i(null);
|
|
70
|
+
z.current = pe;
|
|
71
71
|
const H = i(null);
|
|
72
72
|
H.current = le;
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const
|
|
73
|
+
const q = i(void 0);
|
|
74
|
+
q.current = U && Object.keys(U).length > 0 ? U : void 0;
|
|
75
|
+
const W = i(void 0);
|
|
76
|
+
W.current = G && Object.keys(G).length > 0 ? G : void 0;
|
|
77
|
+
const E = i(0), P = i(null), j = i(null), h = i(void 0), je = T?.map(
|
|
78
78
|
(e) => `${e.filename ?? ""}:${e.mediaType}:${e.url.length}:${e.url.slice(0, 64)}:${e.url.slice(-32)}`
|
|
79
79
|
).join(`
|
|
80
80
|
`) ?? "";
|
|
81
81
|
_(() => {
|
|
82
|
-
h.current =
|
|
83
|
-
}, [
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const
|
|
82
|
+
h.current = T?.length ? T : void 0;
|
|
83
|
+
}, [je]);
|
|
84
|
+
const Ce = i(ye);
|
|
85
|
+
Ce.current = ye;
|
|
86
|
+
const V = i(void 0);
|
|
87
|
+
V.current = ce || ge ? JSON.stringify({ ...ce, ...ge }) : void 0;
|
|
88
|
+
const Ve = (e) => {
|
|
89
89
|
if (Ne(e))
|
|
90
|
-
return P.current?.files?.length ?
|
|
90
|
+
return P.current?.files?.length ? Le : De;
|
|
91
91
|
switch (wt(e)) {
|
|
92
92
|
case 400:
|
|
93
93
|
try {
|
|
94
94
|
const t = JSON.parse(e.message ?? "");
|
|
95
|
-
return t.detail ?? t.error?.message ??
|
|
95
|
+
return t.detail ?? t.error?.message ?? $e;
|
|
96
96
|
} catch {
|
|
97
|
-
return e.message?.trim() ||
|
|
97
|
+
return e.message?.trim() || $e;
|
|
98
98
|
}
|
|
99
99
|
case 401:
|
|
100
|
-
return ue ? "Authentication failed. Please try again." :
|
|
100
|
+
return ue ? "Authentication failed. Please try again." : ne;
|
|
101
101
|
case 403:
|
|
102
102
|
return `There seems to be a configuration error. Please contact ${ae.organizationDisplayName ?? "Administrator"}`;
|
|
103
103
|
case 413:
|
|
104
|
-
return
|
|
104
|
+
return oe;
|
|
105
105
|
case 429:
|
|
106
106
|
return Be;
|
|
107
107
|
default:
|
|
108
|
-
return
|
|
108
|
+
return ne;
|
|
109
109
|
}
|
|
110
|
-
}, [
|
|
111
|
-
() => new
|
|
112
|
-
api:
|
|
110
|
+
}, [I, Y] = k([]), Ye = Oe(
|
|
111
|
+
() => new dt({
|
|
112
|
+
api: Ee,
|
|
113
113
|
headers: () => {
|
|
114
|
-
const e = K ?? H.current ??
|
|
114
|
+
const e = K ?? H.current ?? z.current;
|
|
115
115
|
return {
|
|
116
116
|
"x-inkeep-client-timezone": Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
117
117
|
"x-inkeep-client-timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
118
118
|
"x-inkeep-invocation-type": "chat_widget",
|
|
119
119
|
...N ? { "x-inkeep-app-id": N } : {},
|
|
120
120
|
...e ? { Authorization: `Bearer ${e}` } : {},
|
|
121
|
-
...
|
|
122
|
-
...
|
|
121
|
+
...V.current ? { "inkeep-filters": V.current } : {},
|
|
122
|
+
...Ce.current
|
|
123
123
|
};
|
|
124
124
|
},
|
|
125
125
|
prepareSendMessagesRequest: async (e) => {
|
|
@@ -133,8 +133,8 @@ const Ht = () => {
|
|
|
133
133
|
messages: t ? [t] : [],
|
|
134
134
|
trigger: e.trigger,
|
|
135
135
|
messageId: e.messageId,
|
|
136
|
-
...
|
|
137
|
-
...
|
|
136
|
+
...q.current ? { userProperties: q.current } : {},
|
|
137
|
+
...W.current ? { properties: W.current } : {}
|
|
138
138
|
},
|
|
139
139
|
headers: {
|
|
140
140
|
...e.headers,
|
|
@@ -146,17 +146,17 @@ const Ht = () => {
|
|
|
146
146
|
requestContext: ve
|
|
147
147
|
}
|
|
148
148
|
}),
|
|
149
|
-
[
|
|
149
|
+
[Ee, ve, N, K]
|
|
150
150
|
), {
|
|
151
|
-
messages:
|
|
152
|
-
sendMessage:
|
|
153
|
-
addToolApprovalResponse:
|
|
151
|
+
messages: w,
|
|
152
|
+
sendMessage: J,
|
|
153
|
+
addToolApprovalResponse: Q,
|
|
154
154
|
status: Ae,
|
|
155
155
|
setMessages: m,
|
|
156
156
|
stop: B,
|
|
157
157
|
error: D
|
|
158
|
-
} =
|
|
159
|
-
transport:
|
|
158
|
+
} = lt({
|
|
159
|
+
transport: Ye,
|
|
160
160
|
onData(e) {
|
|
161
161
|
x(e.type, e.data);
|
|
162
162
|
},
|
|
@@ -177,42 +177,42 @@ const Ht = () => {
|
|
|
177
177
|
},
|
|
178
178
|
onError(e) {
|
|
179
179
|
console.error("onError", { code: e.code, message: e.message });
|
|
180
|
-
const l =
|
|
181
|
-
if (l !== null &&
|
|
182
|
-
|
|
183
|
-
const o =
|
|
180
|
+
const l = Ke || K ? null : At(e);
|
|
181
|
+
if (l !== null && E.current < 1) {
|
|
182
|
+
E.current++;
|
|
183
|
+
const o = j.current, r = P.current;
|
|
184
184
|
(async () => {
|
|
185
185
|
if (l === "session" && ue) {
|
|
186
|
-
const
|
|
187
|
-
if (!
|
|
188
|
-
H.current =
|
|
186
|
+
const n = await de();
|
|
187
|
+
if (!n) throw new Error("Auth token refresh failed");
|
|
188
|
+
H.current = n;
|
|
189
189
|
} else if (l === "session") {
|
|
190
|
-
const
|
|
191
|
-
|
|
190
|
+
const n = await fe();
|
|
191
|
+
n && (z.current = n);
|
|
192
192
|
} else
|
|
193
193
|
d();
|
|
194
194
|
if (o) {
|
|
195
|
-
|
|
195
|
+
Q(o);
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
let a = [...
|
|
198
|
+
r && (m((n) => {
|
|
199
|
+
let a = [...n];
|
|
200
200
|
return a.at(-1)?.role === "assistant" && (a = a.slice(0, -1)), a.at(-1)?.role === "user" && (a = a.slice(0, -1)), a;
|
|
201
|
-
}),
|
|
201
|
+
}), J(
|
|
202
202
|
{
|
|
203
|
-
id:
|
|
203
|
+
id: r.messageId,
|
|
204
204
|
parts: [
|
|
205
|
-
...
|
|
206
|
-
...
|
|
205
|
+
...r.content.trim() ? [{ type: "text", text: r.content }] : [],
|
|
206
|
+
...r.files ?? []
|
|
207
207
|
]
|
|
208
208
|
},
|
|
209
|
-
{ body:
|
|
209
|
+
{ body: r.body }
|
|
210
210
|
));
|
|
211
211
|
})().catch(() => {
|
|
212
|
-
|
|
213
|
-
const a = [...
|
|
212
|
+
E.current = 0, d(), m((n) => {
|
|
213
|
+
const a = [...n], f = a[a.length - 1];
|
|
214
214
|
if (!f) return a;
|
|
215
|
-
const u =
|
|
215
|
+
const u = ne;
|
|
216
216
|
return f.role === "user" ? a.push({
|
|
217
217
|
id: F(16),
|
|
218
218
|
role: "assistant",
|
|
@@ -222,111 +222,111 @@ const Ht = () => {
|
|
|
222
222
|
});
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
|
-
|
|
226
|
-
const t =
|
|
225
|
+
E.current = 0, l !== null && d();
|
|
226
|
+
const t = Tt(e) || Ne(e), s = Ve(e);
|
|
227
227
|
if (g({
|
|
228
228
|
eventName: "chat_error",
|
|
229
229
|
properties: {
|
|
230
230
|
conversationId: c,
|
|
231
|
-
messageId:
|
|
231
|
+
messageId: w.at(-1)?.id,
|
|
232
232
|
error: e.message
|
|
233
233
|
}
|
|
234
234
|
}), t) {
|
|
235
235
|
L(
|
|
236
|
-
{ title:
|
|
236
|
+
{ title: s === oe ? "Message too large" : s === Be ? "Rate limit reached" : s === De || s === Le ? "Connection error" : "Request failed", message: s },
|
|
237
237
|
Pe
|
|
238
238
|
), m((p) => {
|
|
239
|
-
let
|
|
240
|
-
return
|
|
239
|
+
let n = [...p];
|
|
240
|
+
return n.at(-1)?.role === "assistant" && (n = n.slice(0, -1)), n.at(-1)?.role === "user" && (n = n.slice(0, -1)), n;
|
|
241
241
|
});
|
|
242
|
-
const
|
|
243
|
-
|
|
242
|
+
const r = P.current?.content;
|
|
243
|
+
r && A(r), te.current = e;
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
246
246
|
m((o) => {
|
|
247
|
-
const
|
|
248
|
-
return p && (p.role === "user" ?
|
|
247
|
+
const r = [...o], p = r[r.length - 1];
|
|
248
|
+
return p && (p.role === "user" ? r.push({
|
|
249
249
|
id: F(16),
|
|
250
250
|
role: "assistant",
|
|
251
|
-
parts: [{ type: "text", text:
|
|
252
|
-
}) : p.parts = [{ type: "text", text:
|
|
251
|
+
parts: [{ type: "text", text: s }]
|
|
252
|
+
}) : p.parts = [{ type: "text", text: s }]), r;
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
}),
|
|
255
|
+
}), Te = i(R);
|
|
256
256
|
_(() => {
|
|
257
|
-
const e =
|
|
258
|
-
|
|
257
|
+
const e = Te.current;
|
|
258
|
+
Te.current = R, e !== R && (B(), b(null), m([]), y(""), A(""), Y([]), d());
|
|
259
259
|
}, [R, B, m, y, d]);
|
|
260
|
-
const
|
|
260
|
+
const we = Ae === "submitted", X = Ae === "streaming", Je = Oe(() => {
|
|
261
261
|
const e = (o) => {
|
|
262
262
|
if (!o || typeof o != "object") return !1;
|
|
263
|
-
const
|
|
264
|
-
return typeof
|
|
265
|
-
}, t = [...
|
|
263
|
+
const r = o;
|
|
264
|
+
return typeof r.type == "string" && r.type.startsWith("tool-");
|
|
265
|
+
}, t = [...w ?? []].reverse().find((o) => o.role === "assistant");
|
|
266
266
|
if (!t) return !1;
|
|
267
|
-
const
|
|
268
|
-
return !(!e(
|
|
269
|
-
}, [
|
|
267
|
+
const s = t.parts?.at(-1);
|
|
268
|
+
return !(!e(s) || s.state !== "output-available" || !s.approval?.id || X);
|
|
269
|
+
}, [w, X]), [Qe, Z] = k(!1), be = X || Je && !Qe, Me = we || be, Xe = w.length === 0, ee = !C.trim() && I.length === 0 || Me, Ze = gt("(max-width: 768px)"), [et, b] = k(null), te = i(null);
|
|
270
270
|
_(() => {
|
|
271
271
|
if (D) {
|
|
272
|
-
if (
|
|
273
|
-
|
|
272
|
+
if (te.current === D) {
|
|
273
|
+
te.current = null;
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
276
|
b(D);
|
|
277
277
|
}
|
|
278
278
|
}, [D]);
|
|
279
|
-
const
|
|
279
|
+
const tt = () => b(null), { inputNotification: st, showInputNotification: L, clearInputNotification: rt } = Ct(), _e = i(null);
|
|
280
280
|
_(() => {
|
|
281
|
-
|
|
282
|
-
}, [
|
|
283
|
-
const
|
|
284
|
-
e.key === "Enter" && !e.shiftKey && !
|
|
285
|
-
},
|
|
286
|
-
if (
|
|
281
|
+
He?.(C);
|
|
282
|
+
}, [C]);
|
|
283
|
+
const nt = (e) => {
|
|
284
|
+
e.key === "Enter" && !e.shiftKey && !ee && !e.nativeEvent.isComposing && (e.preventDefault(), se());
|
|
285
|
+
}, se = async (e = C) => {
|
|
286
|
+
if (ee && (!e || e.trim().length === 0) && I.length === 0 || !e.trim() && !I.length && !h.current?.length)
|
|
287
287
|
return;
|
|
288
|
-
if (
|
|
288
|
+
if (bt({
|
|
289
289
|
text: e,
|
|
290
|
-
rawFileBytes:
|
|
290
|
+
rawFileBytes: I.reduce((f, u) => f + u.size, 0),
|
|
291
291
|
encodedPartsBytes: (h.current ?? []).reduce(
|
|
292
292
|
(f, u) => f + u.url.length,
|
|
293
293
|
0
|
|
294
294
|
)
|
|
295
|
-
}) >
|
|
295
|
+
}) > Mt) {
|
|
296
296
|
L(
|
|
297
|
-
{ title: "Message too large", message:
|
|
297
|
+
{ title: "Message too large", message: oe },
|
|
298
298
|
Pe
|
|
299
299
|
);
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
|
-
const t =
|
|
303
|
-
|
|
304
|
-
let
|
|
305
|
-
|
|
302
|
+
const t = I;
|
|
303
|
+
Y([]), A(""), E.current = 0, j.current = null, Z(!1);
|
|
304
|
+
let s = c;
|
|
305
|
+
s || (s = `conv_${F(16)}`, y(s));
|
|
306
306
|
const o = F(21);
|
|
307
|
-
|
|
307
|
+
Ue(s), await g({
|
|
308
308
|
eventName: "user_message_submitted",
|
|
309
309
|
properties: {
|
|
310
|
-
conversationId:
|
|
310
|
+
conversationId: s,
|
|
311
311
|
messageId: o
|
|
312
312
|
}
|
|
313
313
|
});
|
|
314
|
-
const
|
|
314
|
+
const r = h.current;
|
|
315
315
|
h.current = void 0;
|
|
316
316
|
let p = [];
|
|
317
317
|
if (t.length > 0)
|
|
318
318
|
try {
|
|
319
319
|
p = await Promise.all(
|
|
320
320
|
t.map((f) => {
|
|
321
|
-
const u =
|
|
322
|
-
return new Promise((
|
|
321
|
+
const u = ut(f);
|
|
322
|
+
return new Promise((ct, xe) => {
|
|
323
323
|
const M = new FileReader();
|
|
324
324
|
M.onload = () => {
|
|
325
325
|
if (typeof M.result != "string") {
|
|
326
326
|
xe(new Error(`Failed to read file "${u.name}"`));
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
ct({
|
|
330
330
|
type: "file",
|
|
331
331
|
url: M.result,
|
|
332
332
|
mediaType: u.type,
|
|
@@ -343,42 +343,42 @@ const Ht = () => {
|
|
|
343
343
|
});
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
const
|
|
346
|
+
const n = p.length || r?.length ? [...p, ...r ?? []] : void 0, a = [
|
|
347
347
|
...e.trim() ? [{ type: "text", text: e }] : [],
|
|
348
|
-
...
|
|
348
|
+
...n ?? []
|
|
349
349
|
];
|
|
350
350
|
P.current = {
|
|
351
351
|
content: e,
|
|
352
352
|
messageId: o,
|
|
353
|
-
body: { conversationId:
|
|
354
|
-
files:
|
|
355
|
-
},
|
|
356
|
-
},
|
|
353
|
+
body: { conversationId: s },
|
|
354
|
+
files: n
|
|
355
|
+
}, J({ id: o, parts: a }, { body: { conversationId: s } });
|
|
356
|
+
}, ot = $(
|
|
357
357
|
(e) => {
|
|
358
|
-
|
|
358
|
+
E.current = 0, j.current = e, Z(!1), Q(e);
|
|
359
359
|
},
|
|
360
|
-
[
|
|
361
|
-
),
|
|
362
|
-
|
|
360
|
+
[Q]
|
|
361
|
+
), re = $(() => {
|
|
362
|
+
Z(!0), B().then(() => {
|
|
363
363
|
x("aborted", { conversationId: c });
|
|
364
364
|
});
|
|
365
365
|
}, [B, c, x]), ke = () => {
|
|
366
|
-
|
|
366
|
+
tt(), m([]), y(""), d(), h.current = T?.length ? T : void 0, g({
|
|
367
367
|
eventName: "chat_clear_button_clicked",
|
|
368
368
|
properties: {
|
|
369
369
|
conversationId: c
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
|
-
},
|
|
372
|
+
}, S = $(
|
|
373
373
|
(e, l) => {
|
|
374
374
|
b(null), m(l), y(e), d(), h.current = void 0;
|
|
375
375
|
},
|
|
376
376
|
[m, y, d]
|
|
377
377
|
), Fe = $(
|
|
378
378
|
async (e, l) => {
|
|
379
|
-
|
|
379
|
+
re(), S(e, []), Se(!0);
|
|
380
380
|
try {
|
|
381
|
-
const t = await
|
|
381
|
+
const t = await Ie(e, l);
|
|
382
382
|
if (t === null) return !1;
|
|
383
383
|
const o = t[t.length - 1]?.role === "user" ? [
|
|
384
384
|
...t,
|
|
@@ -393,68 +393,68 @@ const Ht = () => {
|
|
|
393
393
|
]
|
|
394
394
|
}
|
|
395
395
|
] : t;
|
|
396
|
-
return
|
|
396
|
+
return S(e, o), !0;
|
|
397
397
|
} finally {
|
|
398
|
-
l?.aborted ||
|
|
398
|
+
l?.aborted || Se(!1);
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
|
-
[
|
|
401
|
+
[S, Ie, re]
|
|
402
402
|
);
|
|
403
|
-
|
|
403
|
+
vt({
|
|
404
404
|
conversationId: v.conversationId,
|
|
405
405
|
fetchedConversation: v.fetchedConversation,
|
|
406
406
|
effectiveAuthToken: me,
|
|
407
|
-
restoreSession:
|
|
407
|
+
restoreSession: S,
|
|
408
408
|
loadAndRestoreSession: Fe,
|
|
409
|
-
onLoadFailed: () =>
|
|
409
|
+
onLoadFailed: () => S("", [])
|
|
410
410
|
});
|
|
411
|
-
const { openForm:
|
|
412
|
-
return
|
|
413
|
-
submitMessage:
|
|
411
|
+
const { openForm: at } = Rt(), it = Et();
|
|
412
|
+
return pt(v.chatFunctionsRef, () => ({
|
|
413
|
+
submitMessage: se,
|
|
414
414
|
updateInputMessage(e) {
|
|
415
415
|
A(e);
|
|
416
416
|
},
|
|
417
417
|
clearChat: ke,
|
|
418
418
|
openForm: (e) => {
|
|
419
|
-
|
|
419
|
+
it?.setView("chat"), at(e, void 0);
|
|
420
420
|
},
|
|
421
421
|
focusInput: () => {
|
|
422
422
|
_e.current?.focus();
|
|
423
423
|
}
|
|
424
424
|
})), {
|
|
425
|
-
messages:
|
|
426
|
-
sendMessage:
|
|
427
|
-
addToolApprovalResponse:
|
|
428
|
-
isLoading:
|
|
425
|
+
messages: w,
|
|
426
|
+
sendMessage: J,
|
|
427
|
+
addToolApprovalResponse: ot,
|
|
428
|
+
isLoading: we,
|
|
429
429
|
isStreaming: be,
|
|
430
430
|
isBusy: Me,
|
|
431
|
-
error:
|
|
431
|
+
error: et,
|
|
432
432
|
setError: b,
|
|
433
|
-
isSubmitDisabled:
|
|
434
|
-
input:
|
|
435
|
-
handleInputChange:
|
|
436
|
-
handleInputKeyDown:
|
|
437
|
-
handleSubmit:
|
|
438
|
-
stop:
|
|
433
|
+
isSubmitDisabled: ee,
|
|
434
|
+
input: C,
|
|
435
|
+
handleInputChange: Ge,
|
|
436
|
+
handleInputKeyDown: nt,
|
|
437
|
+
handleSubmit: se,
|
|
438
|
+
stop: re,
|
|
439
439
|
clear: ke,
|
|
440
440
|
inputRef: _e,
|
|
441
|
-
isMobile:
|
|
442
|
-
files:
|
|
443
|
-
setFiles:
|
|
444
|
-
isNewChat:
|
|
441
|
+
isMobile: Ze,
|
|
442
|
+
files: I,
|
|
443
|
+
setFiles: Y,
|
|
444
|
+
isNewChat: Xe,
|
|
445
445
|
conversationId: c,
|
|
446
|
-
restoreSession:
|
|
446
|
+
restoreSession: S,
|
|
447
447
|
loadAndRestoreSession: Fe,
|
|
448
|
-
isSessionLoading:
|
|
448
|
+
isSessionLoading: We,
|
|
449
449
|
authToken: R ? le : pe,
|
|
450
450
|
refreshSession: R ? de : fe,
|
|
451
451
|
getCaptchaHeader: O,
|
|
452
452
|
invalidateCaptcha: d,
|
|
453
|
-
inputNotification:
|
|
453
|
+
inputNotification: st,
|
|
454
454
|
showInputNotification: L,
|
|
455
|
-
clearInputNotification:
|
|
455
|
+
clearInputNotification: rt
|
|
456
456
|
};
|
|
457
457
|
};
|
|
458
458
|
export {
|
|
459
|
-
|
|
459
|
+
Wt as useInkeepChat
|
|
460
460
|
};
|