@worktango/ai-assistant 0.0.83 → 0.0.84
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/{Absenteeism-C7j8pYEx.mjs → Absenteeism-rZtESf4V.mjs} +1 -1
- package/dist/{ActivityFeed-DPCJD1Yu.mjs → ActivityFeed-DU95u94E.mjs} +1 -1
- package/dist/{AddUser-CgiSQQd0.mjs → AddUser-CH24wsHD.mjs} +1 -1
- package/dist/{Admin-CjwECPBC.mjs → Admin-DBHsX1Wg.mjs} +1 -1
- package/dist/{Admin-B4HzV22i.mjs → Admin-hcSZT7HB.mjs} +1 -1
- package/dist/{AiGeneral-CkC3xpXH.mjs → AiGeneral-DbpIfCES.mjs} +1 -1
- package/dist/{AiScoring-KCNJtCd4.mjs → AiScoring-DSLpUgrD.mjs} +1 -1
- package/dist/{AiText-_bZzSkHr.mjs → AiText-Db5NB6aU.mjs} +1 -1
- package/dist/{Anniversary-BdvXbakz.mjs → Anniversary-Wr0ALfHs.mjs} +1 -1
- package/dist/{Appreciation-COENyutu.mjs → Appreciation-C6zHdsFR.mjs} +1 -1
- package/dist/{ArrowDown-DZqYNMx3.mjs → ArrowDown-CzdKlnPJ.mjs} +1 -1
- package/dist/{ArrowLeft-CZ_e6id0.mjs → ArrowLeft-BccL9Hvp.mjs} +1 -1
- package/dist/{ArrowRight-SAE2kSi9.mjs → ArrowRight-BsKjdZOV.mjs} +1 -1
- package/dist/{ArrowUp-DrYKxrtI.mjs → ArrowUp-3_EEUs_H.mjs} +1 -1
- package/dist/{Attachment-rQ7lTrff.mjs → Attachment-CwAx9ASS.mjs} +1 -1
- package/dist/{BeQuickDontHurry-cUKmA0vX.mjs → BeQuickDontHurry-CesQUjbh.mjs} +1 -1
- package/dist/{Birthday-DPv7OHzk.mjs → Birthday-CdjAgC1g.mjs} +1 -1
- package/dist/{BrandPromise-C_um5ldv.mjs → BrandPromise-DYgkptTF.mjs} +1 -1
- package/dist/{BrandVision-C8L0fZ6Q.mjs → BrandVision-Bk-Zi6zw.mjs} +1 -1
- package/dist/{Calendar-D97ZBHxZ.mjs → Calendar-mzIwr9AU.mjs} +1 -1
- package/dist/{CaretDn-wg0JjCTy.mjs → CaretDn-DoiwdMQr.mjs} +1 -1
- package/dist/{CaretDown-rV5NIJUb.mjs → CaretDown-C8Wr0xR1.mjs} +1 -1
- package/dist/{CaretLeft-BSRVYeWb.mjs → CaretLeft-CGcZ7MFc.mjs} +1 -1
- package/dist/{CaretRight-DM358LOZ.mjs → CaretRight-DGO034gk.mjs} +1 -1
- package/dist/{CaretUp-DLp5ilJr.mjs → CaretUp-BuZWU-Gs.mjs} +1 -1
- package/dist/{ChallengeAccepted-xlfzdjlc.mjs → ChallengeAccepted-D1z_5vfR.mjs} +1 -1
- package/dist/{CheckIn-BrDhfHY2.mjs → CheckIn-WURJihPQ.mjs} +1 -1
- package/dist/{CheckIns-BiltravN.mjs → CheckIns-B_SCDFzY.mjs} +1 -1
- package/dist/{CheckSeal-Dr4-ecO_.mjs → CheckSeal-CRRWZqeu.mjs} +1 -1
- package/dist/{Checkmark-CEIJB5GP.mjs → Checkmark-Do_2LlwV.mjs} +1 -1
- package/dist/{Clock-D8tcAXpS.mjs → Clock-CsPBw8UO.mjs} +1 -1
- package/dist/{Close-C06JjCZi.mjs → Close-mk0-4-Tq.mjs} +1 -1
- package/dist/{CloudDownload-Cd7eWN1K.mjs → CloudDownload-DDxz-xTn.mjs} +1 -1
- package/dist/{Comment-B0y2nbaF.mjs → Comment-Dg5nfHX0.mjs} +1 -1
- package/dist/{Comments-CrGOMcVe.mjs → Comments-DwzOY8UX.mjs} +1 -1
- package/dist/{Connections-Kt7TUajw.mjs → Connections-C-9m3ln4.mjs} +1 -1
- package/dist/{Copy-UKpyRgwr.mjs → Copy-Yp7LU_Db.mjs} +1 -1
- package/dist/{CustomQuestion-DfaVFcdC.mjs → CustomQuestion-Cl-I5Hjc.mjs} +1 -1
- package/dist/{CustomerSuccess-BMOGVl0z.mjs → CustomerSuccess-f5PeiDVZ.mjs} +1 -1
- package/dist/{DatePicker-CRoXBaQ4.mjs → DatePicker-CSb1Y5_e.mjs} +1 -1
- package/dist/{Dot-DWKOl4lB.mjs → Dot-BkmpdwLQ.mjs} +1 -1
- package/dist/{Download-Dn5f7ZNc.mjs → Download-D1P9x2o2.mjs} +1 -1
- package/dist/{Drag-CW_6oEZE.mjs → Drag-lOm8OpIh.mjs} +1 -1
- package/dist/{Earn-DFrljUsF.mjs → Earn-nvkbMHcx.mjs} +1 -1
- package/dist/{Email-OO0yLcUU.mjs → Email-BkX_tCJh.mjs} +1 -1
- package/dist/{EmojiDisplay-BLbauj8T.mjs → EmojiDisplay-CR_Q4xK1.mjs} +2 -2
- package/dist/{EmojiPicker-BsB0j8Zt.mjs → EmojiPicker-DAt6phh5.mjs} +2 -2
- package/dist/{EnpsSurvey-CHCJRdbi.mjs → EnpsSurvey-B8B12a0z.mjs} +1 -1
- package/dist/{Expired-CKEj83px.mjs → Expired-D4zzsKOZ.mjs} +1 -1
- package/dist/{Eye-B1szWmuM.mjs → Eye-DWPlQFLX.mjs} +1 -1
- package/dist/{Feedback-CBxHK_k6.mjs → Feedback-Bi1rkIjJ.mjs} +1 -1
- package/dist/{Feedback-CdMN4QGx.mjs → Feedback-CZ-4-n5Z.mjs} +1 -1
- package/dist/{Filter-DZglgnA4.mjs → Filter-CIlC_Cur.mjs} +1 -1
- package/dist/{Flag-Sdt9MOXo.mjs → Flag-hyOtXRl8.mjs} +1 -1
- package/dist/{Giphy-DjBhX1OZ.mjs → Giphy-BmHk_Y_E.mjs} +1 -1
- package/dist/{GoalCount-u4oA2Z86.mjs → GoalCount-BcyiKDO5.mjs} +1 -1
- package/dist/{GoalPercent-BdLFXLJa.mjs → GoalPercent-CxQb2miC.mjs} +1 -1
- package/dist/{GoalTask-CcVRL1IP.mjs → GoalTask-B3tJwVum.mjs} +1 -1
- package/dist/{GoalTask-q-QDr6jz.mjs → GoalTask-eggtJPx9.mjs} +1 -1
- package/dist/{Goals-BNaHVKH-.mjs → Goals-DMirxdDV.mjs} +1 -1
- package/dist/{Goals-BSJYtx_f.mjs → Goals-iDM0a8op.mjs} +1 -1
- package/dist/{Growth-C0drKO0b.mjs → Growth-CwRC9pRO.mjs} +1 -1
- package/dist/{Hamburger-DB1Vl__i.mjs → Hamburger-B40_u-Hq.mjs} +1 -1
- package/dist/{Help-HxRwrCpb.mjs → Help-DdU2lPap.mjs} +1 -1
- package/dist/{HighFive-yTeecUXQ.mjs → HighFive-0d-nEY78.mjs} +1 -1
- package/dist/{HighFive-BamlLNan.mjs → HighFive-BM4_S730.mjs} +1 -1
- package/dist/{Home-D4miMjI7.mjs → Home-BU7_visd.mjs} +1 -1
- package/dist/{Home-CeJsltqg.mjs → Home-CGbCxvtf.mjs} +1 -1
- package/dist/{HorizontalLine-DnWbbQ0y.mjs → HorizontalLine-CAL-IHuK.mjs} +1 -1
- package/dist/{Hourglass-Cih0oNSZ.mjs → Hourglass-DmDDdH3a.mjs} +1 -1
- package/dist/{Image-DFoyTzel.mjs → Image-3MkguQt-.mjs} +1 -1
- package/dist/{ImageFile-BIHbg8lJ.mjs → ImageFile-C8y_WH08.mjs} +1 -1
- package/dist/{InGoodCompany-Bgo72BhW.mjs → InGoodCompany-C1FFWqe4.mjs} +1 -1
- package/dist/{Incentives-BgZnn8pb.mjs → Incentives-Dcmq6KCj.mjs} +1 -1
- package/dist/{Info-HFyfFoLl.mjs → Info-BZKUtFmO.mjs} +1 -1
- package/dist/{Insights-CwLmoZD6.mjs → Insights-46we8hQ3.mjs} +1 -1
- package/dist/{Insights-CN8yoB8p.mjs → Insights-BJhXUhWx.mjs} +1 -1
- package/dist/{Integrations-KM0WnnMK.mjs → Integrations-Dz67Vtcm.mjs} +1 -1
- package/dist/{KazooLogo-BKYFQIoj.mjs → KazooLogo-DnArXdTe.mjs} +1 -1
- package/dist/{KnowYourAudience-DcovPldB.mjs → KnowYourAudience-Cyp2nhqB.mjs} +1 -1
- package/dist/{Launch-DLEzJuib.mjs → Launch-PVCfBVOJ.mjs} +1 -1
- package/dist/{Link-PZwIMgct.mjs → Link-R29JRWuY.mjs} +1 -1
- package/dist/{LinkArrow-cvUBAFt3.mjs → LinkArrow-D-rTJGLR.mjs} +1 -1
- package/dist/{Loading-BolS4cQb.mjs → Loading-Sf0-Ex8k.mjs} +1 -1
- package/dist/{Lock-C7zod1Vw.mjs → Lock-B9VC8A55.mjs} +1 -1
- package/dist/{Management-BaBEj18f.mjs → Management-DSbqL2iL.mjs} +1 -1
- package/dist/{MeatballMenu-IiV27_Oz.mjs → MeatballMenu-D7SOeAlY.mjs} +1 -1
- package/dist/{Messages-vBq4dFur.mjs → Messages-Q_YZxxUP.mjs} +1 -1
- package/dist/{Microphone-AgQiEVs3.mjs → Microphone-CD6cC7Ty.mjs} +1 -1
- package/dist/{Mobile-BCnwSH56.mjs → Mobile-DhqnPW9s.mjs} +1 -1
- package/dist/{Nomination-Eyj9rGn8.mjs → Nomination-UV8r18Ir.mjs} +1 -1
- package/dist/{NominationsAndAwards-BqdomA9M.mjs → NominationsAndAwards-BbG4wwsZ.mjs} +1 -1
- package/dist/{Notification-uzEKSZI5.mjs → Notification-Cofs6V8G.mjs} +1 -1
- package/dist/{Okrs-DqVkY5hP.mjs → Okrs-DHfGva6o.mjs} +1 -1
- package/dist/{Pause-CyvncalJ.mjs → Pause-B9vjSJk4.mjs} +1 -1
- package/dist/{PeerToPeer-CEcCRPFt.mjs → PeerToPeer-0sevuUTR.mjs} +1 -1
- package/dist/{Pencil-DKtJ0n7Y.mjs → Pencil-CGLxV_94.mjs} +1 -1
- package/dist/{People-BvzGVqmM.mjs → People-JKL4InOG.mjs} +1 -1
- package/dist/{PerformanceManagement-C4VaVaC5.mjs → PerformanceManagement-Dff8u7md.mjs} +1 -1
- package/dist/{Pin-DoDJ0Bii.mjs → Pin-eNziEKoP.mjs} +1 -1
- package/dist/{PinnedIconAward-DaelmGX1.mjs → PinnedIconAward-BxEiIr9G.mjs} +1 -1
- package/dist/{PinnedIconBrightIdea-Clt9HLLG.mjs → PinnedIconBrightIdea-BYN_0Foh.mjs} +1 -1
- package/dist/{PinnedIconBullseye-Dljv2Die.mjs → PinnedIconBullseye-Cb6u5KuE.mjs} +1 -1
- package/dist/{PinnedIconChampagne-DBYiq_TN.mjs → PinnedIconChampagne-D820gFVt.mjs} +1 -1
- package/dist/{PinnedIconCheer-9wrnvn6o.mjs → PinnedIconCheer-DfcBtJ0r.mjs} +1 -1
- package/dist/{PinnedIconCrown-B6G3N9DT.mjs → PinnedIconCrown-BX-Nda0P.mjs} +1 -1
- package/dist/{PinnedIconDiamond-Dna66gi8.mjs → PinnedIconDiamond-BbxahXc0.mjs} +1 -1
- package/dist/{PinnedIconHoleInOne-Db85-CiD.mjs → PinnedIconHoleInOne-BzpuekWz.mjs} +1 -1
- package/dist/{PinnedIconMedal-D6ZLDCPP.mjs → PinnedIconMedal-CL267vwR.mjs} +1 -1
- package/dist/{PinnedIconMetrics-CVl4PZda.mjs → PinnedIconMetrics-CN2r4r7C.mjs} +1 -1
- package/dist/{PinnedIconPin-BqdyFKlv.mjs → PinnedIconPin-BbEbD0BH.mjs} +1 -1
- package/dist/{PinnedIconRockAndRoll-S6gYaXs2.mjs → PinnedIconRockAndRoll-BcDdVKt6.mjs} +1 -1
- package/dist/{PinnedIconRocket-DszlBicm.mjs → PinnedIconRocket-DsvtBVeS.mjs} +1 -1
- package/dist/{PinnedIconStrength-DoLc7-AH.mjs → PinnedIconStrength-BcRL34tu.mjs} +1 -1
- package/dist/{PinnedIconTeddyBear-tciPmlf7.mjs → PinnedIconTeddyBear-792pGoav.mjs} +1 -1
- package/dist/{PlatformLogo-DIl3xroB.mjs → PlatformLogo-DhcKmNKv.mjs} +1 -1
- package/dist/{Plus-BqcyvXF_.mjs → Plus-DFew0HdO.mjs} +1 -1
- package/dist/{Popper-BEZw444-.mjs → Popper-0rkO8KLW.mjs} +1 -1
- package/dist/{PrivateEye-BHAYgzAO.mjs → PrivateEye-BGKu0ADs.mjs} +1 -1
- package/dist/{PrivatePushPin-B3ma7TcG.mjs → PrivatePushPin-DmlSi7YD.mjs} +1 -1
- package/dist/{Processing-CQjridED.mjs → Processing-DgV0xE-l.mjs} +1 -1
- package/dist/{Productivity-QWidqnRN.mjs → Productivity-Dc2rib4J.mjs} +1 -1
- package/dist/{ProgressCircle-CHcOjC6a.mjs → ProgressCircle-BgLVBZIh.mjs} +1 -1
- package/dist/{PulseSurvey-CiYtLrV6.mjs → PulseSurvey-j3lZF2AN.mjs} +1 -1
- package/dist/{PushPin-C9KGjUjx.mjs → PushPin-DWvvF6wv.mjs} +1 -1
- package/dist/{Recognition-DFhzN1ti.mjs → Recognition-CuwDRTpl.mjs} +1 -1
- package/dist/{Recognition-BZP5r8X6.mjs → Recognition-FumYA9y-.mjs} +1 -1
- package/dist/{Retention-rhJCYLrd.mjs → Retention-C9YhlmWE.mjs} +1 -1
- package/dist/{Rewards-BkfhImRL.mjs → Rewards-CDjnamju.mjs} +1 -1
- package/dist/{Rewards-D1wqiyxR.mjs → Rewards-CdrOLcvy.mjs} +1 -1
- package/dist/{RewardsCatalog-Bj2vQKiX.mjs → RewardsCatalog-DJUflw8h.mjs} +1 -1
- package/dist/{Roadmap-Bux__PRP.mjs → Roadmap-DdkQZX5W.mjs} +1 -1
- package/dist/{Search-CRQYMTDB.mjs → Search-BTBEkP7l.mjs} +1 -1
- package/dist/{Security-CCF3obto.mjs → Security-_Fpa9oY_.mjs} +1 -1
- package/dist/{SendRecognition-vi5xZGjr.mjs → SendRecognition-BzGhyxZd.mjs} +1 -1
- package/dist/{ShareLink-CgvTbyF0.mjs → ShareLink-ZWCKdJXi.mjs} +1 -1
- package/dist/{SidebarCollapse-DNjTZ4k1.mjs → SidebarCollapse-7vfkNBBV.mjs} +1 -1
- package/dist/{Skill-BlrYqGAI.mjs → Skill-BT6oKHee.mjs} +1 -1
- package/dist/{Skills-gL8r-NFi.mjs → Skills-hZ2t_eQf.mjs} +1 -1
- package/dist/{Smiley-C9oU6mU_.mjs → Smiley-77rzRHKF.mjs} +1 -1
- package/dist/{Stop-DRapEDep.mjs → Stop-Cj93uIg5.mjs} +1 -1
- package/dist/{Survey-CzTj5YVn.mjs → Survey-6R_HHZmF.mjs} +1 -1
- package/dist/{Surveys-vHud7TSo.mjs → Surveys-Bdf2Sq3s.mjs} +1 -1
- package/dist/{SyncUps-D5GBKrwK.mjs → SyncUps-DIDiet3S.mjs} +1 -1
- package/dist/{Syncs-CSXSRZWh.mjs → Syncs-dhGcQSFc.mjs} +1 -1
- package/dist/{TalentReview-zLjQWUYI.mjs → TalentReview-C2m7cisz.mjs} +1 -1
- package/dist/{TalentReview-DcOJ9FwS.mjs → TalentReview-j-K18MK_.mjs} +1 -1
- package/dist/{TalentReviewInsights-CM5Dr1tE.mjs → TalentReviewInsights-BaTXetNw.mjs} +1 -1
- package/dist/{TaskCompleted-CxEpMrbj.mjs → TaskCompleted-D3iVUs69.mjs} +1 -1
- package/dist/{Team-DjEk9uAE.mjs → Team-V_qKOMcU.mjs} +1 -1
- package/dist/{Teams-Dk4pdOSE.mjs → Teams-CRrtdjC0.mjs} +1 -1
- package/dist/{TextBold-D4gszwXA.mjs → TextBold-W-OPnXFY.mjs} +1 -1
- package/dist/{TextBulletList-D1lsbLX0.mjs → TextBulletList-BM9PBBCe.mjs} +1 -1
- package/dist/{TextInput-BI9GtFHZ.mjs → TextInput-NrCWEm--.mjs} +1 -1
- package/dist/{TextItalic-DQAhJTAI.mjs → TextItalic-CRnlmTmF.mjs} +1 -1
- package/dist/{TextNumberList-Cx22wxrQ.mjs → TextNumberList-CDwmqSG7.mjs} +1 -1
- package/dist/{TextUnderline-CibMk7B7.mjs → TextUnderline-Dp6Z2UN1.mjs} +1 -1
- package/dist/{Toggle-BZXqudO3.mjs → Toggle-BDuIHjI4.mjs} +1 -1
- package/dist/{Translate-B_yGoAKZ.mjs → Translate-B7GOVddg.mjs} +1 -1
- package/dist/{Trash-Bb6baH1U.mjs → Trash-BLuNd1W0.mjs} +1 -1
- package/dist/{TrendDown-_VIAxpZW.mjs → TrendDown-Dta858_p.mjs} +1 -1
- package/dist/{TrendUp-BoKb1OtA.mjs → TrendUp-CxRn2Gkl.mjs} +1 -1
- package/dist/{Undo-BuZQxW18.mjs → Undo-CAy59jV6.mjs} +1 -1
- package/dist/{Unplugged-C_JQNvol.mjs → Unplugged-DH--9hSt.mjs} +1 -1
- package/dist/{UpDownCaret-Sx8GT9-W.mjs → UpDownCaret-CxQF6VZw.mjs} +1 -1
- package/dist/{VerticalLine-yiCXOiav.mjs → VerticalLine-X4SYlBYW.mjs} +1 -1
- package/dist/{Warning-CaZbqIDI.mjs → Warning-1tUbGzdU.mjs} +1 -1
- package/dist/{WarningNoOutline-COra0vf1.mjs → WarningNoOutline-_nCiyjR3.mjs} +1 -1
- package/dist/{YesAnd-Bnjgai0z.mjs → YesAnd-COhdiRUj.mjs} +1 -1
- package/dist/{emoji-gItxddR8.mjs → emoji-DI9jAJcj.mjs} +1 -1
- package/dist/{react-apexcharts.min-BeZN72jQ.mjs → react-apexcharts.min-ssix5gQg.mjs} +1 -1
- package/dist/react.es.js +1 -1
- package/dist/react.umd.js +1 -1
- package/dist/{reactComponent-Cv28othn.mjs → reactComponent-gqB4kDpV.mjs} +191 -192
- package/package.json +1 -1
package/dist/react.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as o, u as e, v as a, t as n, w as i, B as g, z as A, y as p, x as u } from "./reactComponent-
|
|
1
|
+
import { A as o, u as e, v as a, t as n, w as i, B as g, z as A, y as p, x as u } from "./reactComponent-gqB4kDpV.mjs";
|
|
2
2
|
export {
|
|
3
3
|
o as AiAssistant,
|
|
4
4
|
e as AiAssistantSettingsComponent,
|
package/dist/react.umd.js
CHANGED
|
@@ -302,7 +302,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
302
302
|
|
|
303
303
|
`),tr):"";class NdJson{static parse(er){return er.trim().split(`
|
|
304
304
|
`).map(ir=>JSON.parse(ir))}static stringify(er){return er.map(rr=>JSON.stringify(rr)).join(`
|
|
305
|
-
`)}}const config={kazooUrlStrategy:tr=>tr,llmCallUrlStrategy:tr=>tr,pulseUrlStrategy:tr=>tr,pulseBearerTokenStrategy:()=>null,screenshotMainContentSelector:"#root",structuredResponseUrlStrategy:tr=>tr};function getSynthesizeUrl(){return config.llmCallUrlStrategy("/api/api-ai-assistant/v1/tts")}function getTranscribeUrl(){return config.llmCallUrlStrategy("/api/api-ai-assistant/v1/stt")}function getLlmCallUrl(){return config.llmCallUrlStrategy("/api/api-ai-assistant/v1/chat")}function getStructuredResponseUrl(){return config.structuredResponseUrlStrategy("/api/api-ai-assistant/v1/structured-response")}function getKazooUrl(tr){return config.kazooUrlStrategy(tr)}function getPulseUrl(tr){return config.pulseUrlStrategy(tr)}function getPulseBearerToken(){return config.pulseBearerTokenStrategy()}function getScreenshotMainContentSelector(){return config.screenshotMainContentSelector}function setScreenshotMainContentSelector(tr){config.screenshotMainContentSelector=tr}function setKazooUrlStrategy(tr){config.kazooUrlStrategy=tr}function setLlmCallUrlStrategy(tr){config.llmCallUrlStrategy=tr}function setPulseUrlStrategy(tr){config.pulseUrlStrategy=tr}function setPulseBearerTokenStrategy(tr){config.pulseBearerTokenStrategy=tr}function setStructuredResponseUrlStrategy(tr){config.structuredResponseUrlStrategy=tr}const config$1=Object.freeze(Object.defineProperty({__proto__:null,getKazooUrl,getLlmCallUrl,getPulseBearerToken,getPulseUrl,getScreenshotMainContentSelector,getStructuredResponseUrl,getSynthesizeUrl,getTranscribeUrl,setKazooUrlStrategy,setLlmCallUrlStrategy,setPulseBearerTokenStrategy,setPulseUrlStrategy,setScreenshotMainContentSelector,setStructuredResponseUrlStrategy},Symbol.toStringTag,{value:"Module"}));async function getChatCompletion({model:tr,temperature:er,stream:rr,messages:ir,tools:ar,onChunk:nr,onError:or,onComplete:lr,systemInstruction:fr}){var cr;const dr=getPulseBearerToken();try{const ur=await fetch(getLlmCallUrl(),{method:"POST",body:JSON.stringify({model:tr,temperature:er,stream:rr,messages:ir,tools:ar,systemInstruction:fr}),credentials:dr?void 0:"include",headers:{"Content-Type":"application/json",Accept:rr?"text/event-stream":"application/json",...dr?{Authorization:`Bearer ${dr}`}:{}}});if(!ur||!ur.ok)throw new Error("Unable to connect to LLM API. Please try again.");if(rr){const hr=(cr=ur.body)==null?void 0:cr.getReader();if(!hr)throw new Error("Unexpected client error. Response body reader not available.");const gr=new TextDecoder,_r=[],pr=nr||(Fr=>{_r.push(Fr)}),mr=1e4;for(;mr>0;){const{done:Fr,value:Ar}=await hr.read();if(Fr)break;const br=gr.decode(Ar),yr=NdJson.parse(br);for(const xr of yr)pr(xr)}return lr==null||lr(),_r}return(await ur.json()).parts}catch(ur){const sr=ur instanceof Error?ur:new Error("Unexpected error calling LLM API");throw or==null||or(sr),sr}}var Voice=(tr=>(tr.AOEDE="Aoede",tr.PUCK="Puck",tr.CHARON="Charon",tr.KORE="Kore",tr.FENRIR="Fenrir",tr.LEDA="Leda",tr.ORUS="Orus",tr.ZEPHYR="Zephyr",tr))(Voice||{});async function synthesizeText(tr,er){const rr=getPulseBearerToken(),ir=await fetch(getSynthesizeUrl(),{method:"POST",body:JSON.stringify({text:tr,voice:er}),credentials:rr?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...rr?{Authorization:`Bearer ${rr}`}:{}}});if(!ir||!ir.ok)throw new Error("Unable to connect to LLM API. Please try again.");const ar=await ir.json();if(!ar.synthesis)throw new Error("No synthesis data received.");return ar.synthesis}async function transcribeAudio(tr){const er=getPulseBearerToken(),rr=await fetch(getTranscribeUrl(),{method:"POST",body:JSON.stringify({audio:tr}),credentials:er?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...er?{Authorization:`Bearer ${er}`}:{}}});if(!rr||!rr.ok)throw new Error("Unable to connect to LLM API. Please try again.");const ir=await rr.json();if(!ir.transcription)throw new Error("No transcription data received.");return ir.transcription}function useAiAssistantSession({model:tr,initialMessages:er,temperature:rr,onAfterLlmCall:ir,onBeforeLlmCall:ar,onError:nr,tools:or,onChunkAdded:lr,systemInstruction:fr,onLlmTextReply:dr}={}){const[cr,ur]=React.useState(!1),[sr,hr]=React.useState(!1),[gr,_r]=React.useState(()=>(er==null?void 0:er.map(vr=>({...vr,timestamp:coalesce(vr.timestamp,new Date)})))??[]),[pr,mr]=React.useState(null),Fr=React.useRef([]),Ar=React.useRef({onAfterLlmCall:ir,onBeforeLlmCall:ar,onError:nr,tools:or,onLlmTextReply:dr,model:tr,temperature:rr,isMounted:!0,systemInstruction:fr,onChunkAdded:lr});Ar.current={onAfterLlmCall:ir,onBeforeLlmCall:ar,onError:nr,tools:or,onLlmTextReply:dr,model:tr,temperature:rr,isMounted:!0,systemInstruction:fr,onChunkAdded:lr},React.useEffect(()=>()=>{Ar.current.isMounted=!1},[]);const br=React.useCallback(async vr=>await transcribeAudio(vr),[]),yr=React.useCallback(async vr=>await synthesizeText(vr),[]),xr=React.useMemo(()=>getSendMessagesHandler({propRefs:Ar,debugInfo:Fr,setConnectionError:mr,setIsLoading:ur,setMessages:_r}),[]),wr=React.useCallback(async vr=>{const Er=[...gr],Dr={role:"user",parts:[{type:"text",text:vr}],timestamp:new Date};kr(Dr),await xr([...Er,Dr])||(Fr.current.push({time:new Date,message:"Error sending message. Reverting to original messages",data:Er,level:"error"}),_r(Er))},[gr]),kr=React.useCallback(vr=>{_r([...gr,vr])},[gr]);return{isLoading:cr,messages:gr,setMessages:_r,isVoiceEnabled:sr,setIsVoiceEnabled:hr,getSpeech:yr,getTranscription:br,debugInfo:Fr.current,addMessage:kr,sendUserMessage:wr,connectionError:pr}}async function handlePendingToolCalls({toolCalls:tr,sendMessages:er,setMessages:rr,propRefs:ir,debugInfo:ar}){var lr,fr,dr,cr;if(tr.length===0||!ir.current.isMounted)return;const nr=[];for(const ur of tr){const sr=(lr=ir.current.tools)==null?void 0:lr.find(gr=>gr.name===ur.toolName);if(!sr){(dr=(fr=ir.current).onError)==null||dr.call(fr,new Error(`Tool ${ur.toolName} not found`)),ar.current.push({time:new Date,message:`Tool ${ur.toolName} not found`,data:{toolCall:ur,tools:ir.current.tools},level:"error"});continue}const hr=`${Date.now()}-${Math.random()}`;try{rr(Fr=>{const Ar=[...Fr];return Ar.push({role:"tool",parts:[ur],id:hr,timestamp:new Date,isPending:!0,filterFromApiCalls:!0}),Ar}),ar.current.push({time:new Date,level:"info",message:"Fulfilling tool call",data:{toolCall:ur}});const gr=Date.now(),_r=coalesce((cr=ur.args)==null?void 0:cr.args,ur.args),pr=await sr.fulfill(_r),mr=Date.now();typeof pr=="string"?(nr.push({type:"toolResult",toolName:ur.toolName,result:pr}),ar.current.push({time:new Date,level:"info",message:"Tool call fulfilled",data:{toolCall:ur,durationMs:mr-gr,result:pr}})):(nr.push({type:"toolResult",toolName:ur.toolName,result:`Tool ${ur.toolName} returned the following file`}),nr.push({type:"file",fileUri:pr==null?void 0:pr.fileUri,mimeType:pr==null?void 0:pr.mimeType}),ar.current.push({time:new Date,level:"info",message:"Tool call fulfilled with file",data:{toolCall:ur,durationMs:mr-gr,result:pr}}))}catch(gr){ar.current.push({time:new Date,message:"Error calling tool",level:"error",data:{toolCall:ur,error:{message:gr.message,stack:gr.stack}}}),nr.push({type:"toolResult",toolName:ur.toolName,result:{error:{message:gr.message,stack:gr.stack}}})}finally{rr(gr=>gr.map(_r=>_r.id===hr?{..._r,isPending:!1}:_r))}}if(!ir.current.isMounted)return;let or=!1;rr(ur=>{const sr={role:"tool",parts:nr},hr=[...ur,sr];return or||(er(hr),or=!0),hr})}function ConnectionError({retry:tr}){const er=()=>{window.location.reload()};return jsxRuntimeExports.jsxs(Flex,{direction:"column",gap:"24px",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Spacer,{}),jsxRuntimeExports.jsxs(Flex,{direction:"row",gap:"8px",alignItems:"center",children:[jsxRuntimeExports.jsx(Icon,{icon:"warning",color:"#ff0000"}),jsxRuntimeExports.jsxs(Text,{children:["Error calling LLM API. If this persists, try"," ",jsxRuntimeExports.jsx("a",{href:"#",onClick:er,"data-testid":"connection-error-refresh-page",children:"refreshing the page"}),"."]})]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"flex-end",gap:"8px",children:[jsxRuntimeExports.jsx(Button,{onClick:er,variant:"system",size:"small","data-testid":"connection-error-refresh-page-button",children:"Refresh Page"}),jsxRuntimeExports.jsx(Button,{onClick:tr,variant:"primary","data-testid":"connection-error-retry-button",children:"Retry"})]})]})}function safelyInvokeUserCallback({condition:tr,setMessages:er,callbackToInvoke:rr,callbackName:ir,debugInfo:ar,onError:nr}){!tr||!rr||(ar.current.push({time:new Date,message:`Calling ${ir}`,level:"info"}),er(or=>{try{return rr(or),or}catch(lr){ar.current.push({time:new Date,message:`Error calling ${ir}`,data:lr,level:"error"}),nr&&nr(lr)}finally{ar.current.push({time:new Date,message:`Finished calling ${ir}`,level:"info"})}return or}))}function getSendMessagesHandler({setConnectionError:tr,propRefs:er,debugInfo:rr,setIsLoading:ir,setMessages:ar}){return async function nr(or){var fr,dr;if(!er.current.isMounted)return!1;tr(null);try{er.current.onBeforeLlmCall&&er.current.onBeforeLlmCall()}catch(cr){rr.current.push({time:new Date,message:"Error calling onBeforeLlmCall",data:cr,level:"error"})}let lr;try{er.current.systemInstruction&&(lr=await er.current.systemInstruction())}catch(cr){rr.current.push({time:new Date,message:"Error getting system instruction",data:cr,level:"error"}),(dr=(fr=er.current).onError)==null||dr.call(fr,cr)}ir(!0);try{const cr={type:"text",text:""},ur=[],sr=[...or];return ar(sr),await getChatCompletion({model:er.current.model,temperature:er.current.temperature,stream:!0,messages:or.filter(hr=>!hr.filterFromApiCalls),tools:er.current.tools,systemInstruction:lr,onChunk:hr=>{er.current.isMounted&&(hr.type==="text"?cr.text+=hr.text:hr.type==="toolCall"&&ur.push(hr),ar(gr=>{var pr;const _r=[...gr];return((pr=_r[_r.length-1])==null?void 0:pr.role)!=="model"&&_r.push({role:"model",parts:[],timestamp:new Date}),_r[_r.length-1].parts=[...ur,...cr.text?[cr]:[]],er.current.onChunkAdded&&er.current.onChunkAdded(),_r}))},onError:hr=>{var _r,pr;if(!er.current.isMounted)return;const gr=composeSimpleFunctions(getClosureFor(tr,null),getClosureFor(ir,!0),getClosureFor(nr,or));ir(!1),rr.current.push({time:new Date,message:"Error calling LLM API",data:hr,level:"error"}),tr({message:jsxRuntimeExports.jsx(ConnectionError,{retry:gr}),retry:gr}),(pr=(_r=er.current).onError)==null||pr.call(_r,hr)},onComplete:()=>{er.current.isMounted&&(safelyInvokeUserCallback({condition:!!er.current.onAfterLlmCall,setMessages:ar,callbackToInvoke:er.current.onAfterLlmCall,callbackName:"onAfterLlmCall",debugInfo:rr,onError:er.current.onError}),safelyInvokeUserCallback({condition:!!er.current.onLlmTextReply,setMessages:ar,callbackToInvoke:er.current.onLlmTextReply,callbackName:"onLlmTextReply",debugInfo:rr,onError:er.current.onError}),handlePendingToolCalls({toolCalls:ur,setMessages:ar,sendMessages:nr,propRefs:er,debugInfo:rr}))}}),!0}catch{return!1}finally{ir(!1)}}}function createMessageHandlers({appendMessageToConversation:tr,errorToast:er,getConversationId:rr}){const ir=appendMessageFactory(tr,er,rr),ar=ir(fr=>({role:"MODEL",messageText:fr})),nr=ir((fr,dr)=>({role:"TOOL",messageText:fr,metadata:{toolName:dr}})),or=ir(fr=>({role:"USER",messageText:fr}));return{appendAssistantMessage:ar,appendToolMessage:nr,appendUserMessage:or,handleGeneratedMessages:fr=>{if(!rr())return;fr.filter(ur=>!ur.id).forEach(ur=>{if(ur.role==="model"){const sr=ur.parts.find(hr=>hr.type==="text");sr&&"text"in sr&&(ar(sr.text),ur.id=`saved-${Date.now()}`)}else if(ur.role==="tool"){const sr=ur.parts.find(hr=>hr.type==="toolResult");sr&&"result"in sr&&"toolName"in sr&&(nr(sr.result,sr.toolName),ur.id=`saved-${Date.now()}`)}})}}}function appendMessageFactory(tr,er,rr){return function(ar){return function(...or){const lr=rr();if(lr)try{return tr({variables:{input:{conversationId:lr,message:ar(...or)}}})}catch(fr){er(fr.message)}else er("No conversation ID available");return!1}}}const getConversationsByDateRange=(tr,er,rr=0)=>{const ir=new Date;return tr.filter(ar=>{const nr=ar.updatedAt instanceof Date?ar.updatedAt:new Date(ar.updatedAt||new Date),or=Math.abs(ir.getTime()-nr.getTime()),lr=Math.ceil(or/(1e3*60*60*24));return(er===null||lr<=er)&&lr>rr})},getTruncatedTitle=tr=>tr.length>30?`${tr.substring(0,30)}...`:tr,generateChatTitle=async tr=>{try{const er=await getChatCompletion({model:"small",temperature:.25,stream:!1,messages:[{role:"user",parts:[{type:"text",text:`Generate a concise 3-4 word title for this chat based on the first message. The title should be descriptive but brief. Do not use any punctuation. Return only the title, nothing else.
|
|
305
|
+
`)}}const config={kazooUrlStrategy:tr=>tr,llmCallUrlStrategy:tr=>tr,pulseUrlStrategy:tr=>tr,pulseBearerTokenStrategy:()=>null,screenshotMainContentSelector:"#root",structuredResponseUrlStrategy:tr=>tr};function getSynthesizeUrl(){return config.llmCallUrlStrategy("/api/api-ai-assistant/v1/tts")}function getTranscribeUrl(){return config.llmCallUrlStrategy("/api/api-ai-assistant/v1/stt")}function getLlmCallUrl(){return config.llmCallUrlStrategy("/api/api-ai-assistant/v1/chat")}function getStructuredResponseUrl(){return config.structuredResponseUrlStrategy("/api/api-ai-assistant/v1/structured-response")}function getKazooUrl(tr){return config.kazooUrlStrategy(tr)}function getPulseUrl(tr){return config.pulseUrlStrategy(tr)}function getPulseBearerToken(){return config.pulseBearerTokenStrategy()}function getScreenshotMainContentSelector(){return config.screenshotMainContentSelector}function setScreenshotMainContentSelector(tr){config.screenshotMainContentSelector=tr}function setKazooUrlStrategy(tr){config.kazooUrlStrategy=tr}function setLlmCallUrlStrategy(tr){config.llmCallUrlStrategy=tr}function setPulseUrlStrategy(tr){config.pulseUrlStrategy=tr}function setPulseBearerTokenStrategy(tr){config.pulseBearerTokenStrategy=tr}function setStructuredResponseUrlStrategy(tr){config.structuredResponseUrlStrategy=tr}const config$1=Object.freeze(Object.defineProperty({__proto__:null,getKazooUrl,getLlmCallUrl,getPulseBearerToken,getPulseUrl,getScreenshotMainContentSelector,getStructuredResponseUrl,getSynthesizeUrl,getTranscribeUrl,setKazooUrlStrategy,setLlmCallUrlStrategy,setPulseBearerTokenStrategy,setPulseUrlStrategy,setScreenshotMainContentSelector,setStructuredResponseUrlStrategy},Symbol.toStringTag,{value:"Module"}));async function getChatCompletion({model:tr,temperature:er,stream:rr,messages:ir,tools:ar,onChunk:nr,onError:or,onComplete:lr,systemInstruction:fr}){var cr;const dr=getPulseBearerToken();try{const ur=await fetch(getLlmCallUrl(),{method:"POST",body:JSON.stringify({model:tr,temperature:er,stream:rr,messages:ir,tools:ar,systemInstruction:fr}),credentials:dr?void 0:"include",headers:{"Content-Type":"application/json",Accept:rr?"text/event-stream":"application/json",...dr?{Authorization:`Bearer ${dr}`}:{}}});if(!ur||!ur.ok)throw new Error("Unable to connect to LLM API. Please try again.");if(rr){const hr=(cr=ur.body)==null?void 0:cr.getReader();if(!hr)throw new Error("Unexpected client error. Response body reader not available.");const gr=new TextDecoder,_r=[],pr=nr||(Fr=>{_r.push(Fr)}),mr=1e4;for(;mr>0;){const{done:Fr,value:Ar}=await hr.read();if(Fr)break;const br=gr.decode(Ar),yr=NdJson.parse(br);for(const xr of yr)pr(xr)}return lr==null||lr(),_r}return(await ur.json()).parts}catch(ur){const sr=ur instanceof Error?ur:new Error("Unexpected error calling LLM API");throw or==null||or(sr),sr}}var Voice=(tr=>(tr.AOEDE="Aoede",tr.PUCK="Puck",tr.CHARON="Charon",tr.KORE="Kore",tr.FENRIR="Fenrir",tr.LEDA="Leda",tr.ORUS="Orus",tr.ZEPHYR="Zephyr",tr))(Voice||{});async function synthesizeText(tr,er){const rr=getPulseBearerToken(),ir=await fetch(getSynthesizeUrl(),{method:"POST",body:JSON.stringify({text:tr,voice:er}),credentials:rr?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...rr?{Authorization:`Bearer ${rr}`}:{}}});if(!ir||!ir.ok)throw new Error("Unable to connect to LLM API. Please try again.");const ar=await ir.json();if(!ar.synthesis)throw new Error("No synthesis data received.");return ar.synthesis}async function transcribeAudio(tr){const er=getPulseBearerToken(),rr=await fetch(getTranscribeUrl(),{method:"POST",body:JSON.stringify({audio:tr}),credentials:er?void 0:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...er?{Authorization:`Bearer ${er}`}:{}}});if(!rr||!rr.ok)throw new Error("Unable to connect to LLM API. Please try again.");const ir=await rr.json();if(!ir.transcription)throw new Error("No transcription data received.");return ir.transcription}function useAiAssistantSession({model:tr,initialMessages:er,temperature:rr,onAfterLlmCall:ir,onBeforeLlmCall:ar,onError:nr,tools:or,onChunkAdded:lr,systemInstruction:fr,onLlmTextReply:dr}={}){const[cr,ur]=React.useState(!1),[sr,hr]=React.useState(!1),[gr,_r]=React.useState(()=>(er==null?void 0:er.map(vr=>({...vr,timestamp:coalesce(vr.timestamp,new Date)})))??[]),[pr,mr]=React.useState(null),Fr=React.useRef([]),Ar=React.useRef({onAfterLlmCall:ir,onBeforeLlmCall:ar,onError:nr,tools:or,onLlmTextReply:dr,model:tr,temperature:rr,isMounted:!0,systemInstruction:fr,onChunkAdded:lr});Ar.current={onAfterLlmCall:ir,onBeforeLlmCall:ar,onError:nr,tools:or,onLlmTextReply:dr,model:tr,temperature:rr,isMounted:!0,systemInstruction:fr,onChunkAdded:lr},React.useEffect(()=>()=>{Ar.current.isMounted=!1},[]);const br=React.useCallback(async vr=>await transcribeAudio(vr),[]),yr=React.useCallback(async vr=>await synthesizeText(vr),[]),xr=React.useMemo(()=>getSendMessagesHandler({propRefs:Ar,debugInfo:Fr,setConnectionError:mr,setIsLoading:ur,setMessages:_r}),[]),wr=React.useCallback(async vr=>{const Er=[...gr],Dr={role:"user",parts:[{type:"text",text:vr}],timestamp:new Date};kr(Dr),await xr([...Er,Dr])||(Fr.current.push({time:new Date,message:"Error sending message. Reverting to original messages",data:Er,level:"error"}),_r(Er))},[gr]),kr=React.useCallback(vr=>{_r([...gr,vr])},[gr]);return{isLoading:cr,messages:gr,setMessages:_r,isVoiceEnabled:sr,setIsVoiceEnabled:hr,getSpeech:yr,getTranscription:br,debugInfo:Fr.current,addMessage:kr,sendUserMessage:wr,connectionError:pr}}async function handlePendingToolCalls({toolCalls:tr,sendMessages:er,setMessages:rr,propRefs:ir,debugInfo:ar}){var lr,fr,dr,cr;if(tr.length===0||!ir.current.isMounted)return;const nr=[];for(const ur of tr){const sr=(lr=ir.current.tools)==null?void 0:lr.find(gr=>gr.name===ur.toolName);if(!sr){(dr=(fr=ir.current).onError)==null||dr.call(fr,new Error(`Tool ${ur.toolName} not found`)),ar.current.push({time:new Date,message:`Tool ${ur.toolName} not found`,data:{toolCall:ur,tools:ir.current.tools},level:"error"});continue}const hr=`${Date.now()}-${Math.random()}`;try{rr(Fr=>{const Ar=[...Fr];return Ar.push({role:"tool",parts:[ur],id:hr,timestamp:new Date,isPending:!0,filterFromApiCalls:!0}),Ar}),ar.current.push({time:new Date,level:"info",message:"Fulfilling tool call",data:{toolCall:ur}});const gr=Date.now(),_r=coalesce((cr=ur.args)==null?void 0:cr.args,ur.args),pr=await sr.fulfill(_r),mr=Date.now();typeof pr=="string"?(nr.push({type:"toolResult",toolName:ur.toolName,result:pr}),ar.current.push({time:new Date,level:"info",message:"Tool call fulfilled",data:{toolCall:ur,durationMs:mr-gr,result:pr}})):(nr.push({type:"toolResult",toolName:ur.toolName,result:`Tool ${ur.toolName} returned the following file`}),nr.push({type:"file",fileUri:pr==null?void 0:pr.fileUri,mimeType:pr==null?void 0:pr.mimeType}),ar.current.push({time:new Date,level:"info",message:"Tool call fulfilled with file",data:{toolCall:ur,durationMs:mr-gr,result:pr}}))}catch(gr){ar.current.push({time:new Date,message:"Error calling tool",level:"error",data:{toolCall:ur,error:{message:gr.message,stack:gr.stack}}}),nr.push({type:"toolResult",toolName:ur.toolName,result:{error:{message:gr.message,stack:gr.stack}}})}finally{rr(gr=>gr.map(_r=>_r.id===hr?{..._r,isPending:!1}:_r))}}if(!ir.current.isMounted)return;let or=!1;rr(ur=>{const sr={role:"tool",parts:nr},hr=[...ur,sr];return or||(er(hr),or=!0),hr})}function ConnectionError({retry:tr}){const er=()=>{window.location.reload()};return jsxRuntimeExports.jsxs(Flex,{direction:"column",gap:"24px",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Spacer,{}),jsxRuntimeExports.jsxs(Flex,{direction:"row",gap:"8px",alignItems:"center",children:[jsxRuntimeExports.jsx(Icon,{icon:"warning",color:"#ff0000"}),jsxRuntimeExports.jsxs(Text,{children:["Error calling LLM API. If this persists, try"," ",jsxRuntimeExports.jsx("a",{href:"#",onClick:er,"data-testid":"connection-error-refresh-page",children:"refreshing the page"}),"."]})]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"flex-end",gap:"8px",children:[jsxRuntimeExports.jsx(Button,{onClick:er,variant:"system",size:"small","data-testid":"connection-error-refresh-page-button",children:"Refresh Page"}),jsxRuntimeExports.jsx(Button,{onClick:tr,variant:"primary","data-testid":"connection-error-retry-button",children:"Retry"})]})]})}function safelyInvokeUserCallback({condition:tr,setMessages:er,callbackToInvoke:rr,callbackName:ir,debugInfo:ar,onError:nr}){!tr||!rr||(ar.current.push({time:new Date,message:`Calling ${ir}`,level:"info"}),er(or=>{try{return rr(or),or}catch(lr){ar.current.push({time:new Date,message:`Error calling ${ir}`,data:lr,level:"error"}),nr&&nr(lr)}finally{ar.current.push({time:new Date,message:`Finished calling ${ir}`,level:"info"})}return or}))}function getSendMessagesHandler({setConnectionError:tr,propRefs:er,debugInfo:rr,setIsLoading:ir,setMessages:ar}){return async function nr(or){var fr,dr;if(!er.current.isMounted)return!1;ir(!0),tr(null);try{er.current.onBeforeLlmCall&&er.current.onBeforeLlmCall()}catch(cr){rr.current.push({time:new Date,message:"Error calling onBeforeLlmCall",data:cr,level:"error"})}let lr;try{er.current.systemInstruction&&(lr=await er.current.systemInstruction())}catch(cr){rr.current.push({time:new Date,message:"Error getting system instruction",data:cr,level:"error"}),(dr=(fr=er.current).onError)==null||dr.call(fr,cr)}try{const cr={type:"text",text:""},ur=[],sr=[...or];return ar(sr),await getChatCompletion({model:er.current.model,temperature:er.current.temperature,stream:!0,messages:or.filter(hr=>!hr.filterFromApiCalls),tools:er.current.tools,systemInstruction:lr,onChunk:hr=>{er.current.isMounted&&(hr.type==="text"?cr.text+=hr.text:hr.type==="toolCall"&&ur.push(hr),ar(gr=>{var pr;const _r=[...gr];return((pr=_r[_r.length-1])==null?void 0:pr.role)!=="model"&&_r.push({role:"model",parts:[],timestamp:new Date}),_r[_r.length-1].parts=[...ur,...cr.text?[cr]:[]],er.current.onChunkAdded&&er.current.onChunkAdded(),_r}))},onError:hr=>{var _r,pr;if(!er.current.isMounted)return;const gr=composeSimpleFunctions(getClosureFor(tr,null),getClosureFor(ir,!0),getClosureFor(nr,or));ir(!1),rr.current.push({time:new Date,message:"Error calling LLM API",data:hr,level:"error"}),tr({message:jsxRuntimeExports.jsx(ConnectionError,{retry:gr}),retry:gr}),(pr=(_r=er.current).onError)==null||pr.call(_r,hr)},onComplete:()=>{er.current.isMounted&&(safelyInvokeUserCallback({condition:!!er.current.onAfterLlmCall,setMessages:ar,callbackToInvoke:er.current.onAfterLlmCall,callbackName:"onAfterLlmCall",debugInfo:rr,onError:er.current.onError}),safelyInvokeUserCallback({condition:!!er.current.onLlmTextReply,setMessages:ar,callbackToInvoke:er.current.onLlmTextReply,callbackName:"onLlmTextReply",debugInfo:rr,onError:er.current.onError}),handlePendingToolCalls({toolCalls:ur,setMessages:ar,sendMessages:nr,propRefs:er,debugInfo:rr}))}}),!0}catch{return!1}finally{ir(!1)}}}function createMessageHandlers({appendMessageToConversation:tr,errorToast:er,getConversationId:rr}){const ir=appendMessageFactory(tr,er,rr),ar=ir(fr=>({role:"MODEL",messageText:fr})),nr=ir((fr,dr)=>({role:"TOOL",messageText:fr,metadata:{toolName:dr}})),or=ir(fr=>({role:"USER",messageText:fr}));return{appendAssistantMessage:ar,appendToolMessage:nr,appendUserMessage:or,handleGeneratedMessages:fr=>{if(!rr())return;fr.filter(ur=>!ur.id).forEach(ur=>{if(ur.role==="model"){const sr=ur.parts.find(hr=>hr.type==="text");sr&&"text"in sr&&(ar(sr.text),ur.id=`saved-${Date.now()}`)}else if(ur.role==="tool"){const sr=ur.parts.find(hr=>hr.type==="toolResult");sr&&"result"in sr&&"toolName"in sr&&(nr(sr.result,sr.toolName),ur.id=`saved-${Date.now()}`)}})}}}function appendMessageFactory(tr,er,rr){return function(ar){return function(...or){const lr=rr();if(lr)try{return tr({variables:{input:{conversationId:lr,message:ar(...or)}}})}catch(fr){er(fr.message)}else er("No conversation ID available");return!1}}}const getConversationsByDateRange=(tr,er,rr=0)=>{const ir=new Date;return tr.filter(ar=>{const nr=ar.updatedAt instanceof Date?ar.updatedAt:new Date(ar.updatedAt||new Date),or=Math.abs(ir.getTime()-nr.getTime()),lr=Math.ceil(or/(1e3*60*60*24));return(er===null||lr<=er)&&lr>rr})},getTruncatedTitle=tr=>tr.length>30?`${tr.substring(0,30)}...`:tr,generateChatTitle=async tr=>{try{const er=await getChatCompletion({model:"small",temperature:.25,stream:!1,messages:[{role:"user",parts:[{type:"text",text:`Generate a concise 3-4 word title for this chat based on the first message. The title should be descriptive but brief. Do not use any punctuation. Return only the title, nothing else.
|
|
306
306
|
|
|
307
307
|
First message: "${tr}"`}]}]});if(er&&er.length>0){const rr=er[0];if(rr.type==="text")return rr.text.trim()}return"New Chat"}catch(er){return console.error("Error generating chat title:",er),"New Chat"}};function extractSources(tr){var ar;const er=/\[([^\]]+)\]\((https?:\/\/[^")]+)\)(?:\s*\n\s*([^\n]+))?/g,rr=[];let ir;for(;(ir=er.exec(tr))!==null;)rr.push({name:ir[1],url:ir[2],pageInfo:(ar=ir[3])==null?void 0:ar.trim()});return rr}function removeSourcesFromText(tr){return tr.replace(/<?Source[s]*>?[:]?(\s*)((\[[^\]]+\]\([^)]+\)(?:\s*\n\s*[^\n]+)?[, ]*)+)(?:\s*<\/Source[s]*>)?/gi,"")}const styles$6={"ai-assistant-textarea":"AiAssistantComponent-module_ai-assistant-textarea_dJrtB","ai-assistant-popup-container":"AiAssistantComponent-module_ai-assistant-popup-container_OH04M","ai-assistant-chat-history-container":"AiAssistantComponent-module_ai-assistant-chat-history-container_mIJ3y","ai-assistant-chat-history-header":"AiAssistantComponent-module_ai-assistant-chat-history-header_aR6OI","ai-assistant-chat-history-button":"AiAssistantComponent-module_ai-assistant-chat-history-button_Q34D6","conversation-selected":"AiAssistantComponent-module_conversation-selected_-ijIe","ai-assistant-chat-history-button-text":"AiAssistantComponent-module_ai-assistant-chat-history-button-text_cAi5Q","text-updated":"AiAssistantComponent-module_text-updated_bYi3h","textarea-container":"AiAssistantComponent-module_textarea-container_4eE9f","placeholder-content":"AiAssistantComponent-module_placeholder-content_8vmjp","placeholder-text":"AiAssistantComponent-module_placeholder-text_8edUF","loading-container":"AiAssistantComponent-module_loading-container_7BNjW","messages-scroll-container":"AiAssistantComponent-module_messages-scroll-container_8O6Kb","ai-assistant-send-btn":"AiAssistantComponent-module_ai-assistant-send-btn_h2wdX","ai-assistant-search-input-container":"AiAssistantComponent-module_ai-assistant-search-input-container_lUZKm"};var dist$1={},dist={},ortWeb_min={exports:{}};const backends={},backendsSortedByPriority=[],registerBackend=(tr,er,rr)=>{if(er&&typeof er.init=="function"&&typeof er.createSessionHandler=="function"){const ir=backends[tr];if(ir===void 0)backends[tr]={backend:er,priority:rr};else{if(ir.priority>rr)return;if(ir.priority===rr&&ir.backend!==er)throw new Error(`cannot register backend "${tr}" using priority ${rr}`)}if(rr>=0){const ar=backendsSortedByPriority.indexOf(tr);ar!==-1&&backendsSortedByPriority.splice(ar,1);for(let nr=0;nr<backendsSortedByPriority.length;nr++)if(backends[backendsSortedByPriority[nr]].priority<=rr){backendsSortedByPriority.splice(nr,0,tr);return}backendsSortedByPriority.push(tr)}return}throw new TypeError("not a valid backend")},resolveBackend=async tr=>{const er=tr.length===0?backendsSortedByPriority:tr,rr=[];for(const ir of er){const ar=backends[ir];if(ar){if(ar.initialized)return ar.backend;if(ar.aborted)continue;const nr=!!ar.initPromise;try{return nr||(ar.initPromise=ar.backend.init()),await ar.initPromise,ar.initialized=!0,ar.backend}catch(or){nr||rr.push({name:ir,err:or}),ar.aborted=!0}finally{delete ar.initPromise}}}throw new Error(`no available backend found. ERR: ${rr.map(ir=>`[${ir.name}] ${ir.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(er){if(er!==void 0){if(typeof er!="string"||["verbose","info","warning","error","fatal"].indexOf(er)===-1)throw new Error(`Unsupported logging level: ${er}`);this.logLevelInternal=er}}get logLevel(){return this.logLevelInternal}}const env=new EnvImpl,isBigInt64ArrayAvailable=typeof BigInt64Array<"u"&&typeof BigInt64Array.from=="function",isBigUint64ArrayAvailable=typeof BigUint64Array<"u"&&typeof BigUint64Array.from=="function",NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);isBigInt64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64",BigInt64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array,"int64")),isBigUint64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64",BigUint64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array,"uint64"));const calculateSize=tr=>{let er=1;for(let rr=0;rr<tr.length;rr++){const ir=tr[rr];if(typeof ir!="number"||!Number.isSafeInteger(ir))throw new TypeError(`dims[${rr}] must be an integer, got: ${ir}`);if(ir<0)throw new RangeError(`dims[${rr}] must be a non-negative integer, got: ${ir}`);er*=ir}return er};let Tensor$1=class Mo{constructor(er,rr,ir){let ar,nr,or;if(typeof er=="string")if(ar=er,or=ir,er==="string"){if(!Array.isArray(rr))throw new TypeError("A string tensor's data must be a string array.");nr=rr}else{const fr=NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(er);if(fr===void 0)throw new TypeError(`Unsupported tensor type: ${er}.`);if(Array.isArray(rr))nr=fr.from(rr);else if(rr instanceof fr)nr=rr;else throw new TypeError(`A ${ar} tensor's data must be type of ${fr}`)}else if(or=rr,Array.isArray(er)){if(er.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const fr=typeof er[0];if(fr==="string")ar="string",nr=er;else if(fr==="boolean")ar="bool",nr=Uint8Array.from(er);else throw new TypeError(`Invalid element type of data array: ${fr}.`)}else{const fr=NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.get(er.constructor);if(fr===void 0)throw new TypeError(`Unsupported type for tensor data: ${er.constructor}.`);ar=fr,nr=er}if(or===void 0)or=[nr.length];else if(!Array.isArray(or))throw new TypeError("A tensor's dims must be a number array");const lr=calculateSize(or);if(lr!==nr.length)throw new Error(`Tensor's size(${lr}) does not match data length(${nr.length}).`);this.dims=or,this.type=ar,this.data=nr,this.size=lr}static bufferToTensor(er,rr){if(er===void 0)throw new Error("Image buffer must be defined");if(rr.height===void 0||rr.width===void 0)throw new Error("Image height and width must be defined");const{height:ir,width:ar}=rr,nr=rr.norm;let or,lr;nr===void 0||nr.mean===void 0?or=255:or=nr.mean,nr===void 0||nr.bias===void 0?lr=0:lr=nr.bias;const fr=rr.bitmapFormat!==void 0?rr.bitmapFormat:"RGBA",dr=rr.tensorFormat!==void 0&&rr.tensorFormat!==void 0?rr.tensorFormat:"RGB",cr=ir*ar,ur=dr==="RGBA"?new Float32Array(cr*4):new Float32Array(cr*3);let sr=4,hr=0,gr=1,_r=2,pr=3,mr=0,Fr=cr,Ar=cr*2,br=-1;fr==="RGB"&&(sr=3,hr=0,gr=1,_r=2,pr=-1),dr==="RGBA"?br=cr*3:dr==="RBG"?(mr=0,Ar=cr,Fr=cr*2):dr==="BGR"&&(Ar=0,Fr=cr,mr=cr*2);for(let xr=0;xr<cr;xr++,hr+=sr,_r+=sr,gr+=sr,pr+=sr)ur[mr++]=(er[hr]+lr)/or,ur[Fr++]=(er[gr]+lr)/or,ur[Ar++]=(er[_r]+lr)/or,br!==-1&&pr!==-1&&(ur[br++]=(er[pr]+lr)/or);return dr==="RGBA"?new Mo("float32",ur,[1,4,ir,ar]):new Mo("float32",ur,[1,3,ir,ar])}static async fromImage(er,rr){const ir=typeof HTMLImageElement<"u"&&er instanceof HTMLImageElement,ar=typeof ImageData<"u"&&er instanceof ImageData,nr=typeof ImageBitmap<"u"&&er instanceof ImageBitmap,or=typeof String<"u"&&(er instanceof String||typeof er=="string");let lr,fr={};if(ir){const dr=document.createElement("canvas"),cr=dr.getContext("2d");if(cr!=null){let ur=er.naturalHeight,sr=er.naturalWidth;if(rr!==void 0&&rr.resizedHeight!==void 0&&rr.resizedWidth!==void 0&&(ur=rr.resizedHeight,sr=rr.resizedWidth),rr!==void 0){if(fr=rr,rr.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");if(fr.tensorFormat="RGBA",rr.height!==void 0&&rr.height!==ur)throw new Error("Image input config height doesn't match HTMLImageElement height");if(fr.height=ur,rr.width!==void 0&&rr.width!==sr)throw new Error("Image input config width doesn't match HTMLImageElement width");fr.width=sr}else fr.tensorFormat="RGBA",fr.height=ur,fr.width=sr;dr.width=sr,dr.height=ur,cr.drawImage(er,0,0,sr,ur),lr=cr.getImageData(0,0,sr,ur).data}else throw new Error("Can not access image data")}else if(ar){const dr="RGBA";let cr,ur;if(rr!==void 0&&rr.resizedWidth!==void 0&&rr.resizedHeight!==void 0?(cr=rr.resizedHeight,ur=rr.resizedWidth):(cr=er.height,ur=er.width),rr!==void 0){if(fr=rr,rr.bitmapFormat!==void 0&&rr.bitmapFormat!==dr)throw new Error("Image input config format must be RGBA for ImageData");fr.bitmapFormat="RGBA"}else fr.bitmapFormat="RGBA";if(fr.height=cr,fr.width=ur,rr!==void 0){const sr=document.createElement("canvas");sr.width=ur,sr.height=cr;const hr=sr.getContext("2d");if(hr!=null)hr.putImageData(er,0,0),lr=hr.getImageData(0,0,ur,cr).data;else throw new Error("Can not access image data")}else lr=er.data}else if(nr){if(rr===void 0)throw new Error("Please provide image config with format for Imagebitmap");if(rr.bitmapFormat!==void 0)throw new Error("Image input config format must be defined for ImageBitmap");const dr=document.createElement("canvas").getContext("2d");if(dr!=null){const cr=er.height,ur=er.width;if(dr.drawImage(er,0,0,ur,cr),lr=dr.getImageData(0,0,ur,cr).data,rr!==void 0){if(rr.height!==void 0&&rr.height!==cr)throw new Error("Image input config height doesn't match ImageBitmap height");if(fr.height=cr,rr.width!==void 0&&rr.width!==ur)throw new Error("Image input config width doesn't match ImageBitmap width");fr.width=ur}else fr.height=cr,fr.width=ur;return Mo.bufferToTensor(lr,fr)}else throw new Error("Can not access image data")}else{if(or)return new Promise((dr,cr)=>{const ur=document.createElement("canvas"),sr=ur.getContext("2d");if(!er||!sr)return cr();const hr=new Image;hr.crossOrigin="Anonymous",hr.src=er,hr.onload=()=>{ur.width=hr.width,ur.height=hr.height,sr.drawImage(hr,0,0,ur.width,ur.height);const gr=sr.getImageData(0,0,ur.width,ur.height);if(rr!==void 0){if(rr.height!==void 0&&rr.height!==ur.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(fr.height=ur.height,rr.width!==void 0&&rr.width!==ur.width)throw new Error("Image input config width doesn't match ImageBitmap width");fr.width=ur.width}else fr.height=ur.height,fr.width=ur.width;dr(Mo.bufferToTensor(gr.data,fr))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(lr!==void 0)return Mo.bufferToTensor(lr,fr);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(er){var rr,ir;const ar=document.createElement("canvas").getContext("2d");let nr;if(ar!=null){const or=this.dims[3],lr=this.dims[2],fr=this.dims[1],dr=er!==void 0&&er.format!==void 0?er.format:"RGB",cr=er!==void 0&&((rr=er.norm)===null||rr===void 0?void 0:rr.mean)!==void 0?er.norm.mean:255,ur=er!==void 0&&((ir=er.norm)===null||ir===void 0?void 0:ir.bias)!==void 0?er.norm.bias:0,sr=lr*or;if(er!==void 0){if(er.height!==void 0&&er.height!==lr)throw new Error("Image output config height doesn't match tensor height");if(er.width!==void 0&&er.width!==or)throw new Error("Image output config width doesn't match tensor width");if(er.format!==void 0&&fr===4&&er.format!=="RGBA"||fr===3&&er.format!=="RGB"&&er.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const hr=4;let gr=0,_r=1,pr=2,mr=3,Fr=0,Ar=sr,br=sr*2,yr=-1;dr==="RGBA"?(Fr=0,Ar=sr,br=sr*2,yr=sr*3):dr==="RGB"?(Fr=0,Ar=sr,br=sr*2):dr==="RBG"&&(Fr=0,br=sr,Ar=sr*2),nr=ar.createImageData(or,lr);for(let xr=0;xr<lr*or;gr+=hr,_r+=hr,pr+=hr,mr+=hr,xr++)nr.data[gr]=(this.data[Fr++]-ur)*cr,nr.data[_r]=(this.data[Ar++]-ur)*cr,nr.data[pr]=(this.data[br++]-ur)*cr,nr.data[mr]=yr===-1?255:(this.data[yr++]-ur)*cr}else throw new Error("Can not access image data");return nr}reshape(er){return new Mo(this.type,this.data,er)}};const Tensor=Tensor$1;let InferenceSession$1=class Rs{constructor(er){this.handler=er}async run(er,rr,ir){const ar={};let nr={};if(typeof er!="object"||er===null||er instanceof Tensor||Array.isArray(er))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let or=!0;if(typeof rr=="object"){if(rr===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(rr instanceof Tensor)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(rr)){if(rr.length===0)throw new TypeError("'fetches' cannot be an empty array.");or=!1;for(const dr of rr){if(typeof dr!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(dr)===-1)throw new RangeError(`'fetches' contains invalid output name: ${dr}.`);ar[dr]=null}if(typeof ir=="object"&&ir!==null)nr=ir;else if(typeof ir<"u")throw new TypeError("'options' must be an object.")}else{let dr=!1;const cr=Object.getOwnPropertyNames(rr);for(const ur of this.outputNames)if(cr.indexOf(ur)!==-1){const sr=rr[ur];(sr===null||sr instanceof Tensor)&&(dr=!0,or=!1,ar[ur]=sr)}if(dr){if(typeof ir=="object"&&ir!==null)nr=ir;else if(typeof ir<"u")throw new TypeError("'options' must be an object.")}else nr=rr}}else if(typeof rr<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(const dr of this.inputNames)if(typeof er[dr]>"u")throw new Error(`input '${dr}' is missing in 'feeds'.`);if(or)for(const dr of this.outputNames)ar[dr]=null;const lr=await this.handler.run(er,ar,nr),fr={};for(const dr in lr)Object.hasOwnProperty.call(lr,dr)&&(fr[dr]=new Tensor(lr[dr].type,lr[dr].data,lr[dr].dims));return fr}static async create(er,rr,ir,ar){let nr,or={};if(typeof er=="string"){if(nr=er,typeof rr=="object"&&rr!==null)or=rr;else if(typeof rr<"u")throw new TypeError("'options' must be an object.")}else if(er instanceof Uint8Array){if(nr=er,typeof rr=="object"&&rr!==null)or=rr;else if(typeof rr<"u")throw new TypeError("'options' must be an object.")}else if(er instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&er instanceof SharedArrayBuffer){const ur=er;let sr=0,hr=er.byteLength;if(typeof rr=="object"&&rr!==null)or=rr;else if(typeof rr=="number"){if(sr=rr,!Number.isSafeInteger(sr))throw new RangeError("'byteOffset' must be an integer.");if(sr<0||sr>=ur.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${ur.byteLength}).`);if(hr=er.byteLength-sr,typeof ir=="number"){if(hr=ir,!Number.isSafeInteger(hr))throw new RangeError("'byteLength' must be an integer.");if(hr<=0||sr+hr>ur.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${ur.byteLength-sr}].`);if(typeof ar=="object"&&ar!==null)or=ar;else if(typeof ar<"u")throw new TypeError("'options' must be an object.")}else if(typeof ir<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof rr<"u")throw new TypeError("'options' must be an object.");nr=new Uint8Array(ur,sr,hr)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const fr=(or.executionProviders||[]).map(ur=>typeof ur=="string"?ur:ur.name),cr=await(await resolveBackend(fr)).createSessionHandler(nr,or);return new Rs(cr)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}};const InferenceSession=InferenceSession$1,lib=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession,Tensor,env,registerBackend},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(lib);/*!
|
|
308
308
|
* ONNX Runtime Web v1.14.0
|