nubot-lite 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/lib/api.mjs +6 -2
- package/lib/cloudflare.mjs +13 -12
- package/lib/commands/init.mjs +260 -251
- package/package.json +1 -1
- package/template/.claude/skills/nubot-lite/SKILL.md +7 -1
- package/template/panel/PANEL.md +1 -1
- package/template/panel/assets/AgendarDemoPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/{AgentDatasetsPage-D8vQhRWO.js → AgentDatasetsPage-wLtBtSB2.js} +2 -2
- package/template/panel/assets/AgentKnowledgeGroupsPage-BGHNFj-e.js +1 -0
- package/template/panel/assets/AgentListPage-F3ja9_o_.js +1 -0
- package/template/panel/assets/AgentQaTrainingPage-CojiU8_W.js +1 -0
- package/template/panel/assets/AiAgentWhatsappPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/BlogPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/BlogPostPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/CalculadoraTiempoRespuestaPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/{CampaignDetailPage-DFMctNEj.js → CampaignDetailPage-DUNnckvn.js} +1 -1
- package/template/panel/assets/CampaignsPage-CS60yZBd.js +1 -0
- package/template/panel/assets/ChannelSelector-C7R9zqrt.js +1 -0
- package/template/panel/assets/ChatbotParaWhatsappPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/ConfirmModal-B27OBQdm.js +1 -0
- package/template/panel/assets/ContactsPage-CvoDlFUN.js +14 -0
- package/template/panel/assets/CreateAgentPage-CbhikMY1.js +19 -0
- package/template/panel/assets/CreditLimitBanner-j72L7jgK.js +1 -0
- package/template/panel/assets/CrmParaWhatsappPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/DashboardPage-BGWkXY7W.js +1 -0
- package/template/panel/assets/{EmojiPicker-BToAe-MT.js → EmojiPicker-ByTMSXTj.js} +1 -1
- package/template/panel/assets/{EventTypesSettingsPage-DCedeQzM.js → EventTypesSettingsPage-CLpO1VBL.js} +1 -1
- package/template/panel/assets/GeneradorEnlacesPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/GeneradorQrWhatsappPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/{GeneralSettingsPage-B04ozcHb.js → GeneralSettingsPage-CY-5aGgL.js} +1 -1
- package/template/panel/assets/GoogleCalendarManagePage-oX7DuErV.js +1 -0
- package/template/panel/assets/{InvitationAcceptancePage-BPgtBFl5.js → InvitationAcceptancePage-BYllrAYs.js} +1 -1
- package/template/panel/assets/IrAlSitioPublico-Bn_BvTp1.js +1 -0
- package/template/panel/assets/LiteAiUsagePage-Dzm8jBL2.js +1 -0
- package/template/panel/assets/{LiteSetupPage-42rgAdnG.js → LiteSetupPage-CMSAur_e.js} +1 -1
- package/template/panel/assets/MarkdownRenderer-C3TD9KYa.js +3 -0
- package/template/panel/assets/MediaProcessingService-CG2DdSyN.js +1 -0
- package/template/panel/assets/NewCampaignPage-BfSEd075.js +1 -0
- package/template/panel/assets/OrdersConfigPage-BAKKaX0L.js +1 -0
- package/template/panel/assets/OrdersPage-CXiPOCXP.js +1 -0
- package/template/panel/assets/{PasswordStrengthIndicator-HZK_oU0W.js → PasswordStrengthIndicator-4h-Y0s2r.js} +1 -1
- package/template/panel/assets/PlantillaDetailPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/PlantillasIndexPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/PrivacyPolicy-Bn_BvTp1.js +1 -0
- package/template/panel/assets/{ProductManagementPage-DNM7DEgt.js → ProductManagementPage-CRkNTicv.js} +4 -4
- package/template/panel/assets/PublicFormPage-BxPxJ3Pq.js +1 -0
- package/template/panel/assets/QaForm-Px-cmakA.js +5 -0
- package/template/panel/assets/SelectPlanPage-Gyo5C1Hq.js +1 -0
- package/template/panel/assets/SignatureEditor-DIhmrXow.js +1 -0
- package/template/panel/assets/{TagSelector-ChoKzvjW.js → TagSelector-o6tVpRs9.js} +1 -1
- package/template/panel/assets/TagsSettingsPage-DT8MfW1H.js +2 -0
- package/template/panel/assets/TeamsPage-BuWuGxZo.js +1 -0
- package/template/panel/assets/WhatsappBusinessApiPage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/WhatsappMultiagentePage-Bn_BvTp1.js +1 -0
- package/template/panel/assets/{account-D2ltXC_U.js → account-G3WXxisG.js} +1 -1
- package/template/panel/assets/{admin-lEgqZTsa.js → admin-CSMlOMR8.js} +1 -1
- package/template/panel/assets/{agent.service-BcAkMU7j.js → agent.service-BE2rJG_o.js} +1 -1
- package/template/panel/assets/{alert-dialog-D8P69s-m.js → alert-dialog-gzZZoAiu.js} +2 -2
- package/template/panel/assets/{alert-DI3GBLi1.js → alert-seLKo73M.js} +1 -1
- package/template/panel/assets/api-keys-BF33GS2N.js +1 -0
- package/template/panel/assets/{archive-LUe5bKi5.js → archive-CxUKRJwu.js} +1 -1
- package/template/panel/assets/{arrow-left-BeDdBs_Q.js → arrow-left-CI7mH7bD.js} +1 -1
- package/template/panel/assets/{arrow-up-BiBq8Pvx.js → arrow-up-DJzXCc8_.js} +1 -1
- package/template/panel/assets/{arrow-up-down-CaG2BONN.js → arrow-up-down-DkSCsCjR.js} +1 -1
- package/template/panel/assets/audit-slljESxh.js +1 -0
- package/template/panel/assets/{authService-Cbm8LdlJ.js → authService-CtvlzCDa.js} +1 -1
- package/template/panel/assets/{avatar-CILB1zwS.js → avatar-BXhSKQGY.js} +1 -1
- package/template/panel/assets/{billing-IVLNopU2.js → billing-Cy2XUBeY.js} +1 -1
- package/template/panel/assets/{brain-B9z7jZ7A.js → brain-BmrjUpsb.js} +1 -1
- package/template/panel/assets/{calendar-CIHhMjNy.js → calendar-Bu0aDtW1.js} +1 -1
- package/template/panel/assets/{calendar-days-BwJfOz8M.js → calendar-days-CXtOZxOF.js} +1 -1
- package/template/panel/assets/{card-DcKsxjXK.js → card-DdbmSh-v.js} +1 -1
- package/template/panel/assets/{checkbox-pcbjC0d3.js → checkbox-CuJh5AMO.js} +1 -1
- package/template/panel/assets/{chevrons-up-down-DC-BWTrj.js → chevrons-up-down-DNNdNhV8.js} +1 -1
- package/template/panel/assets/{circle-check-big-DzPo5zZX.js → circle-check-big-BOZQ_2Kv.js} +1 -1
- package/template/panel/assets/{circle-x-BwMKIs8b.js → circle-x-decmm7ip.js} +1 -1
- package/template/panel/assets/cloud-B3m0_VpL.js +1 -0
- package/template/panel/assets/{code-BMAyHFJe.js → code-C-UH-ZD-.js} +1 -1
- package/template/panel/assets/{cog-M7j64wa2.js → cog-BS-_-U4F.js} +1 -1
- package/template/panel/assets/{collapsible-B22t1J-V.js → collapsible-Ce_8EeFJ.js} +1 -1
- package/template/panel/assets/{command-COdSmSIB.js → command-aHRTWaYV.js} +1 -1
- package/template/panel/assets/connectionsService-BJg4S1e9.js +1 -0
- package/template/panel/assets/contactsApi-DI5dcMLo.js +1 -0
- package/template/panel/assets/creditErrors-DSbswjsG.js +1 -0
- package/template/panel/assets/{database-C1qvt3Py.js → database-Brb7Omak.js} +1 -1
- package/template/panel/assets/{datapath-C12uI_pT.js → datapath-CHeKabeh.js} +1 -1
- package/template/panel/assets/{datetime-BuZosCVk.js → datetime-D72Uxhjs.js} +1 -1
- package/template/panel/assets/{download-CiVQHPeB.js → download-CyfdxFCW.js} +1 -1
- package/template/panel/assets/{ellipsis-CMEJnUfK.js → ellipsis-GLu0u4ze.js} +1 -1
- package/template/panel/assets/{ellipsis-vertical-DTqbEYYp.js → ellipsis-vertical-CskGwbgN.js} +1 -1
- package/template/panel/assets/email-inbox-kyJ2qML5.js +1 -0
- package/template/panel/assets/es-BDgg6unH.js +1 -0
- package/template/panel/assets/external-link-w7K66ae2.js +1 -0
- package/template/panel/assets/{eye-HfQCUjxJ.js → eye-CR5C6hVv.js} +1 -1
- package/template/panel/assets/{eye-off-v1Z_lKS0.js → eye-off-CBiJXw4j.js} +1 -1
- package/template/panel/assets/facebook-D0SQMea2.js +1 -0
- package/template/panel/assets/{file-DMzjdlTL.js → file-CTZ8-xmL.js} +1 -1
- package/template/panel/assets/file-braces-54MsOnzo.js +1 -0
- package/template/panel/assets/file-spreadsheet-DpekIaV8.js +1 -0
- package/template/panel/assets/{folder-D0GKakGp.js → folder-DxTHNhQ_.js} +1 -1
- package/template/panel/assets/{folder-open-DQFc4qTJ.js → folder-open-BM4rA96e.js} +1 -1
- package/template/panel/assets/format-BG1mN6C0.js +1 -0
- package/template/panel/assets/{grip-vertical-FN-eTC2C.js → grip-vertical-CS-dU0tJ.js} +1 -1
- package/template/panel/assets/{hash-BoTE56iw.js → hash-ByrjK6gt.js} +1 -1
- package/template/panel/assets/{help-center-B1MAIBWA.js → help-center-fmvvoAkD.js} +1 -1
- package/template/panel/assets/{history-DhHayxUg.js → history-97D1GT_9.js} +1 -1
- package/template/panel/assets/house-CXew5LB-.js +1 -0
- package/template/panel/assets/{index-DsyZ_FlA.js → index-43NA2pdZ.js} +23 -23
- package/template/panel/assets/index-BG59-Kyv.js +6 -0
- package/template/panel/assets/{index-DUnioqCT.js → index-BGvtgHY3.js} +1 -1
- package/template/panel/assets/index-BL76lyPt.js +2 -0
- package/template/panel/assets/index-BUA9lP4J.js +1 -0
- package/template/panel/assets/index-Bfvq4Q3v.js +1 -0
- package/template/panel/assets/index-CK793Wzl.css +1 -0
- package/template/panel/assets/{index-BTxe6gLJ.js → index-ChrvveQm.js} +1 -1
- package/template/panel/assets/index-CoJIvJ6y.js +1 -0
- package/template/panel/assets/{index-CMEeV9dO.js → index-CsV1u-Y7.js} +2 -2
- package/template/panel/assets/{index-BiSc3WD9.js → index-DIxON2Dm.js} +1 -1
- package/template/panel/assets/index-DtoSJTyl.js +1 -0
- package/template/panel/assets/index-FBuxpbGF.js +36 -0
- package/template/panel/assets/index-YR5X3nd4.js +1 -0
- package/template/panel/assets/{instagram-CC7iYt7V.js → instagram-Bm17x-Fs.js} +1 -1
- package/template/panel/assets/interactiveLimits-C7Sx7s9W.js +1 -0
- package/template/panel/assets/landing-CEUFhLJ9.js +1 -0
- package/template/panel/assets/{layout-grid-Cm6hfBWZ.js → layout-grid-DN-t2Wjd.js} +1 -1
- package/template/panel/assets/{list-BKc6EXnV.js → list-B0uLKf1b.js} +1 -1
- package/template/panel/assets/{map-pin-CPmcofD3.js → map-pin-COYHwobx.js} +1 -1
- package/template/panel/assets/{maximize-2-WdbM7Kdx.js → maximize-2-SbmXBBYe.js} +1 -1
- package/template/panel/assets/mediaLimits-CAYdWqeQ.js +1 -0
- package/template/panel/assets/mediaValidation-Bg0xHQrv.js +1 -0
- package/template/panel/assets/message-circle-tNSzOeOW.js +1 -0
- package/template/panel/assets/{message-square-Dfn16oHc.js → message-square-B1_OirdW.js} +1 -1
- package/template/panel/assets/{meta-templates-C7yEjSOI.js → meta-templates-hhDdxBOR.js} +1 -1
- package/template/panel/assets/metadataSchemasApi-BmJko2eC.js +1 -0
- package/template/panel/assets/{mic-CT4vyzLZ.js → mic-ClFq9hMZ.js} +1 -1
- package/template/panel/assets/minus-vh4a51Mn.js +1 -0
- package/template/panel/assets/{music-Cu8AQMFp.js → music-CgtkroYi.js} +1 -1
- package/template/panel/assets/{page-components-o2TF52HV.js → page-components-DXOKtt_M.js} +1 -1
- package/template/panel/assets/{pages-Cj5Qd1QO.js → pages-BcYbyh_-.js} +1 -1
- package/template/panel/assets/{pages-B7digtXi.js → pages-BuibyrnC.js} +1 -1
- package/template/panel/assets/{pages-Dw7dvmaS.js → pages-CGXCBdff.js} +1 -1
- package/template/panel/assets/paperclip-DVRbzE7C.js +1 -0
- package/template/panel/assets/{pen-line-DLnhkIuw.js → pen-line-Cr0YFjAs.js} +1 -1
- package/template/panel/assets/{pencil-Cx8u1N8t.js → pencil-aqjc7AWb.js} +1 -1
- package/template/panel/assets/{popover-MyuU-yAK.js → popover-cWIhNmod.js} +1 -1
- package/template/panel/assets/{power-CdR2OkIX.js → power-CVFzhVJx.js} +1 -1
- package/template/panel/assets/{product.service-CRLZOQsr.js → product.service-FClit10f.js} +1 -1
- package/template/panel/assets/products.types-nZIsk2w8.js +1 -0
- package/template/panel/assets/proxy-CvX2KM2u.js +1 -0
- package/template/panel/assets/{save-Dua2yhWl.js → save-mwkHDnDL.js} +1 -1
- package/template/panel/assets/scroll-area-CSCo4HHB.js +1 -0
- package/template/panel/assets/{select-DlB_BbfM.js → select-DCY_lg9j.js} +1 -1
- package/template/panel/assets/{send-Dxmdupsl.js → send-DBQH77K9.js} +1 -1
- package/template/panel/assets/{separator-CPT3uVRM.js → separator-DznqP68l.js} +1 -1
- package/template/panel/assets/{settings-2-C-c8ECWW.js → settings-2-PhKPMrsj.js} +1 -1
- package/template/panel/assets/shield-alert-Fv3j9Wbv.js +1 -0
- package/template/panel/assets/{skeleton-B0zh8s_y.js → skeleton-CN6xlRXP.js} +1 -1
- package/template/panel/assets/{slider-CY71MXOW.js → slider-D0QB_Lme.js} +1 -1
- package/template/panel/assets/{square-BuGqLxJB.js → square-Dm5VC71z.js} +1 -1
- package/template/panel/assets/{square-pen-CJajoyrm.js → square-pen-Dbn7xmc-.js} +1 -1
- package/template/panel/assets/{star-Cuegk1GF.js → star-BMD3HmS6.js} +1 -1
- package/template/panel/assets/stat-card-W7s_-fHW.js +1 -0
- package/template/panel/assets/storage.api-C0ZJBoSz.js +20 -0
- package/template/panel/assets/{switch-ODBa0fCT.js → switch-C7XmAU1c.js} +1 -1
- package/template/panel/assets/{table-CvSELOPi.js → table-7NGq0kRw.js} +1 -1
- package/template/panel/assets/{tabs-DqXhuAr6.js → tabs-BGCKrmVw.js} +1 -1
- package/template/panel/assets/{tags-By_tlh_r.js → tags-HU2fuPFH.js} +1 -1
- package/template/panel/assets/{target-DEuCdeUI.js → target-CG_g4_Fj.js} +1 -1
- package/template/panel/assets/{textarea-BYtcLsMD.js → textarea-B1anutjq.js} +1 -1
- package/template/panel/assets/{ticket-CWba7G1i.js → ticket-CHs1Xojr.js} +1 -1
- package/template/panel/assets/{trash-2-Du2vmQCH.js → trash-2-D_kmHMwn.js} +1 -1
- package/template/panel/assets/{trending-up-Ba4HSvuW.js → trending-up-BnHeLWFs.js} +1 -1
- package/template/panel/assets/{upload-C7TwpdyA.js → upload-CQg4_W5r.js} +1 -1
- package/template/panel/assets/{useAiAgentsQuery-Bm6aRHKj.js → useAiAgentsQuery-CXo6TmU6.js} +1 -1
- package/template/panel/assets/useFunnelStats-Bk8wTET5.js +1 -0
- package/template/panel/assets/useFunnelsQuery-vDrahaDr.js +1 -0
- package/template/panel/assets/{useInfiniteQuery-BXUM1Z9V.js → useInfiniteQuery-D0sFT2K2.js} +1 -1
- package/template/panel/assets/{useMutation-a5tIBvQY.js → useMutation-0ypmz8SO.js} +1 -1
- package/template/panel/assets/useOrgSyncedFetch-FSgwRhpR.js +1 -0
- package/template/panel/assets/usePipelineBoardQuery-BysscZXI.js +9 -0
- package/template/panel/assets/{useUploadConfig-BuiF0X-3.js → useUploadConfig-CvVmSc6S.js} +1 -1
- package/template/panel/assets/{user-DwCALzIG.js → user-l48WDfDH.js} +1 -1
- package/template/panel/assets/{user-plus-BiUjcHil.js → user-plus-CWaaUP-O.js} +1 -1
- package/template/panel/assets/{video-VfwKgB6z.js → video-CILE66CA.js} +1 -1
- package/template/panel/assets/{volume-2-C5DMdOVq.js → volume-2-DfFqN0dw.js} +1 -1
- package/template/panel/assets/wrench-Dcbk4scY.js +1 -0
- package/template/panel/index.html +2 -2
- package/template/panel/version.json +2 -2
- package/template/worker/migrations/0006_ai_usage.sql +33 -0
- package/template/worker/migrations/0007_channels.sql +18 -0
- package/template/worker/src/agent/pricing.ts +37 -0
- package/template/worker/src/agent/prompt.ts +137 -134
- package/template/worker/src/agent/run.ts +350 -243
- package/template/worker/src/agent/sandbox.ts +2 -2
- package/template/worker/src/agent/tools.ts +463 -463
- package/template/worker/src/channels/accounts.ts +177 -0
- package/template/worker/src/channels/zernio.ts +161 -148
- package/template/worker/src/inbox/contacts.ts +2 -0
- package/template/worker/src/inbox/store.ts +199 -187
- package/template/worker/src/index.ts +2 -0
- package/template/worker/src/nubot/account.ts +163 -178
- package/template/worker/src/nubot/ai-usage.ts +197 -0
- package/template/worker/src/nubot/channels.ts +159 -0
- package/template/worker/src/nubot/contacts.ts +387 -386
- package/template/worker/src/nubot/funnels.ts +672 -670
- package/template/worker/src/nubot/inbox.ts +623 -616
- package/template/worker/src/nubot/index.ts +127 -122
- package/template/worker/src/nubot/mappers.ts +12 -5
- package/template/worker/src/routes/channels.ts +13 -0
- package/template/worker/src/routes/system.ts +110 -100
- package/template/worker/src/webhooks/zernio.ts +154 -125
- package/template/panel/assets/AgendarDemoPage-DOiS40FL.js +0 -1
- package/template/panel/assets/AgentKnowledgeGroupsPage-DEPS1lsk.js +0 -1
- package/template/panel/assets/AgentListPage-DqY9rze5.js +0 -1
- package/template/panel/assets/AgentQaTrainingPage-Ecis7xoc.js +0 -1
- package/template/panel/assets/AiAgentWhatsappPage-DOiS40FL.js +0 -1
- package/template/panel/assets/AiMetricsPage-DEPS1lsk.js +0 -1
- package/template/panel/assets/BlogPage-DOiS40FL.js +0 -1
- package/template/panel/assets/BlogPostPage-DOiS40FL.js +0 -1
- package/template/panel/assets/CalculadoraTiempoRespuestaPage-DOiS40FL.js +0 -1
- package/template/panel/assets/CampaignsPage-CLRaXGlj.js +0 -1
- package/template/panel/assets/ChannelSelector-q9tTirNo.js +0 -1
- package/template/panel/assets/ChatbotParaWhatsappPage-DOiS40FL.js +0 -1
- package/template/panel/assets/ConfirmModal-W7VUI3Z_.js +0 -1
- package/template/panel/assets/ContactsPage-CsOFsOPw.js +0 -14
- package/template/panel/assets/CreateAgentPage-Ifxx6_UX.js +0 -19
- package/template/panel/assets/CreditLimitBanner-J49rSVEn.js +0 -1
- package/template/panel/assets/CrmParaWhatsappPage-DOiS40FL.js +0 -1
- package/template/panel/assets/DashboardPage-3Viy83dd.js +0 -1
- package/template/panel/assets/GeneradorEnlacesPage-DOiS40FL.js +0 -1
- package/template/panel/assets/GeneradorQrWhatsappPage-DOiS40FL.js +0 -1
- package/template/panel/assets/IrAlSitioPublico-DOiS40FL.js +0 -1
- package/template/panel/assets/MediaProcessingService-glHGiE_o.js +0 -1
- package/template/panel/assets/NewCampaignPage-Cw99m3W8.js +0 -1
- package/template/panel/assets/OrdersConfigPage-B6BfM3lf.js +0 -1
- package/template/panel/assets/OrdersPage-Du7CJjty.js +0 -1
- package/template/panel/assets/PlantillaDetailPage-DOiS40FL.js +0 -1
- package/template/panel/assets/PlantillasIndexPage-DOiS40FL.js +0 -1
- package/template/panel/assets/PrivacyPolicy-DOiS40FL.js +0 -1
- package/template/panel/assets/PublicFormPage-DDb4OXEM.js +0 -1
- package/template/panel/assets/QaForm-BDboHNKo.js +0 -5
- package/template/panel/assets/SelectPlanPage-DALaf8E5.js +0 -1
- package/template/panel/assets/TagsSettingsPage-DYCKveQq.js +0 -2
- package/template/panel/assets/TeamsPage-DPUcRdlh.js +0 -1
- package/template/panel/assets/WhatsappBusinessApiPage-DOiS40FL.js +0 -1
- package/template/panel/assets/WhatsappMultiagentePage-DOiS40FL.js +0 -1
- package/template/panel/assets/api-keys-B0UQNR5E.js +0 -1
- package/template/panel/assets/audit-BrdHcTNl.js +0 -1
- package/template/panel/assets/connections-Dqwd01UI.js +0 -1
- package/template/panel/assets/connectionsService-BsJf8pFz.js +0 -3
- package/template/panel/assets/contactsApi-B851NME_.js +0 -1
- package/template/panel/assets/creditErrors-CrpkwwUI.js +0 -1
- package/template/panel/assets/email-inbox-LbGeQCty.js +0 -1
- package/template/panel/assets/es-BG480iA5.js +0 -1
- package/template/panel/assets/facebook-RxMBweMB.js +0 -1
- package/template/panel/assets/index-B183O0S5.js +0 -1
- package/template/panel/assets/index-BJCPaymI.css +0 -1
- package/template/panel/assets/index-BtxJGfLL.js +0 -6
- package/template/panel/assets/index-Bz-ixwph.js +0 -1
- package/template/panel/assets/index-CjQSv8hF.js +0 -2
- package/template/panel/assets/index-D3vkHHjD.js +0 -9
- package/template/panel/assets/index-D4WhIkMN.js +0 -1
- package/template/panel/assets/interactiveLimits-CfLJ1O4_.js +0 -1
- package/template/panel/assets/landing-If3oVsS0.js +0 -1
- package/template/panel/assets/mediaValidation-BR-ZOj5w.js +0 -1
- package/template/panel/assets/minus-CyVEzdqL.js +0 -1
- package/template/panel/assets/products.types-46xSxBS8.js +0 -1
- package/template/panel/assets/scroll-area-CavEOIyz.js +0 -1
- package/template/panel/assets/shield-alert-04pSYngI.js +0 -1
- package/template/panel/assets/storage.api-CFU3KJNp.js +0 -20
- package/template/panel/assets/useFunnelStats-tvjpmWIC.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: nubot-lite
|
|
3
|
-
description: Instala Nubot Lite (CRM de WhatsApp con agente de IA, en Cloudflare) paso a paso y arma el agente de una empresa conversando con la persona. Úsala cuando pidan instalar Nubot Lite, conectar su agente o su
|
|
3
|
+
description: Instala Nubot Lite (CRM de WhatsApp, Instagram y Facebook con agente de IA, en Cloudflare) paso a paso y arma el agente de una empresa conversando con la persona. Úsala cuando pidan instalar Nubot Lite, conectar su agente, su WhatsApp, su Instagram o su Facebook, crear o mejorar el agente de su negocio, cargar su catálogo, su web o sus fotos, probar qué responde el agente o saber cuánto gasta la IA.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Nubot Lite: instalar y armar el agente de una empresa
|
|
@@ -80,6 +80,12 @@ Pide la API key sin mostrarla, encuentra el número y deja registrado el webhook
|
|
|
80
80
|
espera a que presione Enter. Al terminar, pídele que escriba a ese número desde otro celular y que mire la conversación
|
|
81
81
|
en el CRM. Propón el paso 4.
|
|
82
82
|
|
|
83
|
+
**Instagram y Facebook** no se conectan con un comando: con la cuenta de Zernio ya conectada (este paso), la persona
|
|
84
|
+
entra al panel → **Conexiones** → **Conectar** en Instagram o Facebook, entra con su cuenta de Meta y vuelve al CRM.
|
|
85
|
+
Instagram tiene que ser Business o Creator. En Zernio las 2 primeras cuentas son gratis; desde la tercera cuestan
|
|
86
|
+
US$ 6 al mes y Zernio pide tarjeta. Si pregunta cuánto gasta la IA: panel → **Agentes IA → Métricas** (tiempo, tokens
|
|
87
|
+
y costo estimado de cada respuesta, con descarga en CSV).
|
|
88
|
+
|
|
83
89
|
## 4. Armar el agente con la información del negocio
|
|
84
90
|
|
|
85
91
|
Los pasos 5 a 10 dejan al agente sabiendo de su negocio. Es lo que más cambia la calidad de las respuestas.
|
package/template/panel/PANEL.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Panel de Nubot Lite compilado desde el frontend de Nubot (edición Lite, commit
|
|
1
|
+
Panel de Nubot Lite compilado desde el frontend de Nubot (edición Lite, commit 29123df).
|
|
2
2
|
No se edita a mano: se regenera con scripts/sync-panel.mjs.
|
|
3
3
|
No es código abierto: su licencia está en LICENSE.md.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
package/template/panel/assets/{AgentDatasetsPage-D8vQhRWO.js → AgentDatasetsPage-wLtBtSB2.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as W,h as X,t as b,j as e,
|
|
2
|
-
`).length>6)&&e.jsx("div",{className:"mt-4 pt-2 border-t border-slate-50 dark:border-slate-800/50 flex justify-center",children:e.jsx(c,{variant:"ghost",size:"sm",onClick:()=>P(t.id),className:"h-7 px-4 text-[10px] font-medium text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900/20 rounded-full transition-all flex items-center gap-1.5",children:q?e.jsx(e.Fragment,{children:"Ver menos"}):e.jsx(e.Fragment,{children:"Ver más contenido"})})})]})},s.key)})})}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[e.jsx(te,{className:"h-8 w-8 text-slate-200 mb-2"}),e.jsx("span",{className:"text-sm",children:"No se encontraron resultados"})]})}),e.jsxs("div",{className:"text-[10px] text-center text-slate-400 shrink-0",children:["Mostrando ",d.length," resultados"]})]}))}function Ke(){const{currentOrganization:n}=X(),[D,w]=r.useState(!0),[T,i]=r.useState([]),[j,I]=r.useState(""),[O,x]=r.useState(!1),[u,h]=r.useState(!1),[m,p]=r.useState(null),[o,f]=r.useState(null),[y,P]=r.useState(""),F=r.useRef(null);r.useEffect(()=>{if(n?.id){if(F.current===n.id)return;F.current=n.id,i([]),I(""),f(null),x(!1),N()}},[n?.id]);const N=async()=>{if(n){w(!0);try{const s=(await E.listKnowledgeCollections(n.id)).map(l=>({sourceId:l.sourceId,filename:l.filename,uploadedAt:l.createdAt||l.uploadedAt,chunkCount:l.chunkCount,type:"document"}));s.sort((l,t)=>new Date(t.uploadedAt).getTime()-new Date(l.uploadedAt).getTime()),i(s)}catch(a){console.error("Error fetching datasets:",a),b.error("Error cargando datasets")}finally{w(!1)}}},U=a=>{const s=a.target.files?.[0];s&&p(s)},B=()=>{f(null),p(null),x(!0)},S=a=>{f(a),P(a.filename),x(!0)},v=async()=>{if(n){h(!0);try{if(o)await E.updateSource(o.sourceId,{filename:y,organizationId:n.id}),b.success("Documento actualizado correctamente");else{if(!m)return;await E.uploadKnowledge(m,n.id),b.success("Archivo subido e indexado correctamente")}p(null),f(null),x(!1),N()}catch(a){console.error(a),b.error(o?"Error actualizando documento":"Error al subir el archivo")}finally{h(!1)}}},C=async a=>{if(n&&confirm("¿Estás seguro de eliminar este documento? Esta acción no se puede deshacer."))try{await E.deleteSource(a,n.id),b.success("Documento eliminado"),N()}catch(s){console.error("Error deleting dataset:",s),b.error("Error eliminando documento")}},d=T.filter(a=>a.filename.toLowerCase().includes(j.toLowerCase()));return e.jsxs(re,{children:[e.jsx(le,{title:"Documentos",description:"Gestiona los documentos (PDF/TXT) que tus agentes utilizan como fuente de conocimiento.",icon:be,actions:e.jsxs(Y,{open:O,onOpenChange:x,children:[e.jsx(Z,{asChild:!0,children:e.jsxs(c,{className:"bg-primary hover:bg-primary/90 text-white shadow-lg shadow-primary/20 rounded-full font-bold px-6",onClick:B,children:[e.jsx($,{className:"h-4 w-4 mr-2"})," Subir Documento"]})}),e.jsxs(J,{className:"w-full sm:max-w-2xl p-0 flex flex-col",side:"right",children:[e.jsx("div",{className:"p-6 pb-4 bg-muted/20 border-b border-border/40",children:e.jsx(ee,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-xl bg-blue-500/10 flex items-center justify-center shrink-0 border border-blue-500/20 shadow-sm",children:e.jsx($,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap pt-0.5",children:[e.jsx(se,{className:"text-xl font-bold tracking-tight",children:o?"Editar Documento":"Subir Nuevo Documento"}),e.jsx(g,{variant:"secondary",className:"uppercase text-[9px] font-bold tracking-widest px-2 bg-blue-500/10 text-blue-600 border-blue-500/20",children:o?"METADATA":"KNOWLEDGE BASE"})]}),e.jsx("div",{className:"text-xs text-muted-foreground/80 font-medium mt-1",children:o?"Modifica los detalles del documento.":"Carga archivos PDF o TXT para enriquecer el conocimiento."})]})]})})}),e.jsx("div",{className:"flex-1 p-6 space-y-6 bg-slate-50/50 dark:bg-slate-900/20 flex flex-col min-h-0",children:e.jsx("div",{className:"space-y-6 h-full flex flex-col min-h-0",children:o?e.jsxs(ce,{defaultValue:"config",className:"w-full h-full flex flex-col",children:[e.jsxs(xe,{className:"grid w-full grid-cols-2 mb-6 shrink-0",children:[e.jsx(G,{value:"config",children:"Configuración"}),e.jsx(G,{value:"chunks",children:"Vista Previa"})]}),e.jsxs(H,{value:"config",className:"space-y-6 flex-1 overflow-y-auto",children:[e.jsx("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-xl p-5 shadow-sm space-y-3",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"filename",className:"font-bold text-[10px] uppercase tracking-widest text-slate-500",children:"Nombre del Archivo"}),e.jsx(R,{id:"filename",value:y,onChange:a=>P(a.target.value),className:"font-medium"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"font-bold text-[10px] uppercase tracking-widest text-slate-500",children:"Source ID (Solo Lectura)"}),e.jsx("div",{className:"text-xs font-mono bg-slate-100 dark:bg-slate-800 p-2 rounded text-slate-500 break-all select-all",children:o.sourceId})]})]})}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-900/20 rounded-xl p-4 flex gap-3",children:[e.jsx(L,{className:"h-5 w-5 text-blue-600 dark:text-blue-400 shrink-0"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-bold mb-1",children:"Información Importante"}),e.jsx("p",{className:"opacity-90 text-xs leading-relaxed",children:"El cambio de nombre se reflejará inmediatamente."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-4 border-t border-slate-100 dark:border-slate-800 mt-6",children:[e.jsx(c,{variant:"ghost",className:"flex-1 rounded-xl h-11 font-medium text-slate-500 hover:text-slate-700",onClick:()=>x(!1),children:"Cancelar"}),e.jsx(c,{onClick:v,disabled:u,className:"flex-[2] rounded-xl h-11 font-bold text-base shadow-lg shadow-blue-500/20",children:u?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-2 h-5 w-5 animate-spin"})," Guardando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"mr-2 h-5 w-5"})," Guardar Cambios"]})})]})]}),e.jsx(H,{value:"chunks",className:"space-y-4 flex-1 min-h-0 h-full",children:e.jsx(Ce,{sourceId:o.sourceId,organizationId:n?.id||""})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-xl p-5 shadow-sm space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(M,{className:"font-bold text-[10px] uppercase tracking-widest text-slate-500",children:"Documento Fuente"}),e.jsx(g,{variant:"outline",className:"text-[10px] font-mono text-slate-400 h-5 px-1.5 border-slate-200",children:"REQUIRED"})]}),e.jsxs("div",{className:"border-2 border-dashed border-slate-200 dark:border-slate-800 rounded-xl p-8 flex flex-col items-center justify-center hover:bg-slate-50 dark:hover:bg-slate-950 transition-colors cursor-pointer relative group",children:[e.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer z-10",onChange:U,accept:".pdf,.txt",disabled:u}),m?e.jsxs("div",{className:"flex flex-col items-center gap-3 w-full animate-in fade-in zoom-in duration-300",children:[e.jsx("div",{className:"h-12 w-12 bg-blue-500/10 rounded-full flex items-center justify-center text-blue-600",children:e.jsx(Q,{className:"h-6 w-6"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-sm text-slate-900 dark:text-slate-100 break-all",children:m.name}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[(m.size/1024/1024).toFixed(2)," MB • Listo para procesar"]})]}),e.jsx(c,{size:"sm",variant:"outline",className:"h-7 text-xs mt-1",onClick:a=>{a.preventDefault(),p(null)},children:"Cambiar archivo"})]}):e.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 group-hover:text-blue-500 transition-colors",children:[e.jsx("div",{className:"bg-slate-100 dark:bg-slate-800 p-4 rounded-full mb-1 group-hover:bg-blue-500/10 group-hover:scale-110 transition-all",children:e.jsx(K,{className:"h-8 w-8"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-lg text-slate-700 dark:text-slate-200 group-hover:text-blue-600 transition-colors",children:"Arrastra tu archivo aquí"}),e.jsx("p",{className:"text-sm font-medium text-slate-400 mt-1",children:"o haz click para explorar"})]})]})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-900/20 rounded-xl p-4 flex gap-3",children:[e.jsx(L,{className:"h-5 w-5 text-blue-600 dark:text-blue-400 shrink-0"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-bold mb-1",children:"Información Importante"}),e.jsx("p",{className:"opacity-90 text-xs leading-relaxed",children:"Máximo 10MB por archivo. El procesamiento puede tomar unos segundos dependiendo del tamaño."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-4 border-t border-slate-100 dark:border-slate-800 mt-6",children:[e.jsx(c,{variant:"ghost",className:"flex-1 rounded-xl h-11 font-medium text-slate-500 hover:text-slate-700",onClick:()=>x(!1),children:"Cancelar"}),e.jsx(c,{onClick:v,disabled:u||!m,className:"flex-[2] rounded-xl h-11 font-bold text-base shadow-lg shadow-blue-500/20",children:u?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-2 h-5 w-5 animate-spin"})," Procesando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"mr-2 h-5 w-5"})," Subir Dataset"]})})]})]})})})]})]})}),e.jsxs(ne,{children:[e.jsxs("div",{className:"bg-white dark:bg-slate-900 p-4 rounded-2xl border border-slate-200 dark:border-slate-800 shadow-sm mb-6 flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsx("div",{className:"flex items-center gap-4 w-full md:w-auto flex-1",children:e.jsxs("div",{className:"relative w-full md:w-96",children:[e.jsx(_,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(R,{placeholder:"Buscar documentos...",className:"pl-10 h-10 bg-slate-50 dark:bg-slate-950 border-slate-200 dark:border-slate-800 rounded-xl w-full focus-visible:ring-primary/20",value:j,onChange:a=>I(a.target.value)})]})}),e.jsx("div",{className:"flex items-center gap-3 w-full md:w-auto",children:e.jsxs(g,{variant:"outline",className:"px-3 py-1.5 h-10 rounded-xl border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-950 text-slate-500 gap-2 font-medium",children:[e.jsx(ae,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Total: ",T.length]})]})})]}),e.jsx("div",{className:"rounded-3xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm overflow-hidden",children:e.jsxs(oe,{children:[e.jsx(de,{className:"bg-slate-50/50 dark:bg-slate-950/50",children:e.jsxs(A,{className:"hover:bg-transparent border-slate-100 dark:border-slate-800",children:[e.jsx(z,{className:"w-[40%] font-bold text-xs uppercase tracking-wider text-slate-500 pl-6 h-12",children:"Nombre del Archivo"}),e.jsx(z,{className:"w-[20%] font-bold text-xs uppercase tracking-wider text-slate-500 h-12",children:"Chunks"}),e.jsx(z,{className:"w-[20%] font-bold text-xs uppercase tracking-wider text-slate-500 h-12",children:"Fecha de Subida"}),e.jsx(z,{className:"text-right font-bold text-xs uppercase tracking-wider text-slate-500 pr-6 h-12",children:"Acciones"})]})}),e.jsx(ie,{children:D?e.jsx(A,{children:e.jsx(k,{colSpan:4,className:"h-32 text-center",children:e.jsxs("div",{className:"flex justify-center items-center gap-2 text-muted-foreground",children:[e.jsx(V,{className:"h-5 w-5 animate-spin text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:"Cargando datasets..."})]})})}):d.length===0?e.jsx(A,{children:e.jsx(k,{colSpan:4,className:"h-64 text-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 text-muted-foreground",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center mb-2",children:e.jsx(L,{className:"h-6 w-6 text-slate-400"})}),e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:"No se encontraron documentos"}),e.jsx("p",{className:"text-sm max-w-xs",children:j?"Prueba con otros términos":"Sube tu primer documento para comenzar."})]})})}):d.map(a=>e.jsxs(A,{className:"group hover:bg-slate-50/50 dark:hover:bg-slate-800/50 border-slate-100 dark:border-slate-800 transition-colors cursor-pointer",onClick:()=>S(a),children:[e.jsx(k,{className:"pl-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-blue-100 dark:bg-blue-500/10 p-2 rounded-lg shrink-0",children:e.jsx(Q,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-200 text-sm",children:a.filename})]})}),e.jsx(k,{className:"py-4",children:e.jsxs(g,{variant:"secondary",className:"font-mono text-xs bg-slate-100 dark:bg-slate-800",children:[a.chunkCount||0," chunks"]})}),e.jsx(k,{className:"py-4",children:e.jsx("span",{className:"text-sm text-slate-500 dark:text-slate-400 font-medium",children:we(new Date(a.uploadedAt),"d MMM yyyy",{locale:ye})})}),e.jsx(k,{className:"py-4 text-right pr-6",children:e.jsxs("div",{className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-all",children:[e.jsx(c,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/10 rounded-lg",onClick:s=>{s.stopPropagation(),S(a)},children:e.jsx(je,{className:"h-4 w-4"})}),e.jsx(c,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/10 rounded-lg",onClick:s=>{s.stopPropagation(),C(a.sourceId)},children:e.jsx(Ne,{className:"h-4 w-4"})})]})})]},a.sourceId))})]})})]})]})}export{Ke as default};
|
|
1
|
+
import{c as W,h as X,t as b,j as e,ad as Y,bE as J,B as c,ae as Z,af as ee,ag as se,r as g,n as M,I as R,C as L,o as V,V as Q,S as _,aA as ae,at as te}from"./index-43NA2pdZ.js";import{b as r}from"./recharts-DrC5kNsx.js";import{a as E}from"./agent.service-BE2rJG_o.js";import{P as re,a as le,b as ne}from"./page-components-DXOKtt_M.js";import{T as oe,a as de,b as A,c as z,d as ie,e as k}from"./table-7NGq0kRw.js";import{T as ce,a as xe,b as G,c as H}from"./tabs-BGCKrmVw.js";import{S as me}from"./switch-C7XmAU1c.js";import{S as ue}from"./slider-D0QB_Lme.js";import{u as he}from"./useDebounce-Bfcb_jpD.js";import{u as pe}from"./useInfiniteQuery-D0sFT2K2.js";import{u as fe}from"./index-CCTahcpv.js";import{D as be}from"./database-Brb7Omak.js";import{S as ge}from"./save-mwkHDnDL.js";import{U as K}from"./upload-CQg4_W5r.js";import{P as je}from"./pencil-aqjc7AWb.js";import{T as Ne}from"./trash-2-D_kmHMwn.js";import{M as ve,r as ke}from"./index-DIxON2Dm.js";import{f as we}from"./format-BG1mN6C0.js";import{e as ye}from"./es-BDgg6unH.js";import"./index-KbFmSzBE.js";const Se=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],$=W("file-up",Se);function Ce({sourceId:n,organizationId:D}){const[w,T]=r.useState(""),i=he(w,600),[j,I]=r.useState(!0),[O,x]=r.useState(new Set),u=r.useRef(null),h=.65,[m,p]=r.useState(h),[o,f]=r.useState(h),y=i.trim().length>=2,P=s=>{x(l=>{const t=new Set(l);return t.has(s)?t.delete(s):t.add(s),t})},{data:F,isLoading:N,isError:U,error:B,fetchNextPage:S,hasNextPage:v,isFetchingNextPage:C}=pe({queryKey:["dataset-chunks-v2",n,D,i,y?o:null],queryFn:async({pageParam:s})=>{if(i&&i.length<2)return{chunks:[],nextPageOffset:null};const l=await E.getDatasetChunks(n,D,i,10,s,o);return Array.isArray(l)?{chunks:l,nextPageOffset:null}:{chunks:l?.chunks??[],nextPageOffset:l?.nextPageOffset??null}},getNextPageParam:s=>s?.nextPageOffset??void 0,initialPageParam:void 0,enabled:i.length===0||i.length>=2,staleTime:1e3*60*5,refetchOnWindowFocus:!1}),d=F?.pages.flatMap(s=>s.chunks)||[],a=fe({count:v?d.length+1:d.length,getScrollElement:()=>u.current,estimateSize:()=>180,overscan:5});return r.useEffect(()=>{const[s]=[...a.getVirtualItems()].reverse();s&&s.index>=d.length-1&&v&&!C&&S()},[v,S,d.length,C,a.getVirtualItems()]),U?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-red-500 p-6 text-center",children:[e.jsx(L,{className:"h-8 w-8 mb-2"}),e.jsx("p",{className:"font-bold",children:"Error al cargar datos"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:B?.message||"Error desconocido"})]}):(console.log(`[ChunksViewer] Render state - Loading: ${N}, Chunks: ${d.length}`),e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between shrink-0",children:[e.jsxs("div",{className:"relative flex-1 w-full",children:[e.jsx(_,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(R,{placeholder:"Buscar semánticamente en este documento...",className:"pl-9 bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-800",value:w,onChange:s=>T(s.target.value)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{checked:j,onCheckedChange:I,id:"markdown-mode"}),e.jsx(M,{htmlFor:"markdown-mode",className:"text-xs cursor-pointer select-none",children:"Markdown"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0 px-1 -mt-1",title:"Umbral de similitud para la búsqueda vectorial. El default (65%) es el mismo que usan los agentes; bájalo para ver coincidencias más débiles.",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Relevancia mínima"}),e.jsx(ue,{value:[m],onValueChange:s=>p(s[0]),onValueCommit:s=>f(s[0]),min:0,max:.9,step:.05,className:"max-w-[220px]"}),e.jsxs(g,{variant:"secondary",className:"text-[10px] font-bold tabular-nums",children:[Math.round(m*100),"%"]}),o!==h&&e.jsx(c,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] text-muted-foreground",onClick:()=>{p(h),f(h)},children:"Reset (65%)"}),!y&&e.jsx("span",{className:"text-[10px] text-muted-foreground/70 italic",children:"Escribe una búsqueda para aplicarlo"})]}),e.jsx("div",{className:"flex-1 min-h-0 bg-slate-50 dark:bg-slate-900/20 border border-slate-200 dark:border-slate-800 rounded-xl overflow-hidden relative",children:N?e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[e.jsx(V,{className:"h-6 w-6 animate-spin mb-2"}),e.jsx("span",{className:"text-xs",children:"Buscando segmentos..."})]}):d.length?e.jsx("div",{ref:u,className:"absolute inset-0 overflow-y-auto p-4 custom-scrollbar",children:e.jsx("div",{style:{height:`${a.getTotalSize()}px`,width:"100%",position:"relative"},children:a.getVirtualItems().map(s=>{const l=s.index>d.length-1,t=d[s.index],q=t?O.has(t.id):!1;return e.jsx("div",{"data-index":s.index,ref:a.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${s.start}px)`,paddingBottom:"16px"},children:l?e.jsx("div",{className:"flex justify-center py-2 text-xs text-muted-foreground",children:C?"Cargando más...":""}):e.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-lg p-4 text-xs leading-relaxed text-slate-600 dark:text-slate-300 relative group hover:border-blue-200 dark:hover:border-blue-800 transition-colors shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b border-slate-50 dark:border-slate-800/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g,{variant:"outline",className:"text-[10px] h-5 border-slate-200 text-slate-400 font-mono",children:["CHUNK #",s.index+1]}),t.score!==void 0&&e.jsxs(g,{variant:"secondary",className:"text-[10px] h-5 bg-green-50 text-green-700 dark:bg-green-900/20 dark:text-green-400 border-green-100 dark:border-green-900/30 font-bold",children:[(t.score*100).toFixed(1),"% RELEVANCIA"]})]}),e.jsx("span",{onClick:()=>{navigator.clipboard.writeText(t.id),b.success("ID copiado al portapapeles")},className:"text-[10px] text-slate-300 font-mono truncate max-w-[100px] opacity-100 sm:opacity-0 group-hover:opacity-100 transition-opacity select-none cursor-pointer hover:text-blue-500 hover:underline active:text-blue-700",title:"Clic para copiar ID",children:t.id})]}),e.jsx("div",{className:`prose prose-xs dark:prose-invert max-w-none break-words ${q?"":"line-clamp-5"}`,children:j?e.jsx(ve,{remarkPlugins:[ke],children:t.content||"*Sin contenido*"}):e.jsx("span",{className:"whitespace-pre-wrap font-sans",children:t.content||(t.content===""?"*Contenido vacío*":"*Contenido no disponible*")})}),(t.content?.length>400||t.content?.split(`
|
|
2
|
+
`).length>6)&&e.jsx("div",{className:"mt-4 pt-2 border-t border-slate-50 dark:border-slate-800/50 flex justify-center",children:e.jsx(c,{variant:"ghost",size:"sm",onClick:()=>P(t.id),className:"h-7 px-4 text-[10px] font-medium text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900/20 rounded-full transition-all flex items-center gap-1.5",children:q?e.jsx(e.Fragment,{children:"Ver menos"}):e.jsx(e.Fragment,{children:"Ver más contenido"})})})]})},s.key)})})}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[e.jsx(te,{className:"h-8 w-8 text-slate-200 mb-2"}),e.jsx("span",{className:"text-sm",children:"No se encontraron resultados"})]})}),e.jsxs("div",{className:"text-[10px] text-center text-slate-400 shrink-0",children:["Mostrando ",d.length," resultados"]})]}))}function $e(){const{currentOrganization:n}=X(),[D,w]=r.useState(!0),[T,i]=r.useState([]),[j,I]=r.useState(""),[O,x]=r.useState(!1),[u,h]=r.useState(!1),[m,p]=r.useState(null),[o,f]=r.useState(null),[y,P]=r.useState(""),F=r.useRef(null);r.useEffect(()=>{if(n?.id){if(F.current===n.id)return;F.current=n.id,i([]),I(""),f(null),x(!1),N()}},[n?.id]);const N=async()=>{if(n){w(!0);try{const s=(await E.listKnowledgeCollections(n.id)).map(l=>({sourceId:l.sourceId,filename:l.filename,uploadedAt:l.createdAt||l.uploadedAt,chunkCount:l.chunkCount,type:"document"}));s.sort((l,t)=>new Date(t.uploadedAt).getTime()-new Date(l.uploadedAt).getTime()),i(s)}catch(a){console.error("Error fetching datasets:",a),b.error("Error cargando datasets")}finally{w(!1)}}},U=a=>{const s=a.target.files?.[0];s&&p(s)},B=()=>{f(null),p(null),x(!0)},S=a=>{f(a),P(a.filename),x(!0)},v=async()=>{if(n){h(!0);try{if(o)await E.updateSource(o.sourceId,{filename:y,organizationId:n.id}),b.success("Documento actualizado correctamente");else{if(!m)return;await E.uploadKnowledge(m,n.id),b.success("Archivo subido e indexado correctamente")}p(null),f(null),x(!1),N()}catch(a){console.error(a),b.error(o?"Error actualizando documento":"Error al subir el archivo")}finally{h(!1)}}},C=async a=>{if(n&&confirm("¿Estás seguro de eliminar este documento? Esta acción no se puede deshacer."))try{await E.deleteSource(a,n.id),b.success("Documento eliminado"),N()}catch(s){console.error("Error deleting dataset:",s),b.error("Error eliminando documento")}},d=T.filter(a=>a.filename.toLowerCase().includes(j.toLowerCase()));return e.jsxs(re,{children:[e.jsx(le,{title:"Documentos",description:"Gestiona los documentos (PDF/TXT) que tus agentes utilizan como fuente de conocimiento.",icon:be,actions:e.jsxs(Y,{open:O,onOpenChange:x,children:[e.jsx(J,{asChild:!0,children:e.jsxs(c,{className:"bg-primary hover:bg-primary/90 text-white shadow-lg shadow-primary/20 rounded-full font-bold px-6",onClick:B,children:[e.jsx($,{className:"h-4 w-4 mr-2"})," Subir Documento"]})}),e.jsxs(Z,{className:"w-full sm:max-w-2xl p-0 flex flex-col",side:"right",children:[e.jsx("div",{className:"p-6 pb-4 bg-muted/20 border-b border-border/40",children:e.jsx(ee,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-xl bg-blue-500/10 flex items-center justify-center shrink-0 border border-blue-500/20 shadow-sm",children:e.jsx($,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap pt-0.5",children:[e.jsx(se,{className:"text-xl font-bold tracking-tight",children:o?"Editar Documento":"Subir Nuevo Documento"}),e.jsx(g,{variant:"secondary",className:"uppercase text-[9px] font-bold tracking-widest px-2 bg-blue-500/10 text-blue-600 border-blue-500/20",children:o?"METADATA":"KNOWLEDGE BASE"})]}),e.jsx("div",{className:"text-xs text-muted-foreground/80 font-medium mt-1",children:o?"Modifica los detalles del documento.":"Carga archivos PDF o TXT para enriquecer el conocimiento."})]})]})})}),e.jsx("div",{className:"flex-1 p-6 space-y-6 bg-slate-50/50 dark:bg-slate-900/20 flex flex-col min-h-0",children:e.jsx("div",{className:"space-y-6 h-full flex flex-col min-h-0",children:o?e.jsxs(ce,{defaultValue:"config",className:"w-full h-full flex flex-col",children:[e.jsxs(xe,{className:"grid w-full grid-cols-2 mb-6 shrink-0",children:[e.jsx(G,{value:"config",children:"Configuración"}),e.jsx(G,{value:"chunks",children:"Vista Previa"})]}),e.jsxs(H,{value:"config",className:"space-y-6 flex-1 overflow-y-auto",children:[e.jsx("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-xl p-5 shadow-sm space-y-3",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"filename",className:"font-bold text-[10px] uppercase tracking-widest text-slate-500",children:"Nombre del Archivo"}),e.jsx(R,{id:"filename",value:y,onChange:a=>P(a.target.value),className:"font-medium"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"font-bold text-[10px] uppercase tracking-widest text-slate-500",children:"Source ID (Solo Lectura)"}),e.jsx("div",{className:"text-xs font-mono bg-slate-100 dark:bg-slate-800 p-2 rounded text-slate-500 break-all select-all",children:o.sourceId})]})]})}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-900/20 rounded-xl p-4 flex gap-3",children:[e.jsx(L,{className:"h-5 w-5 text-blue-600 dark:text-blue-400 shrink-0"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-bold mb-1",children:"Información Importante"}),e.jsx("p",{className:"opacity-90 text-xs leading-relaxed",children:"El cambio de nombre se reflejará inmediatamente."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-4 border-t border-slate-100 dark:border-slate-800 mt-6",children:[e.jsx(c,{variant:"ghost",className:"flex-1 rounded-xl h-11 font-medium text-slate-500 hover:text-slate-700",onClick:()=>x(!1),children:"Cancelar"}),e.jsx(c,{onClick:v,disabled:u,className:"flex-[2] rounded-xl h-11 font-bold text-base shadow-lg shadow-blue-500/20",children:u?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-2 h-5 w-5 animate-spin"})," Guardando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"mr-2 h-5 w-5"})," Guardar Cambios"]})})]})]}),e.jsx(H,{value:"chunks",className:"space-y-4 flex-1 min-h-0 h-full",children:e.jsx(Ce,{sourceId:o.sourceId,organizationId:n?.id||""})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-xl p-5 shadow-sm space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(M,{className:"font-bold text-[10px] uppercase tracking-widest text-slate-500",children:"Documento Fuente"}),e.jsx(g,{variant:"outline",className:"text-[10px] font-mono text-slate-400 h-5 px-1.5 border-slate-200",children:"REQUIRED"})]}),e.jsxs("div",{className:"border-2 border-dashed border-slate-200 dark:border-slate-800 rounded-xl p-8 flex flex-col items-center justify-center hover:bg-slate-50 dark:hover:bg-slate-950 transition-colors cursor-pointer relative group",children:[e.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer z-10",onChange:U,accept:".pdf,.txt",disabled:u}),m?e.jsxs("div",{className:"flex flex-col items-center gap-3 w-full animate-in fade-in zoom-in duration-300",children:[e.jsx("div",{className:"h-12 w-12 bg-blue-500/10 rounded-full flex items-center justify-center text-blue-600",children:e.jsx(Q,{className:"h-6 w-6"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-sm text-slate-900 dark:text-slate-100 break-all",children:m.name}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[(m.size/1024/1024).toFixed(2)," MB • Listo para procesar"]})]}),e.jsx(c,{size:"sm",variant:"outline",className:"h-7 text-xs mt-1",onClick:a=>{a.preventDefault(),p(null)},children:"Cambiar archivo"})]}):e.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 group-hover:text-blue-500 transition-colors",children:[e.jsx("div",{className:"bg-slate-100 dark:bg-slate-800 p-4 rounded-full mb-1 group-hover:bg-blue-500/10 group-hover:scale-110 transition-all",children:e.jsx(K,{className:"h-8 w-8"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-bold text-lg text-slate-700 dark:text-slate-200 group-hover:text-blue-600 transition-colors",children:"Arrastra tu archivo aquí"}),e.jsx("p",{className:"text-sm font-medium text-slate-400 mt-1",children:"o haz click para explorar"})]})]})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-900/20 rounded-xl p-4 flex gap-3",children:[e.jsx(L,{className:"h-5 w-5 text-blue-600 dark:text-blue-400 shrink-0"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-bold mb-1",children:"Información Importante"}),e.jsx("p",{className:"opacity-90 text-xs leading-relaxed",children:"Máximo 10MB por archivo. El procesamiento puede tomar unos segundos dependiendo del tamaño."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-4 border-t border-slate-100 dark:border-slate-800 mt-6",children:[e.jsx(c,{variant:"ghost",className:"flex-1 rounded-xl h-11 font-medium text-slate-500 hover:text-slate-700",onClick:()=>x(!1),children:"Cancelar"}),e.jsx(c,{onClick:v,disabled:u||!m,className:"flex-[2] rounded-xl h-11 font-bold text-base shadow-lg shadow-blue-500/20",children:u?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-2 h-5 w-5 animate-spin"})," Procesando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"mr-2 h-5 w-5"})," Subir Dataset"]})})]})]})})})]})]})}),e.jsxs(ne,{children:[e.jsxs("div",{className:"bg-white dark:bg-slate-900 p-4 rounded-2xl border border-slate-200 dark:border-slate-800 shadow-sm mb-6 flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsx("div",{className:"flex items-center gap-4 w-full md:w-auto flex-1",children:e.jsxs("div",{className:"relative w-full md:w-96",children:[e.jsx(_,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(R,{placeholder:"Buscar documentos...",className:"pl-10 h-10 bg-slate-50 dark:bg-slate-950 border-slate-200 dark:border-slate-800 rounded-xl w-full focus-visible:ring-primary/20",value:j,onChange:a=>I(a.target.value)})]})}),e.jsx("div",{className:"flex items-center gap-3 w-full md:w-auto",children:e.jsxs(g,{variant:"outline",className:"px-3 py-1.5 h-10 rounded-xl border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-950 text-slate-500 gap-2 font-medium",children:[e.jsx(ae,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Total: ",T.length]})]})})]}),e.jsx("div",{className:"rounded-3xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm overflow-hidden",children:e.jsxs(oe,{children:[e.jsx(de,{className:"bg-slate-50/50 dark:bg-slate-950/50",children:e.jsxs(A,{className:"hover:bg-transparent border-slate-100 dark:border-slate-800",children:[e.jsx(z,{className:"w-[40%] font-bold text-xs uppercase tracking-wider text-slate-500 pl-6 h-12",children:"Nombre del Archivo"}),e.jsx(z,{className:"w-[20%] font-bold text-xs uppercase tracking-wider text-slate-500 h-12",children:"Chunks"}),e.jsx(z,{className:"w-[20%] font-bold text-xs uppercase tracking-wider text-slate-500 h-12",children:"Fecha de Subida"}),e.jsx(z,{className:"text-right font-bold text-xs uppercase tracking-wider text-slate-500 pr-6 h-12",children:"Acciones"})]})}),e.jsx(ie,{children:D?e.jsx(A,{children:e.jsx(k,{colSpan:4,className:"h-32 text-center",children:e.jsxs("div",{className:"flex justify-center items-center gap-2 text-muted-foreground",children:[e.jsx(V,{className:"h-5 w-5 animate-spin text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:"Cargando datasets..."})]})})}):d.length===0?e.jsx(A,{children:e.jsx(k,{colSpan:4,className:"h-64 text-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 text-muted-foreground",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center mb-2",children:e.jsx(L,{className:"h-6 w-6 text-slate-400"})}),e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:"No se encontraron documentos"}),e.jsx("p",{className:"text-sm max-w-xs",children:j?"Prueba con otros términos":"Sube tu primer documento para comenzar."})]})})}):d.map(a=>e.jsxs(A,{className:"group hover:bg-slate-50/50 dark:hover:bg-slate-800/50 border-slate-100 dark:border-slate-800 transition-colors cursor-pointer",onClick:()=>S(a),children:[e.jsx(k,{className:"pl-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-blue-100 dark:bg-blue-500/10 p-2 rounded-lg shrink-0",children:e.jsx(Q,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-200 text-sm",children:a.filename})]})}),e.jsx(k,{className:"py-4",children:e.jsxs(g,{variant:"secondary",className:"font-mono text-xs bg-slate-100 dark:bg-slate-800",children:[a.chunkCount||0," chunks"]})}),e.jsx(k,{className:"py-4",children:e.jsx("span",{className:"text-sm text-slate-500 dark:text-slate-400 font-medium",children:we(new Date(a.uploadedAt),"d MMM yyyy",{locale:ye})})}),e.jsx(k,{className:"py-4 text-right pr-6",children:e.jsxs("div",{className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-all",children:[e.jsx(c,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/10 rounded-lg",onClick:s=>{s.stopPropagation(),S(a)},children:e.jsx(je,{className:"h-4 w-4"})}),e.jsx(c,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/10 rounded-lg",onClick:s=>{s.stopPropagation(),C(a.sourceId)},children:e.jsx(Ne,{className:"h-4 w-4"})})]})})]},a.sourceId))})]})})]})]})}export{$e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,B as h,l as m,a1 as Y,a2 as Z,a3 as q,a4 as _,a5 as J,o as H,w as U,r as c,F as S,aa as W,b as X,t as k,u as ee,h as se,Z as ae,T as z,s as M,ar as te,v as E,R as re,S as le,I as ie,aA as oe,a0 as ne,a7 as ce}from"./index-43NA2pdZ.js";import{b as o}from"./recharts-DrC5kNsx.js";import{a as K}from"./agent.service-BE2rJG_o.js";import{u as de}from"./useAiAgentsQuery-CXo6TmU6.js";import{P as xe,a as me,b as he}from"./page-components-DXOKtt_M.js";import{S as pe,a as ue,b as ge,c as be,d as R}from"./select-DCY_lg9j.js";import{L as je}from"./layout-grid-DN-t2Wjd.js";import{L as ve}from"./list-B0uLKf1b.js";import{T as fe,a as Ne,b as $,c as N,d as we,e as w}from"./table-7NGq0kRw.js";import{A as B,b as F}from"./alert-seLKo73M.js";import{C as ke}from"./checkbox-CuJh5AMO.js";import{T as I}from"./trash-2-D_kmHMwn.js";import{A as G}from"./archive-CxUKRJwu.js";import{D as ye}from"./database-Brb7Omak.js";import{u as Ce,h as Ae}from"./creditErrors-DSbswjsG.js";import{P as Q}from"./power-CVFzhVJx.js";import{B as Se}from"./brain-BmrjUpsb.js";import"./index-KbFmSzBE.js";const Te=({mode:l,onChange:p})=>e.jsxs("div",{className:"flex items-center gap-1 bg-slate-100 dark:bg-slate-800 p-1 rounded-xl border border-slate-200 dark:border-slate-700",children:[e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>p("cards"),className:m("h-8 px-3 rounded-lg flex items-center gap-2 transition-all",l==="cards"?"bg-white dark:bg-slate-900 shadow-sm text-primary":"text-slate-500 hover:text-slate-900 dark:hover:text-white"),children:[e.jsx(je,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",children:"Fichas"})]}),e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>p("table"),className:m("h-8 px-3 rounded-lg flex items-center gap-2 transition-all",l==="table"?"bg-white dark:bg-slate-900 shadow-sm text-primary":"text-slate-500 hover:text-slate-900 dark:hover:text-white"),children:[e.jsx(ve,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",children:"Tabla"})]})]});function Le({agentId:l,agentName:p,open:u,onOpenChange:v,onDeleted:y}){const[t,T]=o.useState(null),[n,L]=o.useState(!1),[d,C]=o.useState(null),[g,f]=o.useState(!1),[i,A]=o.useState(!1);o.useEffect(()=>{if(!u||!l){T(null),C(null);return}(async()=>{L(!0),C(null),A(!1);try{const{data:x}=await X.get(`/ai-agents/delete-preview/${l}`);T(x)}catch(x){C(x.response?.data?.message||"No se pudo obtener la vista previa de eliminación.")}finally{L(!1)}})()},[u,l]);const r=t&&t.totalSessions===0,P=async()=>{if(l){f(!0);try{await K.deleteAgent(l,!!(r&&i)),k.success(r?i?"Agente y su dataset eliminados — 1 crédito liberado":"Agente eliminado permanentemente — 1 crédito liberado":"Agente archivado — 1 crédito de Agentes IA liberado"),y()}catch(b){const x=b.response?.data?.message||b.message||"No se pudo eliminar el agente. Es posible que tenga sesiones o tickets asociados.";k.error(x)}finally{f(!1)}}};return e.jsx(Y,{open:u,onOpenChange:v,children:e.jsxs(Z,{className:"sm:max-w-[480px]",children:[e.jsxs(q,{children:[e.jsxs(_,{className:"flex items-center gap-2",children:[r?e.jsx(I,{className:"h-5 w-5 text-rose-500"}):e.jsx(G,{className:"h-5 w-5 text-amber-500"}),r?"Eliminar Agente IA":"Archivar Agente IA"]}),e.jsx(J,{children:p?e.jsxs(e.Fragment,{children:["Estás a punto de ",r?"eliminar permanentemente":"archivar"," el agente"," ",e.jsxs("span",{className:"font-semibold text-slate-700 dark:text-slate-200",children:['"',p,'"']})]}):`Estás a punto de ${r?"eliminar permanentemente":"archivar"} este agente`})]}),e.jsxs("div",{className:"py-3 space-y-4",children:[n&&e.jsxs("div",{className:"flex items-center justify-center py-6",children:[e.jsx(H,{className:"h-6 w-6 animate-spin text-slate-400"}),e.jsx("span",{className:"ml-2 text-sm text-slate-500",children:"Analizando agente..."})]}),d&&e.jsxs(B,{variant:"destructive",children:[e.jsx(U,{className:"h-4 w-4"}),e.jsx(F,{children:d})]}),t&&!n&&(r?e.jsxs(B,{className:"border-rose-200 bg-rose-50 dark:border-rose-800 dark:bg-rose-950",children:[e.jsx(I,{className:"h-4 w-4 text-rose-600"}),e.jsxs(F,{className:"space-y-2 text-rose-800 dark:text-rose-200",children:[e.jsx("p",{className:"font-medium",children:"El agente será eliminado permanentemente y se liberará 1 crédito de Agentes IA. No hay sesiones ni historial asociado."}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[e.jsxs(c,{variant:"outline",className:"text-xs bg-rose-100 text-rose-700 border-rose-300",children:[e.jsx(S,{className:"w-3 h-3 mr-1"}),t.status==="active"?"Activo":"Inactivo"]}),e.jsx(c,{variant:"outline",className:"text-xs bg-slate-50 text-slate-600 border-slate-200",children:"Sin sesiones — eliminación permanente"})]})]})]}):e.jsxs(B,{className:"border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950",children:[e.jsx(G,{className:"h-4 w-4 text-amber-600"}),e.jsxs(F,{className:"space-y-2 text-amber-800 dark:text-amber-200",children:[e.jsx("p",{className:"font-medium",children:"El agente será archivado y se liberará 1 crédito de Agentes IA. El historial de sesiones y conversaciones se conservará."}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[e.jsxs(c,{variant:"outline",className:"text-xs bg-amber-100 text-amber-700 border-amber-300",children:[e.jsx(S,{className:"w-3 h-3 mr-1"}),t.status==="active"?"Activo":"Inactivo"]}),e.jsxs(c,{variant:"outline",className:"text-xs bg-amber-100 text-amber-700 border-amber-300",children:[t.totalSessions," sesiones (",t.activeSessions," activas)"]})]})]})]})),t&&!n&&r&&t.hasKnowledgeBox&&e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-slate-200 dark:border-slate-700 p-3 cursor-pointer",children:[e.jsx(ke,{checked:i,onCheckedChange:b=>A(b===!0),className:"mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[e.jsx(ye,{className:"h-3.5 w-3.5 text-slate-500"}),"También eliminar su dataset (",t.knowledgeSourceCount??0," ",(t.knowledgeSourceCount??0)===1?"fuente":"fuentes",")"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Si lo dejas sin marcar, el dataset se conserva y pasa a ser un dataset compartido (visible en Datasets). Los Q&A y documentos no se borran."})]})]})]}),e.jsxs(W,{children:[e.jsx(h,{variant:"outline",onClick:()=>v(!1),disabled:g,children:"Cancelar"}),e.jsx(h,{onClick:P,disabled:n||g||!!d||!t,className:r?"bg-rose-500 hover:bg-rose-600 text-white":"bg-amber-500 hover:bg-amber-600 text-white",children:g?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"mr-2 h-4 w-4 animate-spin"}),r?"Eliminando...":"Archivando..."]}):e.jsxs(e.Fragment,{children:[r?e.jsx(I,{className:"mr-2 h-4 w-4"}):e.jsx(G,{className:"mr-2 h-4 w-4"}),r?"Eliminar permanentemente":"Archivar y liberar crédito"]})})]})]})})}function qe(){const l=ee(),{currentOrganization:p}=se(),{data:u=[],isLoading:v,refetch:y}=de(p?.id),[t,T]=o.useState("cards"),[n,L]=o.useState(""),[d,C]=o.useState("ALL"),[g,f]=o.useState(null),{pool:i,limitReached:A,refetch:r}=Ce({resourceType:"AI_AGENTS",enabled:!0}),P=u.find(s=>s.id===g),b=(s,a)=>{a&&a.stopPropagation(),f(s)},x=async(s,a)=>{a.stopPropagation();const j=s.status==="active"?"inactive":"active";try{await K.updateAgent(s.id,{status:j}),y(),k.success(`Agente ${j==="active"?"activado":"desactivado"}`)}catch(O){Ae(O,{title:"Limite de Agentes IA Alcanzado"})||k.error("Error al cambiar el estado")}},D=o.useMemo(()=>u.filter(s=>{const a=s.name.toLowerCase().includes(n.toLowerCase())||s.assistantRole?.toLowerCase().includes(n.toLowerCase()),j=d==="ALL"||s.status===d.toLowerCase();return a&&j}),[u,n,d]),V=(s,a=!1)=>{const j=s?.toLowerCase()||"draft";if(a)switch(j){case"active":return"bg-emerald-500";case"inactive":return"bg-slate-400";default:return"bg-slate-400"}switch(j){case"active":return"bg-emerald-50 text-emerald-700 border-emerald-200";case"inactive":return"bg-slate-100 text-slate-600 border-slate-200";default:return"bg-slate-100 text-slate-700"}};return e.jsx(ae,{children:e.jsxs(xe,{children:[e.jsxs("div",{className:"h-full overflow-y-auto no-scrollbar",children:[e.jsx(me,{title:"Mis Agentes IA",description:"Gestiona y entrena a tus asistentes virtuales inteligentes.",icon:S,actions:e.jsxs(z,{children:[e.jsx(M,{asChild:!0,children:e.jsx("span",{children:e.jsxs(h,{onClick:()=>{if(A){k.error("Limite de agentes IA alcanzado. Elimina un agente existente o actualiza tu plan.");return}l("/ai-agents/create")},className:m("bg-primary hover:bg-primary/90 text-white shadow-lg shadow-primary/20 rounded-full","opacity-60"),children:[e.jsx(te,{className:"mr-2 h-4 w-4"}),"Nuevo Agente"]})})}),e.jsx(E,{children:e.jsx("p",{children:"Nubot Lite trae un solo agente. Varios agentes: disponible en Nubot."})}),A&&i&&e.jsx(E,{children:e.jsxs("p",{children:["Límite alcanzado (",i.usedCredits??0,"/",i.totalCredits,"). Elimina un agente para crear otro."]})})]})}),e.jsxs(he,{children:[e.jsxs("div",{className:"bg-white dark:bg-slate-900 p-4 rounded-2xl border border-slate-100 dark:border-slate-800 shadow-sm mb-8 flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4 w-full md:w-auto",children:[e.jsx(Te,{mode:t,onChange:T}),e.jsx(h,{variant:"ghost",size:"icon",onClick:()=>{y(),r()},disabled:v,className:"rounded-xl hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-400 hover:text-primary",children:e.jsx(re,{className:m("h-4 w-4",v&&"animate-spin")})}),e.jsx("div",{className:"h-8 w-[1px] bg-slate-100 dark:bg-slate-800 hidden md:block"}),e.jsxs("div",{className:"relative flex-1 md:w-64",children:[e.jsx(le,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ie,{placeholder:"Buscar por nombre...",value:n,onChange:s=>L(s.target.value),className:"h-10 pl-10 bg-slate-50 dark:bg-slate-950 border-none rounded-xl text-sm focus-visible:ring-1 focus-visible:ring-primary/20"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 w-full md:w-auto",children:[e.jsxs(pe,{value:d,onValueChange:C,children:[e.jsx(ue,{className:"h-10 w-full md:w-40 bg-slate-50 dark:bg-slate-950 border-none rounded-xl text-sm",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"w-3.5 h-3.5 text-slate-400"}),e.jsx(ge,{placeholder:"Estado"})]})}),e.jsxs(be,{children:[e.jsx(R,{value:"ALL",children:"Todos"}),e.jsx(R,{value:"active",children:"Activos"}),e.jsx(R,{value:"inactive",children:"Inactivos"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-2",children:[e.jsxs("span",{className:"text-xs text-slate-400",children:[e.jsx("span",{className:"font-bold text-slate-700 dark:text-slate-200",children:D.length})," ","agentes"]}),i&&e.jsxs(c,{variant:"outline",className:m("text-xs font-bold px-3 py-1 rounded-xl",(i.usedCredits??0)>=i.totalCredits?"border-rose-200 bg-rose-50 text-rose-600 dark:border-rose-800 dark:bg-rose-900/20 dark:text-rose-400":"border-primary/20 bg-primary/5 text-primary"),children:["Límite: ",i.usedCredits??0," / ",i.totalCredits]})]})]})]}),v?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[e.jsx(H,{className:"w-8 h-8 animate-spin text-primary"}),e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"Cargando agentes..."})]}):D.length===0?e.jsxs("div",{className:"text-center py-20 border-2 border-dashed rounded-3xl border-slate-100 dark:border-slate-800",children:[e.jsx("div",{className:"bg-primary/10 w-16 h-16 rounded-3xl flex items-center justify-center mx-auto mb-4",children:e.jsx(S,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-lg font-bold",children:"No se encontraron agentes"}),e.jsx("p",{className:"text-slate-500 mb-6 text-sm",children:"Ajusta los filtros o crea tu primer asistente virtual."}),e.jsx(h,{onClick:()=>l("/ai-agents/create"),className:"rounded-full px-8",children:"Crear Agente"})]}):t==="cards"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:D.map(s=>e.jsxs("div",{className:"group relative bg-white dark:bg-slate-900 rounded-3xl border border-slate-100 dark:border-slate-800 shadow-sm hover:shadow-2xl hover:shadow-primary/10 hover:border-primary/30 transition-all duration-500 cursor-pointer overflow-hidden transform hover:-translate-y-2 hover:scale-[1.01]",onClick:()=>l(`/ai-agents/${s.id}`),children:[e.jsxs("div",{className:"p-7",children:[e.jsxs("div",{className:"flex justify-between items-start mb-6",children:[e.jsxs("div",{className:"space-y-1.5 overflow-hidden",children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 dark:text-white leading-tight group-hover:text-primary transition-colors truncate pr-2",children:s.name}),e.jsx("p",{className:"text-[10px] font-bold text-slate-400 flex items-center gap-1.5 uppercase tracking-widest truncate",children:s.assistantRole||"Asistente General"})]}),e.jsxs(z,{children:[e.jsx(M,{asChild:!0,children:e.jsxs(c,{variant:"secondary",className:m(V(s.status||"inactive"),"border font-bold px-3 py-1 rounded-lg text-[10px] shadow-sm uppercase shrink-0 cursor-pointer hover:opacity-80 transition-opacity flex items-center gap-1.5"),onClick:a=>x(s,a),children:[e.jsx(Q,{className:"w-3 h-3"}),s.status==="active"?"Activo":"Inactivo"]})}),e.jsx(E,{side:"left",children:e.jsxs("p",{children:["Click para ",s.status==="active"?"desactivar":"activar"]})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-[40px] mb-6",children:s.description||"Sin descripción disponible para este agente."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-6",children:[e.jsxs("div",{className:"bg-slate-50 dark:bg-slate-800/50 rounded-2xl p-3 text-center border border-transparent group-hover:bg-blue-50/50 dark:group-hover:bg-blue-900/10 group-hover:border-blue-100 transition-all",children:[e.jsx(Se,{className:"w-4 h-4 mx-auto mb-2 text-blue-500"}),e.jsx("p",{className:"text-xs font-bold text-slate-900 dark:text-white truncate",children:s.model}),e.jsx("p",{className:"text-[9px] uppercase font-black text-slate-400 mt-1 tracking-tighter",children:"Modelo"})]}),e.jsxs("div",{className:"bg-slate-50 dark:bg-slate-800/50 rounded-2xl p-3 text-center border border-transparent group-hover:bg-violet-50/50 dark:group-hover:bg-violet-900/10 group-hover:border-violet-100 transition-all",children:[e.jsx(ne,{className:"w-4 h-4 mx-auto mb-2 text-violet-500"}),e.jsx("p",{className:"text-xs font-bold text-slate-900 dark:text-white",children:s.tools?.length||0}),e.jsx("p",{className:"text-[9px] uppercase font-black text-slate-400 mt-1 tracking-tighter",children:"Tools"})]})]})]}),e.jsxs("div",{className:"px-7 py-4 bg-slate-50/50 dark:bg-slate-800/30 border-t border-slate-50 dark:border-slate-800 flex items-center justify-between group-hover:bg-white dark:group-hover:bg-slate-900 transition-colors duration-300",children:[e.jsx("div",{className:"flex flex-col gap-1",children:e.jsxs("span",{className:"text-[10px] font-bold text-slate-400 flex items-center gap-1.5 tracking-wider cursor-pointer hover:text-primary transition-colors",onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(s.id),k.success("ID copiado")},children:[e.jsx(S,{className:"w-3 h-3"}),"ID: ",s.id.substring(0,8),"..."]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-rose-50 hover:text-rose-600 rounded-full opacity-0 group-hover:opacity-100 transition-all duration-300",onClick:a=>b(s.id,a),children:e.jsx(I,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-[10px] font-black text-primary flex items-center gap-1 opacity-0 group-hover:opacity-100 transform translate-x-4 group-hover:translate-x-0 transition-all duration-500 uppercase tracking-widest pl-2 border-l border-slate-200 ml-2",children:["Editar",e.jsx(ce,{className:"w-4 h-4"})]})]})]})]},s.id))}):e.jsx("div",{className:"bg-white dark:bg-slate-900 rounded-3xl border border-slate-100 dark:border-slate-800 shadow-sm overflow-hidden",children:e.jsxs(fe,{children:[e.jsx(Ne,{children:e.jsxs($,{className:"bg-slate-50/50 dark:bg-slate-800/50 hover:bg-slate-50/50 border-slate-100 dark:border-slate-800",children:[e.jsx(N,{className:"py-5 font-bold uppercase text-[10px] tracking-widest pl-7 w-[30%]",children:"Agente"}),e.jsx(N,{className:"font-bold uppercase text-[10px] tracking-widest",children:"Rol"}),e.jsx(N,{className:"font-bold uppercase text-[10px] tracking-widest text-center",children:"Modelo"}),e.jsx(N,{className:"font-bold uppercase text-[10px] tracking-widest text-center",children:"Modo"}),e.jsx(N,{className:"font-bold uppercase text-[10px] tracking-widest text-center",children:"Tools"}),e.jsx(N,{className:"font-bold uppercase text-[10px] tracking-widest text-right pr-7",children:"Estado"})]})}),e.jsx(we,{children:D.map(s=>e.jsxs($,{className:"cursor-pointer hover:bg-slate-50/50 dark:hover:bg-slate-800/50 border-slate-50 dark:border-slate-800 transition-colors",onClick:()=>l(`/ai-agents/${s.id}`),children:[e.jsx(w,{className:"py-5 pl-7",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-bold text-slate-900 dark:text-white line-clamp-1",children:s.name}),e.jsxs("span",{className:"text-[10px] text-slate-400 font-medium font-mono",children:["#",s.id.substring(0,8)]})]})}),e.jsx(w,{className:"text-sm text-slate-600 dark:text-slate-400",children:s.assistantRole||"-"}),e.jsx(w,{className:"text-center",children:e.jsx(c,{variant:"outline",className:"font-mono text-[10px] bg-blue-50 text-blue-700 border-blue-100",children:s.model})}),e.jsx(w,{className:"text-center",children:e.jsx(c,{variant:"outline",className:m("text-[10px]",s.processingMode==="async"?"bg-orange-50 text-orange-700 border-orange-100":"bg-green-50 text-green-700 border-green-100"),children:s.processingMode==="async"?"ASYNC":"SYNC"})}),e.jsx(w,{className:"text-center font-bold text-slate-500",children:s.tools?.length||0}),e.jsx(w,{className:"text-right pr-7",children:e.jsxs(z,{children:[e.jsx(M,{asChild:!0,children:e.jsxs(c,{variant:"secondary",className:m(V(s.status||"inactive"),"border font-bold rounded-lg text-[10px] px-2.5 py-1 whitespace-nowrap uppercase cursor-pointer hover:opacity-80 transition-opacity flex items-center gap-1"),onClick:a=>x(s,a),children:[e.jsx(Q,{className:"w-3 h-3"}),s.status==="active"?"Activo":"Inactivo"]})}),e.jsx(E,{children:e.jsxs("p",{children:["Click para ",s.status==="active"?"desactivar":"activar"]})})]})})]},s.id))})]})})]})]}),e.jsx(Le,{agentId:g,agentName:P?.name??null,open:!!g,onOpenChange:s=>!s&&f(null),onDeleted:()=>{f(null),y(),r()}})]})})}export{qe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,ad as U,ae as B,af as F,ag as H,h as $,t as d,c7 as K,B as f,a9 as W,S as G,I as V,r as P,aA as _,o as k,C as J,V as X}from"./index-43NA2pdZ.js";import{b as r}from"./recharts-DrC5kNsx.js";import{a as b}from"./agent.service-BE2rJG_o.js";import{A as Y,a as Z,b as ee,c as se,d as ae,e as re,f as te,g as le}from"./alert-dialog-gzZZoAiu.js";import{T as ne,a as de,b as j,c as N,d as ie,e as i}from"./table-7NGq0kRw.js";import{P as oe,a as ce,b as me}from"./page-components-DXOKtt_M.js";import{Q as xe}from"./QaForm-Px-cmakA.js";import{M as ue}from"./mediaValidation-Bg0xHQrv.js";import{W as E}from"./wrench-Dcbk4scY.js";import{M as he}from"./message-square-B1_OirdW.js";import{P as ge}from"./pencil-aqjc7AWb.js";import{T as L}from"./trash-2-D_kmHMwn.js";import{f as pe}from"./format-BG1mN6C0.js";import{e as fe}from"./es-BDgg6unH.js";import"./storage.api-C0ZJBoSz.js";import"./mediaLimits-CAYdWqeQ.js";import"./textarea-B1anutjq.js";import"./code-C-UH-ZD-.js";import"./list-B0uLKf1b.js";import"./eye-CR5C6hVv.js";import"./music-CgtkroYi.js";import"./paperclip-DVRbzE7C.js";import"./upload-CQg4_W5r.js";import"./save-mwkHDnDL.js";function be({open:t,onOpenChange:o,item:c,onSaved:x,organizationId:m}){const n=!!c;return e.jsx(U,{open:t,onOpenChange:o,children:e.jsxs(B,{className:"w-full sm:max-w-lg p-0 flex flex-col",side:"right",children:[e.jsx("div",{className:"p-6 pb-4 bg-muted/20 border-b border-border/40",children:e.jsx(F,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-xl bg-primary/10 flex items-center justify-center shrink-0 border border-primary/20",children:e.jsx(ue,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(H,{className:"text-xl font-bold tracking-tight",children:n?"Editar Q&A":"Nuevo Q&A"}),e.jsx("p",{className:"text-xs text-muted-foreground/80 font-medium mt-1",children:"Define una pregunta y su respuesta directa."})]})]})})}),e.jsx("div",{className:"flex-1 p-6 overflow-y-auto bg-slate-50/50 dark:bg-slate-900/20",children:e.jsx(xe,{item:c,organizationId:m,onSaved:u=>{x(u),o(!1)},onCancel:()=>o(!1)})})]})})}function He(){const{currentOrganization:t}=$(),[o,c]=r.useState(!0),[x,m]=r.useState([]),[n,u]=r.useState(""),[D,h]=r.useState(!1),[R,v]=r.useState(null),[T,w]=r.useState(!1),[g,p]=r.useState(!1),[a,y]=r.useState(null),Q=r.useRef(null);r.useEffect(()=>{if(t?.id){if(Q.current===t.id)return;Q.current=t.id,m([]),u(""),v(null),h(!1),C()}},[t?.id]);const C=async()=>{if(t)try{c(!0);const s=await b.getQaList(t.id);m(s)}catch(s){console.error(s),d.error("Error cargando lista de Q&A")}finally{c(!1)}},q=()=>{v(null),h(!0)},A=s=>{v(s),h(!0)},z=async()=>{w(!0),y(null),p(!0);try{const s=await b.reconcileKnowledgeDryRun();y(s)}catch(s){d.error(s?.response?.data?.message||"No se pudo analizar el índice"),w(!1)}finally{p(!1)}},I=async()=>{p(!0);try{const s=await b.reconcileKnowledgeExecute();y(s),d.success(`Limpieza completada: ${s.deleted} puntos huérfanos eliminados`)}catch(s){d.error(s?.response?.data?.message||"Error al limpiar el índice")}finally{p(!1)}},M=async s=>{if(confirm("¿Estás seguro de eliminar este entrenamiento?"))try{await b.deleteQa(s),d.success("Entrenamiento eliminado"),m(l=>l.filter(O=>O.id!==s))}catch{d.error("No se pudo eliminar")}},S=x.filter(s=>s.question.toLowerCase().includes(n.toLowerCase())||s.answer.toLowerCase().includes(n.toLowerCase()));return e.jsxs(oe,{children:[e.jsx(ce,{title:"Entrenamiento Q&A",description:"Gestiona las preguntas y respuestas directas de tus agentes.",icon:K,actions:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(f,{variant:"outline",className:"rounded-full font-medium",onClick:z,title:"Analiza el índice de búsqueda y elimina puntos huérfanos",children:[e.jsx(E,{className:"h-4 w-4 mr-2"})," Limpiar índice"]}),e.jsxs(f,{className:"bg-primary hover:bg-primary/90 text-white shadow-lg shadow-primary/20 rounded-full font-bold px-6",onClick:q,children:[e.jsx(W,{className:"h-4 w-4 mr-2"})," Nuevo Q&A"]})]})}),e.jsxs(me,{children:[e.jsxs("div",{className:"bg-white dark:bg-slate-900 p-4 rounded-2xl border border-slate-200 dark:border-slate-800 shadow-sm mb-6 flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsx("div",{className:"flex items-center gap-4 w-full md:w-auto flex-1",children:e.jsxs("div",{className:"relative w-full md:w-96",children:[e.jsx(G,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(V,{placeholder:"Buscar en preguntas y respuestas...",className:"pl-10 h-10 bg-slate-50 dark:bg-slate-950 border-slate-200 dark:border-slate-800 rounded-xl w-full focus-visible:ring-primary/20",value:n,onChange:s=>u(s.target.value)})]})}),e.jsx("div",{className:"flex items-center gap-3 w-full md:w-auto",children:e.jsxs(P,{variant:"outline",className:"px-3 py-1.5 h-10 rounded-xl border-slate-200 dark:border-slate-800 bg-slate-50 dark:bg-slate-950 text-slate-500 gap-2 font-medium",children:[e.jsx(_,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Total: ",x.length]})]})})]}),e.jsx("div",{className:"rounded-3xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm overflow-hidden",children:e.jsxs(ne,{children:[e.jsx(de,{className:"bg-slate-50/50 dark:bg-slate-950/50",children:e.jsxs(j,{className:"hover:bg-transparent border-slate-100 dark:border-slate-800",children:[e.jsx(N,{className:"w-[40%] font-bold text-xs uppercase tracking-wider text-slate-500 pl-6 h-12",children:"Pregunta"}),e.jsx(N,{className:"w-[40%] font-bold text-xs uppercase tracking-wider text-slate-500 h-12",children:"Respuesta"}),e.jsx(N,{className:"font-bold text-xs uppercase tracking-wider text-slate-500 h-12",children:"Fecha"}),e.jsx(N,{className:"text-right font-bold text-xs uppercase tracking-wider text-slate-500 pr-6 h-12",children:"Acciones"})]})}),e.jsx(ie,{children:o?e.jsx(j,{children:e.jsx(i,{colSpan:4,className:"h-32 text-center",children:e.jsxs("div",{className:"flex justify-center items-center gap-2 text-muted-foreground",children:[e.jsx(k,{className:"h-5 w-5 animate-spin text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:"Cargando base de conocimiento..."})]})})}):S.length===0?e.jsx(j,{children:e.jsx(i,{colSpan:4,className:"h-64 text-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 text-muted-foreground",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center mb-2",children:e.jsx(J,{className:"h-6 w-6 text-slate-400"})}),e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:"No se encontraron resultados"}),e.jsx("p",{className:"text-sm max-w-xs",children:n?"Prueba con otros términos de búsqueda":"Comienza agregando preguntas frecuentes para entrenar a tu agente."})]})})}):S.map(s=>e.jsxs(j,{className:"group hover:bg-slate-50/50 dark:hover:bg-slate-800/50 border-slate-100 dark:border-slate-800 transition-colors cursor-pointer",onClick:()=>A(s),children:[e.jsx(i,{className:"pl-6 py-4 align-top",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 bg-violet-100 dark:bg-violet-500/10 p-1.5 rounded-lg shrink-0",children:e.jsx(he,{className:"h-4 w-4 text-violet-600 dark:text-violet-400"})}),e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-200 text-sm leading-relaxed mt-0.5",children:s.question})]})}),e.jsxs(i,{className:"py-4 align-top",children:[e.jsx("div",{className:"text-slate-500 dark:text-slate-400 text-sm leading-relaxed line-clamp-3 max-w-md",title:s.answer,children:s.answer}),(s.thumbnailUrl||s.signedUrl||s.mediaUrl)&&e.jsx("div",{className:"mt-2 flex items-center gap-2",children:s.thumbnailUrl||s.signedUrl?e.jsx("img",{src:s.thumbnailUrl||s.signedUrl,alt:"Media adjunta",className:"h-10 w-10 rounded-md object-cover border cursor-pointer hover:opacity-80 transition-opacity",onClick:l=>{l.stopPropagation(),s.signedUrl&&window.open(s.signedUrl,"_blank")}}):e.jsxs(P,{variant:"secondary",className:"text-[10px] bg-slate-100 dark:bg-slate-800 hover:bg-slate-200",children:[e.jsx(X,{className:"w-3 h-3 mr-1"}),"Adjunto"]})})]}),e.jsx(i,{className:"py-4 align-top",children:e.jsx("span",{className:"text-xs font-medium text-slate-400",children:pe(new Date(s.createdAt),"d MMM yyyy",{locale:fe})})}),e.jsx(i,{className:"py-4 align-top text-right pr-6",children:e.jsxs("div",{className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-all",children:[e.jsx(f,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-primary hover:bg-primary/10 rounded-lg",onClick:l=>{l.stopPropagation(),A(s)},children:e.jsx(ge,{className:"h-4 w-4"})}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/10 rounded-lg",onClick:l=>{l.stopPropagation(),M(s.id)},children:e.jsx(L,{className:"h-4 w-4"})})]})})]},s.id))})]})})]}),e.jsx(be,{open:D,onOpenChange:h,item:R,onSaved:()=>C(),organizationId:t?.id||""}),e.jsx(Y,{open:T,onOpenChange:w,children:e.jsxs(Z,{className:"max-w-lg",children:[e.jsxs(ee,{children:[e.jsxs(se,{className:"flex items-center gap-2",children:[e.jsx(E,{className:"h-5 w-5 text-primary"}),"Limpiar índice de búsqueda"]}),e.jsx(ae,{children:"Compara la base de datos con el índice de búsqueda (Qdrant) y elimina puntos huérfanos que quedaron de registros eliminados anteriormente."})]}),e.jsx("div",{className:"py-4",children:g&&!a?e.jsxs("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[e.jsx(k,{className:"h-5 w-5 animate-spin mr-2"}),"Analizando índice..."]}):a?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-border/60 bg-muted/30 p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:"Puntos en Qdrant"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:a.totalQdrantPoints})]}),e.jsxs("div",{className:"rounded-lg border border-border/60 bg-muted/30 p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:"Registros en BD"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:a.totalDbSources})]}),e.jsxs("div",{className:`rounded-lg border p-3 ${a.orphanedPoints>0?"border-amber-500/40 bg-amber-500/10":"border-emerald-500/40 bg-emerald-500/10"}`,children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Puntos huérfanos"}),e.jsx("div",{className:`text-2xl font-bold mt-1 ${a.orphanedPoints>0?"text-amber-600":"text-emerald-600"}`,children:a.orphanedPoints})]}),e.jsxs("div",{className:`rounded-lg border p-3 ${a.missingInQdrant.length>0?"border-red-500/40 bg-red-500/10":"border-emerald-500/40 bg-emerald-500/10"}`,children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Faltantes en índice"}),e.jsx("div",{className:`text-2xl font-bold mt-1 ${a.missingInQdrant.length>0?"text-red-600":"text-emerald-600"}`,children:a.missingInQdrant.length})]})]}),a.deleted>0&&e.jsxs("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-3 text-sm text-emerald-700 dark:text-emerald-400",children:["✓ Se eliminaron ",e.jsx("strong",{children:a.deleted})," puntos huérfanos del índice."]}),a.dryRun&&a.orphanedPoints===0&&e.jsx("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-3 text-sm text-emerald-700 dark:text-emerald-400",children:"✓ El índice está limpio, no se encontraron puntos huérfanos."}),a.missingInQdrant.length>0&&e.jsxs("div",{className:"rounded-lg border border-red-500/40 bg-red-500/10 p-3 text-xs text-red-700 dark:text-red-400",children:[e.jsx("strong",{children:"Advertencia:"})," ",a.missingInQdrant.length," registro(s) están en la BD pero no indexados. Edita y guarda la Q&A para re-indexar."]})]}):null}),e.jsxs(re,{children:[e.jsx(te,{disabled:g,children:"Cerrar"}),a&&a.dryRun&&a.orphanedPoints>0&&e.jsx(le,{onClick:s=>{s.preventDefault(),I()},disabled:g,className:"bg-amber-600 hover:bg-amber-700",children:g?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"h-4 w-4 animate-spin mr-2"})," Eliminando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 mr-2"})," Eliminar ",a.orphanedPoints," huérfano(s)"]})})]})]})})]})}export{He as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
package/template/panel/assets/{CampaignDetailPage-DFMctNEj.js → CampaignDetailPage-DUNnckvn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ay as a}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";const o=a;export{o as CampaignDetailPage,a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as W,g as k,au as y,j as e,l as m,o as N,at as f,w as I}from"./index-43NA2pdZ.js";import{b as S}from"./recharts-DrC5kNsx.js";import{S as M,a as V,c as q,d as b}from"./select-DCY_lg9j.js";import{c as E,b as F,S as R,F as B,P as G}from"./index-YR5X3nd4.js";import{M as c}from"./message-square-B1_OirdW.js";import{I as O}from"./instagram-Bm17x-Fs.js";const Q=()=>{const s=W(),{data:n=[],isLoading:l,refetch:x}=k({queryKey:["channels"],queryFn:()=>E.list(),staleTime:300*1e3,gcTime:600*1e3,refetchOnWindowFocus:!1});return S.useEffect(()=>{const d=()=>{console.log("[useChannels] Invalidation triggered by WebSocket"),s.invalidateQueries({queryKey:["channels"]})},h=y.onChannelsUpdate(d),o=y.onChannelStatus(d);return()=>{h(),o()}},[s]),{channels:n,loading:l,refetch:x}},C=s=>s==="all"?{filterType:"all",value:"all"}:s.startsWith("type:")?{filterType:"type",value:s.replace("type:","")}:s.startsWith("id:")?{filterType:"id",value:s.replace("id:","")}:{filterType:"all",value:"all"},U=s=>s?s.providerId?.endsWith("@gmail.com")||s.credentials?.email?.endsWith("@gmail.com")||s.name?.toLowerCase().includes("gmail"):!1,g=(s,n)=>{const l=s.toLowerCase();if(l==="email"&&n)return U(n)?e.jsx(R,{className:"w-4 h-4 text-[#EA4335]"}):e.jsx(B,{className:"w-4 h-4 text-[#0078D4]"});switch(l){case"whatsapp":case"whatsapp_cloud":return e.jsx(c,{className:"w-4 h-4 text-green-500"});case"instagram":return e.jsx(O,{className:"w-4 h-4 text-pink-500"});case"messenger":return e.jsx(c,{className:"w-4 h-4 text-blue-500"});case"waba":return e.jsx(c,{className:"w-4 h-4 text-green-600"});case"sms":return e.jsx(c,{className:"w-4 h-4 text-slate-500"});case"voice":return e.jsx(G,{className:"w-4 h-4 text-purple-500"});default:return e.jsx(c,{className:"w-4 h-4 text-slate-400"})}},v=s=>({whatsapp:"WhatsApp",whatsapp_cloud:"WhatsApp Cloud",instagram:"Instagram",messenger:"Messenger",waba:"WABA",sms:"SMS",voice:"Voz",email:"Email",webchat:"Webchat",telegram:"Telegram",google_business:"G. Business",line:"Line",viber:"Viber",wechat:"WeChat",twitter:"Twitter",calendar:"Citas"})[s.toLowerCase()]||s,_=S.memo(({value:s,onChange:n,className:l,showInactive:x=!1,excludeTypes:d,disableUnreachable:h=!1})=>{const{channels:o,loading:u}=Q(),T=new Set((d??[]).map(a=>a.toLowerCase())),w=o.filter(a=>T.has(a.type.toLowerCase())?!1:x?!0:a.isActive&&!a.deletedAt&&!a.disconnectedFromMetaAt&&!a.deactivatedAt&&!a.archivedAt).reduce((a,r)=>{const t=r.type.toLowerCase();return a[t]||(a[t]=[]),a[t].push(r),a},{}),j=Object.keys(w).sort(),L=()=>{if(s==="all")return"Todos";const{filterType:a,value:r}=C(s);return a==="type"?v(r):a==="id"?o.find(i=>i.id===r)?.name||"Canal":"Todos"},A=()=>{if(s==="all")return e.jsx(f,{className:"w-4 h-4"});const{filterType:a,value:r}=C(s);if(a==="type")return g(r);if(a==="id"){const t=o.find(i=>i.id===r);return t?g(t.type,t):e.jsx(c,{className:"w-4 h-4"})}return e.jsx(f,{className:"w-4 h-4"})};return e.jsxs(M,{value:s,onValueChange:n,children:[e.jsx(V,{className:m("h-9 gap-2 px-3 rounded-lg border border-border bg-background hover:bg-muted/50 transition-all text-sm font-medium","focus:ring-1 focus:ring-primary/20",l),children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u?e.jsx(N,{className:"w-4 h-4 animate-spin text-muted-foreground"}):e.jsx("span",{className:"text-primary shrink-0",children:A()}),e.jsx("span",{className:"truncate",children:L()})]})}),e.jsxs(q,{align:"start",className:"min-w-[220px] max-h-[320px]",children:[e.jsx(b,{value:"all",className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:m("text-muted-foreground",s==="all"&&"text-primary"),children:e.jsx(f,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-medium",children:"Todos los canales"})]})}),!u&&j.map(a=>{const r=w[a];return e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1.5 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider mt-1 border-t border-border pt-2",children:v(a)}),r.map(t=>{const i=`id:${t.id}`,p=h&&F(t);return e.jsx(b,{value:i,disabled:p,className:m("cursor-pointer pl-4",p&&"opacity-70"),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:m("text-muted-foreground",s===i&&"text-primary"),children:g(a,t)}),e.jsx("span",{className:m("font-medium truncate",p?"max-w-[110px]":"max-w-[150px]"),children:t.name}),p&&e.jsxs("span",{className:"ml-auto flex items-center gap-1 text-[10px] font-medium text-amber-600 dark:text-amber-400 shrink-0",children:[e.jsx(I,{className:"w-3 h-3"}),"Reconectar"]})]})},t.id)})]},a)}),u&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[e.jsx(N,{className:"w-3 h-3 animate-spin"}),"Cargando canales..."]}),!u&&j.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No hay canales configurados"})]})]})});_.displayName="ChannelSelector";export{_ as C,C as p,Q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ay as e}from"./index-43NA2pdZ.js";import"./recharts-DrC5kNsx.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as a,a1 as x,a2 as j,a3 as m,a4 as f,a5 as h,aa as D,B as e}from"./index-43NA2pdZ.js";function C({open:l,onOpenChange:i,onConfirm:r,title:o,description:n,confirmText:t="Confirmar",cancelText:c="Cancelar",variant:d="default",loading:s=!1}){return a.jsx(x,{open:l,onOpenChange:i,children:a.jsxs(j,{className:"sm:max-w-[425px]",children:[a.jsxs(m,{children:[a.jsx(f,{children:o}),a.jsx(h,{children:n})]}),a.jsxs(D,{children:[a.jsx(e,{variant:"outline",onClick:()=>i(!1),disabled:s,children:c}),a.jsx(e,{variant:d,onClick:r,disabled:s,children:s?"Procesando...":t})]})]})})}export{C};
|