larkup 0.1.27 → 0.1.29

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.
Files changed (218) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +5 -5
  3. package/.next/diagnostics/route-bundle-stats.json +26 -26
  4. package/.next/fallback-build-manifest.json +3 -3
  5. package/.next/next-minimal-server.js.nft.json +1 -1
  6. package/.next/next-server.js.nft.json +1 -1
  7. package/.next/prerender-manifest.json +3 -3
  8. package/.next/required-server-files.js +4 -4
  9. package/.next/required-server-files.json +4 -4
  10. package/.next/server/app/_global-error/page/build-manifest.json +2 -2
  11. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  12. package/.next/server/app/_global-error.html +1 -1
  13. package/.next/server/app/_global-error.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  19. package/.next/server/app/_not-found/page/build-manifest.json +2 -2
  20. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  21. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/_not-found.html +1 -1
  23. package/.next/server/app/_not-found.rsc +16 -16
  24. package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -16
  25. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  26. package/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
  27. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  28. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  29. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  30. package/.next/server/app/analytics/page/build-manifest.json +2 -2
  31. package/.next/server/app/analytics/page.js.nft.json +1 -1
  32. package/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
  33. package/.next/server/app/analytics.html +1 -1
  34. package/.next/server/app/analytics.rsc +17 -17
  35. package/.next/server/app/analytics.segments/_full.segment.rsc +17 -17
  36. package/.next/server/app/analytics.segments/_head.segment.rsc +4 -4
  37. package/.next/server/app/analytics.segments/_index.segment.rsc +11 -11
  38. package/.next/server/app/analytics.segments/_tree.segment.rsc +1 -1
  39. package/.next/server/app/analytics.segments/analytics/__PAGE__.segment.rsc +3 -3
  40. package/.next/server/app/analytics.segments/analytics.segment.rsc +3 -3
  41. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  42. package/.next/server/app/api/chat/route.js +9 -10
  43. package/.next/server/app/api/chat/route.js.nft.json +1 -1
  44. package/.next/server/app/api/chat/status/route.js.nft.json +1 -1
  45. package/.next/server/app/api/chat/suggestions/route.js.nft.json +1 -1
  46. package/.next/server/app/api/config/route.js.nft.json +1 -1
  47. package/.next/server/app/api/config/test/route.js.nft.json +1 -1
  48. package/.next/server/app/api/config/test-embedding/route.js.nft.json +1 -1
  49. package/.next/server/app/api/config/test-llm/route.js.nft.json +1 -1
  50. package/.next/server/app/api/config/test-provider/route.js.nft.json +1 -1
  51. package/.next/server/app/api/config/verify/route.js.nft.json +1 -1
  52. package/.next/server/app/api/connections/route.js.nft.json +1 -1
  53. package/.next/server/app/api/connections/webhook/route.js.nft.json +1 -1
  54. package/.next/server/app/api/demo/route.js.nft.json +1 -1
  55. package/.next/server/app/api/deploy/cloud-project/route.js.nft.json +1 -1
  56. package/.next/server/app/api/deploy/ssh/route.js.nft.json +1 -1
  57. package/.next/server/app/api/deployment/blob-setup/route.js.nft.json +1 -1
  58. package/.next/server/app/api/deployment/config/route.js.nft.json +1 -1
  59. package/.next/server/app/api/describe-image/route.js.nft.json +1 -1
  60. package/.next/server/app/api/doc-editor/edit/route.js.nft.json +1 -1
  61. package/.next/server/app/api/doc-editor/export/route.js.nft.json +1 -1
  62. package/.next/server/app/api/doc-editor/extract-text/route.js.nft.json +1 -1
  63. package/.next/server/app/api/doc-editor/parse/route.js.nft.json +1 -1
  64. package/.next/server/app/api/doc-editor/restore/route.js.nft.json +1 -1
  65. package/.next/server/app/api/document/sign/route.js.nft.json +1 -1
  66. package/.next/server/app/api/documents/route.js.nft.json +1 -1
  67. package/.next/server/app/api/firecrawl/local/route.js.nft.json +1 -1
  68. package/.next/server/app/api/index/route.js.nft.json +1 -1
  69. package/.next/server/app/api/integrations/notion/callback/route.js.nft.json +1 -1
  70. package/.next/server/app/api/integrations/notion/route.js.nft.json +1 -1
  71. package/.next/server/app/api/jobs/[id]/route.js.nft.json +1 -1
  72. package/.next/server/app/api/jobs/route.js.nft.json +1 -1
  73. package/.next/server/app/api/marketplace/[toolId]/route.js +1 -1
  74. package/.next/server/app/api/marketplace/[toolId]/route.js.nft.json +1 -1
  75. package/.next/server/app/api/marketplace/route.js +1 -1
  76. package/.next/server/app/api/marketplace/route.js.nft.json +1 -1
  77. package/.next/server/app/api/media/[id]/route.js.nft.json +1 -1
  78. package/.next/server/app/api/media/process/route.js +4 -4
  79. package/.next/server/app/api/media/process/route.js.nft.json +1 -1
  80. package/.next/server/app/api/media/route.js +1 -1
  81. package/.next/server/app/api/media/route.js.nft.json +1 -1
  82. package/.next/server/app/api/media/stream/route.js.nft.json +1 -1
  83. package/.next/server/app/api/models/route.js.nft.json +1 -1
  84. package/.next/server/app/api/parse-file/route.js.nft.json +1 -1
  85. package/.next/server/app/api/proxy/verify/route.js.nft.json +1 -1
  86. package/.next/server/app/api/sandbox/route.js.nft.json +1 -1
  87. package/.next/server/app/api/search/bing/route.js.nft.json +1 -1
  88. package/.next/server/app/api/search/brave/route.js.nft.json +1 -1
  89. package/.next/server/app/api/search/exa/route.js.nft.json +1 -1
  90. package/.next/server/app/api/search/google/route.js.nft.json +1 -1
  91. package/.next/server/app/api/search/route.js.nft.json +1 -1
  92. package/.next/server/app/api/search/tavily/route.js.nft.json +1 -1
  93. package/.next/server/app/api/search/verify/route.js.nft.json +1 -1
  94. package/.next/server/app/api/server/agent/route.js.nft.json +1 -1
  95. package/.next/server/app/api/server/download/route.js.nft.json +1 -1
  96. package/.next/server/app/api/server/generate/route.js.nft.json +1 -1
  97. package/.next/server/app/api/server/local/route.js.nft.json +1 -1
  98. package/.next/server/app/api/servers/route.js.nft.json +1 -1
  99. package/.next/server/app/api/tabular/query/route.js.nft.json +1 -1
  100. package/.next/server/app/api/tabular/route.js.nft.json +1 -1
  101. package/.next/server/app/api/upload-file/route.js.nft.json +1 -1
  102. package/.next/server/app/api/uploads/[...slug]/route.js.nft.json +1 -1
  103. package/.next/server/app/api/vector-stores/install/route.js.nft.json +1 -1
  104. package/.next/server/app/api/vector-stores/status/route.js.nft.json +1 -1
  105. package/.next/server/app/chat/page/build-manifest.json +2 -2
  106. package/.next/server/app/chat/page.js.nft.json +1 -1
  107. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  108. package/.next/server/app/chat.html +1 -1
  109. package/.next/server/app/chat.rsc +17 -17
  110. package/.next/server/app/chat.segments/_full.segment.rsc +17 -17
  111. package/.next/server/app/chat.segments/_head.segment.rsc +4 -4
  112. package/.next/server/app/chat.segments/_index.segment.rsc +11 -11
  113. package/.next/server/app/chat.segments/_tree.segment.rsc +1 -1
  114. package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +3 -3
  115. package/.next/server/app/chat.segments/chat.segment.rsc +3 -3
  116. package/.next/server/app/data/page/build-manifest.json +2 -2
  117. package/.next/server/app/data/page.js.nft.json +1 -1
  118. package/.next/server/app/data/page_client-reference-manifest.js +1 -1
  119. package/.next/server/app/data.html +1 -1
  120. package/.next/server/app/data.rsc +17 -17
  121. package/.next/server/app/data.segments/_full.segment.rsc +17 -17
  122. package/.next/server/app/data.segments/_head.segment.rsc +4 -4
  123. package/.next/server/app/data.segments/_index.segment.rsc +11 -11
  124. package/.next/server/app/data.segments/_tree.segment.rsc +1 -1
  125. package/.next/server/app/data.segments/data/__PAGE__.segment.rsc +3 -3
  126. package/.next/server/app/data.segments/data.segment.rsc +3 -3
  127. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  128. package/.next/server/app/index.html +1 -1
  129. package/.next/server/app/index.rsc +16 -16
  130. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  131. package/.next/server/app/index.segments/_full.segment.rsc +16 -16
  132. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  133. package/.next/server/app/index.segments/_index.segment.rsc +11 -11
  134. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  135. package/.next/server/app/page/build-manifest.json +2 -2
  136. package/.next/server/app/page.js.nft.json +1 -1
  137. package/.next/server/app/page_client-reference-manifest.js +1 -1
  138. package/.next/server/app/settings/page/build-manifest.json +2 -2
  139. package/.next/server/app/settings/page/server-reference-manifest.json +3 -3
  140. package/.next/server/app/settings/page.js.nft.json +1 -1
  141. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/settings.html +1 -1
  143. package/.next/server/app/settings.rsc +18 -18
  144. package/.next/server/app/settings.segments/_full.segment.rsc +18 -18
  145. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  146. package/.next/server/app/settings.segments/_index.segment.rsc +11 -11
  147. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  148. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  149. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  150. package/.next/server/chunks/[root-of-the-server]__0c80bj0._.js +3 -0
  151. package/.next/server/chunks/{[root-of-the-server]__1m7m2x7._.js → [root-of-the-server]__0drkoru._.js} +2 -2
  152. package/.next/server/chunks/{[root-of-the-server]__0vnm6_8._.js → [root-of-the-server]__0kmh740._.js} +6 -6
  153. package/.next/server/chunks/{[root-of-the-server]__0ou70-v._.js → [root-of-the-server]__0nfenje._.js} +1 -1
  154. package/.next/server/chunks/[root-of-the-server]__0omd-x0._.js +3 -0
  155. package/.next/server/chunks/{[root-of-the-server]__1s1zui-._.js → [root-of-the-server]__10v5qsi._.js} +1 -1
  156. package/.next/server/chunks/[root-of-the-server]__1idgvjh._.js +172 -0
  157. package/.next/server/chunks/[root-of-the-server]__1ip05r1._.js +1 -1
  158. package/.next/server/chunks/[root-of-the-server]__1jc54o2._.js +3 -0
  159. package/.next/server/chunks/{[root-of-the-server]__0748x7h._.js → [root-of-the-server]__1lhls88._.js} +1 -1
  160. package/.next/server/chunks/{[root-of-the-server]__0g_q-44._.js → [root-of-the-server]__1wy6wes._.js} +2 -2
  161. package/.next/server/chunks/{packages_1f4dx4h._.js → packages_1ggqion._.js} +2 -2
  162. package/.next/server/chunks/packages_marketplace_src_125_g2p._.js +1 -1
  163. package/.next/server/chunks/{packages_vector-stores_src_064-9ay._.js → packages_vector-stores_src_1fib7u-._.js} +2 -2
  164. package/.next/server/chunks/ssr/_169pdlf._.js +2 -2
  165. package/.next/server/chunks/ssr/_1hetwwu._.js +3 -3
  166. package/.next/server/chunks/ssr/_1iff9ia._.js +1 -1
  167. package/.next/server/chunks/ssr/_1yqlx1m._.js +1 -1
  168. package/.next/server/chunks/ssr/apps_web_components_analytics_analytics-dashboard_tsx_1056-z3._.js +1 -1
  169. package/.next/server/chunks/ssr/apps_web_lib_pdf-images_ts_13-l5wa._.js +1 -1
  170. package/.next/server/middleware-build-manifest.js +5 -5
  171. package/.next/server/pages/404.html +1 -1
  172. package/.next/server/pages/500.html +1 -1
  173. package/.next/server/server-reference-manifest.js +1 -1
  174. package/.next/server/server-reference-manifest.json +4 -4
  175. package/.next/static/chunks/{3m_e34hfypn-x.js → 01qmngac69n9j.js} +1 -1
  176. package/.next/static/chunks/{3bpr59xr-_rv7.js → 0ge3nirnmx_np.js} +1 -1
  177. package/.next/static/chunks/{0-5iuj-s4wl9k.js → 102b8vinedggz.js} +6 -6
  178. package/.next/static/chunks/{2jqjx4-rh414_.js → 13kyiy7q3of41.js} +1 -1
  179. package/.next/static/chunks/{1fz_0-qb5r5wd.js → 1dykihoo_1ae5.js} +1 -1
  180. package/.next/static/chunks/{0rgt7-bqxonef.js → 1sh7d5tt49x8b.js} +2 -2
  181. package/.next/static/chunks/{1-afr-snks55m.js → 1z4nte07k3dt6.js} +1 -1
  182. package/.next/static/chunks/2ib3e0xrrdait.js +1 -0
  183. package/.next/static/chunks/{1w2jeq6n8-qz9.js → 3g_wl1fri6jb-.js} +1 -1
  184. package/.next/static/chunks/{turbopack-2gu-fmc6o5wkn.js → turbopack-2qt7vn_ocj4ao.js} +1 -1
  185. package/CHANGELOG.md +20 -0
  186. package/app/api/describe-image/route.ts +12 -4
  187. package/components/analytics/analytics-dashboard.tsx +7 -7
  188. package/components/data/media-panel.tsx +34 -2
  189. package/components/data/upload-panel.tsx +2 -1
  190. package/components/settings/marketplace-section.tsx +14 -2
  191. package/components/settings/server-section.tsx +9 -9
  192. package/lib/pdf-images.ts +20 -5
  193. package/package.json +5 -5
  194. package/.next/server/chunks/[root-of-the-server]__00r1kgp._.js +0 -143
  195. package/.next/server/chunks/[root-of-the-server]__064gb96._.js +0 -3
  196. package/.next/server/chunks/_0ce9vcg._.js +0 -32
  197. package/.next/static/chunks/00z1f-adeq1lg.js +0 -1
  198. package/archive/redesign-v2/app/configure/page.tsx +0 -53
  199. package/archive/redesign-v2/app/demo/page.tsx +0 -15
  200. package/archive/redesign-v2/app/server/page.tsx +0 -22
  201. package/archive/redesign-v2/app/simple/chat/page.tsx +0 -17
  202. package/archive/redesign-v2/app/simple/docs/page.tsx +0 -21
  203. package/archive/redesign-v2/app/simple/settings/page.tsx +0 -1104
  204. package/archive/redesign-v2/app-routes/configure/page.tsx +0 -53
  205. package/archive/redesign-v2/app-routes/demo/page.tsx +0 -15
  206. package/archive/redesign-v2/app-routes/server/page.tsx +0 -22
  207. package/archive/redesign-v2/app-routes/simple/chat/page.tsx +0 -17
  208. package/archive/redesign-v2/app-routes/simple/docs/page.tsx +0 -21
  209. package/archive/redesign-v2/app-routes/simple/layout.tsx +0 -9
  210. package/archive/redesign-v2/app-routes/simple/settings/page.tsx +0 -1104
  211. package/archive/redesign-v2/components/app-sidebar.tsx +0 -188
  212. package/archive/redesign-v2/components/app-topnav.tsx +0 -195
  213. package/archive/redesign-v2/components/global-settings.tsx +0 -288
  214. package/archive/redesign-v2/components/simple/simple-sidebar.tsx +0 -171
  215. package/archive/redesign-v2/components/simple/simple-topnav.tsx +0 -175
  216. /package/.next/static/{Ms6fqY45868GqHAvux2Qj → W6QdudzTPo_OVPpNt29f7}/_buildManifest.js +0 -0
  217. /package/.next/static/{Ms6fqY45868GqHAvux2Qj → W6QdudzTPo_OVPpNt29f7}/_clientMiddlewareManifest.js +0 -0
  218. /package/.next/static/{Ms6fqY45868GqHAvux2Qj → W6QdudzTPo_OVPpNt29f7}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,385290,t=>{"use strict";var e=t.i(410386);async function a(t){e.GlobalWorkerOptions.workerSrc=`//cdnjs.cloudflare.com/ajax/libs/pdf.js/${e.version}/pdf.worker.mjs`;let a=await t.arrayBuffer(),r=await e.getDocument({data:new Uint8Array(a)}).promise,i=r.numPages,n=[],h=0,o=t=>{let e=Math.min(1,1600/Math.max(t.width,t.height));if(1===e)return t.toDataURL("image/jpeg",.86);let a=document.createElement("canvas");return a.width=Math.max(1,Math.round(t.width*e)),a.height=Math.max(1,Math.round(t.height*e)),a.getContext("2d")?.drawImage(t,0,0,a.width,a.height),a.toDataURL("image/jpeg",.86)};for(let t=1;t<=i;t++)try{let a=await r.getPage(t),i=await a.getOperatorList(),g=[];for(let t=0;t<i.fnArray.length;t++)(i.fnArray[t]===e.OPS.paintImageXObject||i.fnArray[t]===e.OPS.paintInlineImageXObject)&&g.push(i.argsArray[t][0]);for(let e of g)try{let r=await new Promise(t=>{try{a.objs.get(e,e=>t(e))}catch(e){t(null)}});if(r&&r.bitmap){let e=document.createElement("canvas");e.width=r.bitmap.width||r.width,e.height=r.bitmap.height||r.height;let a=e.getContext("2d");a&&(a.drawImage(r.bitmap,0,0),n.push({base64:o(e),pageNumber:t,index:h++}))}else if(r&&r.data&&r.width&&r.height){let e=document.createElement("canvas");e.width=r.width,e.height=r.height;let a=e.getContext("2d");if(a){let i=new ImageData(new Uint8ClampedArray(r.data),r.width,r.height);a.putImageData(i,0,0),n.push({base64:o(e),pageNumber:t,index:h++})}}}catch(a){console.error(`Error extracting image ${e} on page ${t}`,a)}}catch(e){console.error(`Error processing page ${t}`,e)}return n}t.s(["extractImagesFromPDF",0,a])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,288134,e=>{"use strict";let t=(0,e.i(874822).default)("zap",[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]);e.s(["Zap",0,t],288134)},1717,e=>{"use strict";var t=e.i(523829),s=e.i(178328),a=e.i(668548),r=e.i(831892),i=e.i(501375),n=e.i(887216),o=e.i(112786),l=e.i(104872),d=e.i(597343),c=e.i(7544),x=e.i(794189),u=e.i(370317),m=e.i(134018),h=e.i(300033),p=e.i(874822);let f=(0,p.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var j=e.i(518864),g=e.i(501706);let y=(0,p.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);var v=e.i(288134),C=e.i(842646);let b=e=>fetch(e).then(e=>e.json());function k(e,t,s){if("all"===t||!e)return e||[];let a=30;"7d"===t?a=7:"14d"===t?a=14:"30d"===t?a=30:"90d"===t&&(a=90);let r=[],i=new Date,n=new Map(e.map(e=>[e.date,e]));for(let e=a-1;e>=0;e--){let t=new Date(i);t.setDate(t.getDate()-e);let a=t.toISOString().split("T")[0];n.has(a)?r.push(n.get(a)):r.push({date:a,...s()})}return r}function N(e){return(e/1e6).toFixed(2)+"M"}e.s(["AnalyticsDashboard",0,function(){var e;let[p,w]=(0,s.useState)("overview"),[T,S]=(0,s.useState)("14d"),{data:L,isLoading:D,error:A}=(0,C.default)(`/api/analytics?timeframe=${T}`,b);if(D)return(0,t.jsxs)("div",{className:"p-8 flex-col gap-2 text-center text-muted-foreground animate-pulse flex items-center justify-center h-full",children:[(0,t.jsx)(g.Loader2,{className:"size-6 animate-spin"}),(0,t.jsx)("span",{className:"text-[15px]",children:"Loading analytics data..."})]});if(A||!L)return(0,t.jsx)("div",{className:"p-8 text-center text-destructive",children:"Failed to load analytics data."});let z=!L.serverTimeSeries?.length||L.serverTimeSeries.every(e=>0===e.requests),I=!L.embeddingTimeSeries?.length||L.embeddingTimeSeries.every(e=>0===e.tokens),O=!L.chatTimeSeries?.length||L.chatTimeSeries.every(e=>0===e.tokens),R=({title:e,description:s})=>(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-md",children:(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-2 dark:bg-zinc-900/90 px-5 py-4 rounded-lg max-w-xl text-center",children:[(0,t.jsx)("div",{className:"p-2 border border-border/70 rounded-lg bg-white",children:(0,t.jsx)(f,{className:"size-6 text-black/80"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-[16px] font-semibold text-foreground",children:e}),(0,t.jsx)("p",{className:"text-[13px] text-muted-foreground",children:s})]})]})});return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Total Cost"}),(0,t.jsx)(f,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:0===(e=L.totalCost)?"$0.00":e<.01?e<1e-4?"<$0.0001":`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Across all paid models"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Chat Tokens"}),(0,t.jsx)(y,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:N(L.totalChatTokens)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed in conversations"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Embedding Tokens"}),(0,t.jsx)(j.Database,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:N(L.totalEmbeddingTokens)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed during indexing"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Total Requests"}),(0,t.jsx)(v.Zap,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:L.totalRequests.toLocaleString()}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"To local RAG server this week"})]})]})]}),(0,t.jsxs)(m.Tabs,{value:p,onValueChange:w,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[(0,t.jsxs)(m.TabsList,{className:"inline-flex bg-white/70 dark:bg-muted/70 h-9 items-center justify-center rounded-lg border border-border p-0.5 text-muted-foreground",children:[(0,t.jsxs)(m.TabsTrigger,{value:"overview",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(f,{className:"size-3.5 mr-1.5"}),"Server Traffic"]}),(0,t.jsxs)(m.TabsTrigger,{value:"indexing",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(j.Database,{className:"size-3.5 mr-1.5"}),"Indexing Usage"]}),(0,t.jsxs)(m.TabsTrigger,{value:"chat",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(y,{className:"size-3.5 mr-1.5"}),"Chat Usage"]})]}),(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsxs)(h.Select,{value:T,onValueChange:e=>e&&S(e),children:[(0,t.jsx)(h.SelectTrigger,{className:"w-[140px] h-10! text-sm bg-white dark:bg-background focus:ring-0 focus:border-input data-[state=open]:ring-0 data-[state=open]:border-input outline-none focus:outline-none",children:(0,t.jsxs)(h.SelectValue,{placeholder:"Select timeframe",children:["7d"===T&&"Last 7 days","14d"===T&&"Last 14 days","30d"===T&&"Last 30 days","90d"===T&&"Last 90 days","all"===T&&"All time"]})}),(0,t.jsxs)(h.SelectContent,{children:[(0,t.jsx)(h.SelectItem,{value:"7d",children:"Last 7 days"}),(0,t.jsx)(h.SelectItem,{value:"14d",children:"Last 14 days"}),(0,t.jsx)(h.SelectItem,{value:"30d",children:"Last 30 days"}),(0,t.jsx)(h.SelectItem,{value:"90d",children:"Last 90 days"}),(0,t.jsx)(h.SelectItem,{value:"all",children:"All time"})]})]})})]}),(0,t.jsx)(m.TabsContent,{value:"overview",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none! rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Requests to RAG Server"}),(0,t.jsx)(u.CardDescription,{children:"Daily requests sent to your local or remote deployed RAG endpoints."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[z&&(0,t.jsx)(R,{title:"No Server Traffic Yet",description:"Once you start sending requests to the RAG server, usage will appear here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(n.BarChart,{data:k(L.serverTimeSeries,T,()=>({requests:0,avgLatencyMs:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"},cursor:{fill:"var(--color-muted)",opacity:.4}}),(0,t.jsx)(i.Bar,{dataKey:"requests",fill:"#3b82f6",radius:[4,4,0,0],maxBarSize:40,activeBar:{className:"outline-none focus:outline-none"}})]})})]})})]})}),(0,t.jsx)(m.TabsContent,{value:"indexing",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Indexing Token Usage"}),(0,t.jsx)(u.CardDescription,{children:"Daily tokens processed for document indexing."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[I&&(0,t.jsx)(R,{title:"No Indexing Data Yet",description:"Add documents to your knowledge bases to see embedding token usage here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(r.AreaChart,{data:k(L.embeddingTimeSeries,T,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"colorIndexing",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"5%",stopColor:"#f97316",stopOpacity:.3}),(0,t.jsx)("stop",{offset:"95%",stopColor:"#f97316",stopOpacity:0})]})}),(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e>=1e3?e/1e3+"k":e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,t.jsx)(a.Area,{type:"monotone",dataKey:"tokens",stroke:"#f97316",strokeWidth:2,fillOpacity:1,fill:"url(#colorIndexing)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})}),(0,t.jsx)(m.TabsContent,{value:"chat",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Chat Token Usage"}),(0,t.jsx)(u.CardDescription,{children:"Daily tokens processed for chat completions."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[O&&(0,t.jsx)(R,{title:"No Chat Data Yet",description:"Chat with the AI to see your token usage metrics here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(r.AreaChart,{data:k(L.chatTimeSeries,T,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"colorChat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),(0,t.jsx)("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e>=1e3?e/1e3+"k":e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,t.jsx)(a.Area,{type:"monotone",dataKey:"tokens",stroke:"#3b82f6",strokeWidth:2,fillOpacity:1,fill:"url(#colorChat)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})})]})]})}],1717)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,288134,e=>{"use strict";let t=(0,e.i(874822).default)("zap",[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]);e.s(["Zap",0,t],288134)},1717,e=>{"use strict";var t=e.i(523829),s=e.i(178328),a=e.i(668548),r=e.i(831892),i=e.i(501375),n=e.i(887216),o=e.i(112786),l=e.i(104872),d=e.i(597343),c=e.i(7544),x=e.i(794189),u=e.i(370317),m=e.i(134018),h=e.i(300033),p=e.i(874822);let f=(0,p.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var j=e.i(518864),g=e.i(501706);let y=(0,p.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);var v=e.i(288134),C=e.i(842646);let b=e=>fetch(e).then(e=>e.json());function k(e,t,s){if("all"===t||!e)return e||[];let a=30;"7d"===t?a=7:"14d"===t?a=14:"30d"===t?a=30:"90d"===t&&(a=90);let r=[],i=new Date,n=new Map(e.map(e=>[e.date,e]));for(let e=a-1;e>=0;e--){let t=new Date(i);t.setDate(t.getDate()-e);let a=t.toISOString().split("T")[0];n.has(a)?r.push(n.get(a)):r.push({date:a,...s()})}return r}function N(e){return(e/1e6).toFixed(2)+"M"}e.s(["AnalyticsDashboard",0,function(){var e;let[p,w]=(0,s.useState)("overview"),[T,S]=(0,s.useState)("14d"),{data:L,isLoading:D,error:A}=(0,C.default)(`/api/analytics?timeframe=${T}`,b);if(D)return(0,t.jsxs)("div",{className:"p-8 flex-col gap-2 text-center text-muted-foreground animate-pulse flex items-center justify-center h-full",children:[(0,t.jsx)(g.Loader2,{className:"size-6 animate-spin"}),(0,t.jsx)("span",{className:"text-[15px]",children:"Loading analytics data..."})]});if(A||!L)return(0,t.jsx)("div",{className:"p-8 text-center text-destructive",children:"Failed to load analytics data."});let z=!L.serverTimeSeries?.length||L.serverTimeSeries.every(e=>0===e.requests),I=!L.embeddingTimeSeries?.length||L.embeddingTimeSeries.every(e=>0===e.tokens),O=!L.chatTimeSeries?.length||L.chatTimeSeries.every(e=>0===e.tokens),R=({title:e,description:s})=>(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-md",children:(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-2 dark:bg-zinc-900/90 px-5 py-4 rounded-lg max-w-xl text-center",children:[(0,t.jsx)("div",{className:"p-2 border border-border/70 rounded-lg bg-white",children:(0,t.jsx)(f,{className:"size-6 text-black/80"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-[16px] font-semibold text-foreground",children:e}),(0,t.jsx)("p",{className:"text-[13px] text-muted-foreground",children:s})]})]})});return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Total Cost"}),(0,t.jsx)(f,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:0===(e=L.totalCost)?"$0.00":e<.01?e<1e-4?"<$0.0001":`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Across all paid models"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Chat Tokens"}),(0,t.jsx)(y,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:N(L.totalChatTokens)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed in conversations"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Embedding Tokens"}),(0,t.jsx)(j.Database,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:N(L.totalEmbeddingTokens)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed during indexing"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Total Requests"}),(0,t.jsx)(v.Zap,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:L.totalRequests.toLocaleString()}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"To local RAG server this week"})]})]})]}),(0,t.jsxs)(m.Tabs,{value:p,onValueChange:w,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[(0,t.jsxs)(m.TabsList,{className:"inline-flex bg-white/70 dark:bg-muted/70 h-9 items-center justify-center rounded-lg border border-border p-0.5 text-muted-foreground",children:[(0,t.jsxs)(m.TabsTrigger,{value:"indexing",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(j.Database,{className:"size-3.5 mr-1.5"}),"Indexing Usage"]}),(0,t.jsxs)(m.TabsTrigger,{value:"chat",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(y,{className:"size-3.5 mr-1.5"}),"Chat Usage"]}),(0,t.jsxs)(m.TabsTrigger,{value:"overview",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(f,{className:"size-3.5 mr-1.5"}),"Server Traffic"]})]}),(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsxs)(h.Select,{value:T,onValueChange:e=>e&&S(e),children:[(0,t.jsx)(h.SelectTrigger,{className:"w-[140px] h-10! text-sm bg-white dark:bg-background focus:ring-0 focus:border-input data-[state=open]:ring-0 data-[state=open]:border-input outline-none focus:outline-none",children:(0,t.jsxs)(h.SelectValue,{placeholder:"Select timeframe",children:["7d"===T&&"Last 7 days","14d"===T&&"Last 14 days","30d"===T&&"Last 30 days","90d"===T&&"Last 90 days","all"===T&&"All time"]})}),(0,t.jsxs)(h.SelectContent,{children:[(0,t.jsx)(h.SelectItem,{value:"7d",children:"Last 7 days"}),(0,t.jsx)(h.SelectItem,{value:"14d",children:"Last 14 days"}),(0,t.jsx)(h.SelectItem,{value:"30d",children:"Last 30 days"}),(0,t.jsx)(h.SelectItem,{value:"90d",children:"Last 90 days"}),(0,t.jsx)(h.SelectItem,{value:"all",children:"All time"})]})]})})]}),(0,t.jsx)(m.TabsContent,{value:"overview",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none! rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Requests to RAG Server"}),(0,t.jsx)(u.CardDescription,{children:"Daily requests sent to your local or remote deployed RAG endpoints."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[z&&(0,t.jsx)(R,{title:"No Server Traffic Yet",description:"Once you start sending requests to the RAG server, usage will appear here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(n.BarChart,{data:k(L.serverTimeSeries,T,()=>({requests:0,avgLatencyMs:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"},cursor:{fill:"var(--color-muted)",opacity:.4}}),(0,t.jsx)(i.Bar,{dataKey:"requests",fill:"#3b82f6",radius:[4,4,0,0],maxBarSize:40,activeBar:{className:"outline-none focus:outline-none"}})]})})]})})]})}),(0,t.jsx)(m.TabsContent,{value:"indexing",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Indexing Token Usage"}),(0,t.jsx)(u.CardDescription,{children:"Daily tokens processed for document indexing."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[I&&(0,t.jsx)(R,{title:"No Indexing Data Yet",description:"Add documents to your knowledge bases to see embedding token usage here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(r.AreaChart,{data:k(L.embeddingTimeSeries,T,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"colorIndexing",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"5%",stopColor:"#f97316",stopOpacity:.3}),(0,t.jsx)("stop",{offset:"95%",stopColor:"#f97316",stopOpacity:0})]})}),(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e>=1e3?e/1e3+"k":e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,t.jsx)(a.Area,{type:"monotone",dataKey:"tokens",stroke:"#f97316",strokeWidth:2,fillOpacity:1,fill:"url(#colorIndexing)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})}),(0,t.jsx)(m.TabsContent,{value:"chat",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Chat Token Usage"}),(0,t.jsx)(u.CardDescription,{children:"Daily tokens processed for chat completions."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[O&&(0,t.jsx)(R,{title:"No Chat Data Yet",description:"Chat with the AI to see your token usage metrics here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(r.AreaChart,{data:k(L.chatTimeSeries,T,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"colorChat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),(0,t.jsx)("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e>=1e3?e/1e3+"k":e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,t.jsx)(a.Area,{type:"monotone",dataKey:"tokens",stroke:"#3b82f6",strokeWidth:2,fillOpacity:1,fill:"url(#colorChat)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})})]})]})}],1717)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,{otherChunks:["static/chunks/27fi1xpxq8d86.js","static/chunks/2vf9qvtghwrpc.js","static/chunks/2ni3dzue_cjp8.js","static/chunks/3tq9j7hs47mpo.js","static/chunks/2jqjx4-rh414_.js"],runtimeModuleIds:[467071]}]),(()=>{let e;if(!Array.isArray(globalThis.TURBOPACK))return;let t="/_next/",r=function(){if(null!=self.TURBOPACK_ASSET_SUFFIX)return self.TURBOPACK_ASSET_SUFFIX;let e=document?.currentScript?.getAttribute?.("src")??"",t=e.indexOf("?");return t>=0?e.slice(t):""}(),n=["NEXT_DEPLOYMENT_ID","NEXT_CLIENT_ASSET_SUFFIX"];var o,i=((o=i||{})[o.Runtime=0]="Runtime",o[o.Parent=1]="Parent",o[o.Update=2]="Update",o);let l=new WeakMap;function s(e,t){this.m=e,this.e=t}let u=s.prototype,a=Object.prototype.hasOwnProperty,c="u">typeof Symbol&&Symbol.toStringTag;function f(e,t,r){a.call(e,t)||Object.defineProperty(e,t,r)}function p(e,t){let r=e[t];return r||(r=h(t),e[t]=r),r}function h(e){return{exports:{},error:void 0,id:e,namespaceObject:void 0}}function d(e,t){f(e,"__esModule",{value:!0}),c&&f(e,c,{value:"Module"});let r=0;for(;r<t.length;){let n=t[r++],o=t[r++];if("number"==typeof o)if(0===o)f(e,n,{value:t[r++],enumerable:!0,writable:!1});else throw Error(`unexpected tag: ${o}`);else"function"==typeof t[r]?f(e,n,{get:o,set:t[r++],enumerable:!0}):f(e,n,{get:o,enumerable:!0})}Object.seal(e)}function m(e,t){(null!=t?p(this.c,t):this.m).exports=e}u.s=function(e,t){let r,n;null!=t?n=(r=p(this.c,t)).exports:(r=this.m,n=this.e),r.namespaceObject=n,d(n,e)},u.j=function(e,t){var r,n;let o,i,s;null!=t?i=(o=p(this.c,t)).exports:(o=this.m,i=this.e);let u=(r=o,n=i,(s=l.get(r))||(l.set(r,s=[]),r.exports=r.namespaceObject=new Proxy(n,{get(e,t){if(a.call(e,t)||"default"===t||"__esModule"===t)return Reflect.get(e,t);for(let e of s){let r=Reflect.get(e,t);if(void 0!==r)return r}},ownKeys(e){let t=Reflect.ownKeys(e);for(let e of s)for(let r of Reflect.ownKeys(e))"default"===r||t.includes(r)||t.push(r);return t}})),s);"object"==typeof e&&null!==e&&u.push(e)},u.v=m,u.n=function(e,t){let r;(r=null!=t?p(this.c,t):this.m).exports=r.namespaceObject=e};let b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,y=[null,b({}),b([]),b(b)];function g(e,t,r){let n=[],o=-1;for(let t=e;("object"==typeof t||"function"==typeof t)&&!y.includes(t);t=b(t))for(let r of Object.getOwnPropertyNames(t))n.push(r,function(e,t){return()=>e[t]}(e,r)),-1===o&&"default"===r&&(o=n.length-1);return r&&o>=0||(o>=0?n.splice(o,1,0,e):n.push("default",0,e)),d(t,n),t}function O(e){let t=B(e,this.m);if(t.namespaceObject)return t.namespaceObject;let r=t.exports;return t.namespaceObject=g(r,"function"==typeof r?function(...e){return r.apply(this,e)}:Object.create(null),r&&r.__esModule)}function w(e){let t=e.indexOf("#");-1!==t&&(e=e.substring(0,t));let r=e.indexOf("?");return -1!==r&&(e=e.substring(0,r)),e}function j(){let e,t;return{promise:new Promise((r,n)=>{t=n,e=r}),resolve:e,reject:t}}u.i=O,u.A=function(e){return this.r(e)(O.bind(this))},u.t="function"==typeof require?require:function(){throw Error("Unexpected use of runtime require")},u.r=function(e){return B(e,this.m).exports},u.f=function(e){function t(t){if(t=w(t),a.call(e,t))return e[t].module();let r=Error(`Cannot find module '${t}'`);throw r.code="MODULE_NOT_FOUND",r}return t.keys=()=>Object.keys(e),t.resolve=t=>{if(t=w(t),a.call(e,t))return e[t].id();let r=Error(`Cannot find module '${t}'`);throw r.code="MODULE_NOT_FOUND",r},t.import=async e=>await t(e),t};let k=Symbol("turbopack queues"),v=Symbol("turbopack exports"),U=Symbol("turbopack error");function C(e){e&&1!==e.status&&(e.status=1,e.forEach(e=>e.queueCount--),e.forEach(e=>e.queueCount--?e.queueCount++:e()))}u.a=function(e,t){let r=this.m,n=t?Object.assign([],{status:-1}):void 0,o=new Set,{resolve:i,reject:l,promise:s}=j(),u=Object.assign(s,{[v]:r.exports,[k]:e=>{n&&e(n),o.forEach(e),u.catch(()=>{})}}),a={get:()=>u,set(e){e!==u&&(u[v]=e)}};Object.defineProperty(r,"exports",a),Object.defineProperty(r,"namespaceObject",a),e(function(e){let t=e.map(e=>{if(null!==e&&"object"==typeof e){if(k in e)return e;if(null!=e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then){let t=Object.assign([],{status:0}),r={[v]:{},[k]:e=>e(t)};return e.then(e=>{r[v]=e,C(t)},e=>{r[U]=e,C(t)}),r}}return{[v]:e,[k]:()=>{}}}),r=()=>t.map(e=>{if(e[U])throw e[U];return e[v]}),{promise:i,resolve:l}=j(),s=Object.assign(()=>l(r),{queueCount:0});function u(e){e!==n&&!o.has(e)&&(o.add(e),e&&0===e.status&&(s.queueCount++,e.push(s)))}return t.map(e=>e[k](u)),s.queueCount?i:r()},function(e){e?l(u[U]=e):i(u[v]),C(n)}),n&&-1===n.status&&(n.status=0)};let P=function(e){let t=new URL(e,"x:/"),r={};for(let e in t)r[e]=t[e];for(let t in r.href=e,r.pathname=e.replace(/[?#].*/,""),r.origin=r.protocol="",r.toString=r.toJSON=(...t)=>e,r)Object.defineProperty(this,t,{enumerable:!0,configurable:!0,value:r[t]})};function R(e,t){throw Error(`Invariant: ${t(e)}`)}P.prototype=URL.prototype,u.U=P,u.z=function(e){throw Error("dynamic usage of require is not supported")},u.g=globalThis;let S=s.prototype,$=new Map;u.M=$;let _=new Map,E=new Map;async function T(e,t,r){let n;if("string"==typeof r)return M(e,t,q(r));let o=r.included||[],i=o.map(e=>!!$.has(e)||_.get(e));if(i.length>0&&i.every(e=>e))return void await Promise.all(i);let l=r.moduleChunks||[],s=l.map(e=>E.get(e)).filter(e=>e);if(s.length>0){if(s.length===l.length)return void await Promise.all(s);let r=new Set;for(let e of l)E.has(e)||r.add(e);for(let n of r){let r=M(e,t,q(n));E.set(n,r),s.push(r)}n=Promise.all(s)}else{for(let o of(n=M(e,t,q(r.path)),l))E.has(o)||E.set(o,n)}for(let e of o)_.has(e)||_.set(e,n);await n}S.l=function(e){return T(i.Parent,this.m.id,e)};let x=Promise.resolve(void 0),A=new WeakMap;function M(t,r,n){let o=e.loadChunkCached(t,n),l=A.get(o);if(void 0===l){let e=A.set.bind(A,o,x);l=o.then(e).catch(e=>{let o;switch(t){case i.Runtime:o=`as a runtime dependency of chunk ${r}`;break;case i.Parent:o=`from module ${r}`;break;case i.Update:o="from an HMR update";break;default:R(t,e=>`Unknown source type: ${e}`)}let l=Error(`Failed to load chunk ${n} ${o}${e?`: ${e}`:""}`,e?{cause:e}:void 0);throw l.name="ChunkLoadError",l}),A.set(o,l)}return l}function q(e){return`${t}${e.split("/").map(e=>encodeURIComponent(e)).join("/")}${r}`}S.L=function(e){return M(i.Parent,this.m.id,e)},S.R=function(e){let t=this.r(e);return t?.default??t},S.P=function(e){return`/ROOT/${e??""}`},S.q=function(e,t){m.call(this,`${e}${r}`,t)},S.b=function(e,t,o,i){let l="SharedWorker"===e.name,s=[o.map(e=>q(e)).reverse(),r];for(let e of n)s.push(globalThis[e]);let u=new URL(q(t),location.origin),a=JSON.stringify(s);return l?u.searchParams.set("params",a):u.hash="#params="+encodeURIComponent(a),new e(u,i?{...i,type:void 0}:void 0)};let N=/\.js(?:\?[^#]*)?(?:#.*)?$/,K=/\.css(?:\?[^#]*)?(?:#.*)?$/;function L(e){return K.test(e)}u.w=function(t,r,n){return e.loadWebAssembly(i.Parent,this.m.id,t,r,n)},u.u=function(t,r){return e.loadWebAssemblyModule(i.Parent,this.m.id,t,r)};let I={};u.c=I;let B=(e,t)=>{let r=I[e];if(r){if(r.error)throw r.error;return r}return W(e,i.Parent,t.id)};function W(e,t,r){let n=$.get(e);if("function"!=typeof n)throw Error(function(e,t,r){let n;switch(t){case 0:n=`as a runtime entry of chunk ${r}`;break;case 1:n=`because it was required from module ${r}`;break;case 2:n="because of an HMR update";break;default:R(t,e=>`Unknown source type: ${e}`)}return`Module ${e} was instantiated ${n}, but the module factory is not available.`}(e,t,r));let o=h(e),i=o.exports;I[e]=o;let l=new s(o,i);try{n(l,o,i)}catch(e){throw o.error=e,e}return o.namespaceObject&&o.exports!==o.namespaceObject&&g(o.exports,o.namespaceObject),o}function F(t){let r,n=function(e){if("string"==typeof e)return e;if(e)return{src:e.getAttribute("src")};if("u">typeof TURBOPACK_NEXT_CHUNK_URLS)return{src:TURBOPACK_NEXT_CHUNK_URLS.pop()};throw Error("chunk path empty but not in a worker")}(t[0]);return 2===t.length?r=t[1]:(r=void 0,!function(e,t){let r=1;for(;r<e.length;){let n,o=r+1;for(;o<e.length&&"function"!=typeof e[o];)o++;if(o===e.length)throw Error("malformed chunk format, expected a factory function");let i=e[o];for(let i=r;i<o;i++){let r=e[i],o=t.get(r);if(o){n=o;break}}let l=n??i,s=!1;for(let n=r;n<o;n++){let r=e[n];t.has(r)||(s||(l===i&&Object.defineProperty(i,"name",{value:"module evaluation"}),s=!0),t.set(r,l))}r=o+1}}(t,$)),e.registerChunk(n,r)}let X=new Map;function D(e){let t=X.get(e);if(!t){let r,n;t={resolved:!1,loadingStarted:!1,promise:new Promise((e,t)=>{r=e,n=t}),resolve:()=>{t.resolved=!0,r()},reject:n},X.set(e,t)}return t}e={async registerChunk(e,r){let n=function(e){if("string"==typeof e)return e;let r=decodeURIComponent(e.src.replace(/[?#].*$/,""));return r.startsWith(t)?r.slice(t.length):r}(e);if(D("string"==typeof e?q(e):e.src).resolve(),null!=r){for(let e of r.otherChunks)D(q("string"==typeof e?e:e.path));if(await Promise.all(r.otherChunks.map(e=>T(i.Runtime,n,e))),r.runtimeModuleIds.length>0)for(let e of r.runtimeModuleIds)!function(e,t){let r=I[t];if(r){if(r.error)throw r.error;return}W(t,i.Runtime,e)}(n,e)}},loadChunkCached:(e,t)=>(function(e,t){let r=D(t);if(r.loadingStarted)return r.promise;if(e===i.Runtime)return r.loadingStarted=!0,L(t)&&r.resolve(),r.promise;if("function"==typeof importScripts)if(L(t));else if(N.test(t))self.TURBOPACK_NEXT_CHUNK_URLS.push(t),importScripts(t);else throw Error(`can't infer type of chunk from URL ${t} in worker`);else{let e=decodeURI(t);if(L(t))if(document.querySelectorAll(`link[rel=stylesheet][href="${t}"],link[rel=stylesheet][href^="${t}?"],link[rel=stylesheet][href="${e}"],link[rel=stylesheet][href^="${e}?"]`).length>0)r.resolve();else{let e=document.createElement("link");e.rel="stylesheet",e.href=t,e.onerror=()=>{r.reject()},e.onload=()=>{r.resolve()},document.head.appendChild(e)}else if(N.test(t)){let n=document.querySelectorAll(`script[src="${t}"],script[src^="${t}?"],script[src="${e}"],script[src^="${e}?"]`);if(n.length>0)for(let e of Array.from(n))e.addEventListener("error",()=>{r.reject()});else{let e=document.createElement("script");e.src=t,e.onerror=()=>{r.reject()},document.head.appendChild(e)}}else throw Error(`can't infer type of chunk from URL ${t}`)}return r.loadingStarted=!0,r.promise})(e,t),async loadWebAssembly(e,t,r,n,o){let i=fetch(q(r)),{instance:l}=await WebAssembly.instantiateStreaming(i,o);return l.exports},async loadWebAssemblyModule(e,t,r,n){let o=fetch(q(r));return await WebAssembly.compileStreaming(o)}};let H=globalThis.TURBOPACK;globalThis.TURBOPACK={push:F},H.forEach(F)})();
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,{otherChunks:["static/chunks/27fi1xpxq8d86.js","static/chunks/2vf9qvtghwrpc.js","static/chunks/2ni3dzue_cjp8.js","static/chunks/3tq9j7hs47mpo.js","static/chunks/13kyiy7q3of41.js"],runtimeModuleIds:[467071]}]),(()=>{let e;if(!Array.isArray(globalThis.TURBOPACK))return;let t="/_next/",r=function(){if(null!=self.TURBOPACK_ASSET_SUFFIX)return self.TURBOPACK_ASSET_SUFFIX;let e=document?.currentScript?.getAttribute?.("src")??"",t=e.indexOf("?");return t>=0?e.slice(t):""}(),n=["NEXT_DEPLOYMENT_ID","NEXT_CLIENT_ASSET_SUFFIX"];var o,i=((o=i||{})[o.Runtime=0]="Runtime",o[o.Parent=1]="Parent",o[o.Update=2]="Update",o);let l=new WeakMap;function s(e,t){this.m=e,this.e=t}let u=s.prototype,a=Object.prototype.hasOwnProperty,c="u">typeof Symbol&&Symbol.toStringTag;function f(e,t,r){a.call(e,t)||Object.defineProperty(e,t,r)}function p(e,t){let r=e[t];return r||(r=h(t),e[t]=r),r}function h(e){return{exports:{},error:void 0,id:e,namespaceObject:void 0}}function d(e,t){f(e,"__esModule",{value:!0}),c&&f(e,c,{value:"Module"});let r=0;for(;r<t.length;){let n=t[r++],o=t[r++];if("number"==typeof o)if(0===o)f(e,n,{value:t[r++],enumerable:!0,writable:!1});else throw Error(`unexpected tag: ${o}`);else"function"==typeof t[r]?f(e,n,{get:o,set:t[r++],enumerable:!0}):f(e,n,{get:o,enumerable:!0})}Object.seal(e)}function m(e,t){(null!=t?p(this.c,t):this.m).exports=e}u.s=function(e,t){let r,n;null!=t?n=(r=p(this.c,t)).exports:(r=this.m,n=this.e),r.namespaceObject=n,d(n,e)},u.j=function(e,t){var r,n;let o,i,s;null!=t?i=(o=p(this.c,t)).exports:(o=this.m,i=this.e);let u=(r=o,n=i,(s=l.get(r))||(l.set(r,s=[]),r.exports=r.namespaceObject=new Proxy(n,{get(e,t){if(a.call(e,t)||"default"===t||"__esModule"===t)return Reflect.get(e,t);for(let e of s){let r=Reflect.get(e,t);if(void 0!==r)return r}},ownKeys(e){let t=Reflect.ownKeys(e);for(let e of s)for(let r of Reflect.ownKeys(e))"default"===r||t.includes(r)||t.push(r);return t}})),s);"object"==typeof e&&null!==e&&u.push(e)},u.v=m,u.n=function(e,t){let r;(r=null!=t?p(this.c,t):this.m).exports=r.namespaceObject=e};let b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,y=[null,b({}),b([]),b(b)];function g(e,t,r){let n=[],o=-1;for(let t=e;("object"==typeof t||"function"==typeof t)&&!y.includes(t);t=b(t))for(let r of Object.getOwnPropertyNames(t))n.push(r,function(e,t){return()=>e[t]}(e,r)),-1===o&&"default"===r&&(o=n.length-1);return r&&o>=0||(o>=0?n.splice(o,1,0,e):n.push("default",0,e)),d(t,n),t}function O(e){let t=B(e,this.m);if(t.namespaceObject)return t.namespaceObject;let r=t.exports;return t.namespaceObject=g(r,"function"==typeof r?function(...e){return r.apply(this,e)}:Object.create(null),r&&r.__esModule)}function w(e){let t=e.indexOf("#");-1!==t&&(e=e.substring(0,t));let r=e.indexOf("?");return -1!==r&&(e=e.substring(0,r)),e}function j(){let e,t;return{promise:new Promise((r,n)=>{t=n,e=r}),resolve:e,reject:t}}u.i=O,u.A=function(e){return this.r(e)(O.bind(this))},u.t="function"==typeof require?require:function(){throw Error("Unexpected use of runtime require")},u.r=function(e){return B(e,this.m).exports},u.f=function(e){function t(t){if(t=w(t),a.call(e,t))return e[t].module();let r=Error(`Cannot find module '${t}'`);throw r.code="MODULE_NOT_FOUND",r}return t.keys=()=>Object.keys(e),t.resolve=t=>{if(t=w(t),a.call(e,t))return e[t].id();let r=Error(`Cannot find module '${t}'`);throw r.code="MODULE_NOT_FOUND",r},t.import=async e=>await t(e),t};let k=Symbol("turbopack queues"),v=Symbol("turbopack exports"),U=Symbol("turbopack error");function C(e){e&&1!==e.status&&(e.status=1,e.forEach(e=>e.queueCount--),e.forEach(e=>e.queueCount--?e.queueCount++:e()))}u.a=function(e,t){let r=this.m,n=t?Object.assign([],{status:-1}):void 0,o=new Set,{resolve:i,reject:l,promise:s}=j(),u=Object.assign(s,{[v]:r.exports,[k]:e=>{n&&e(n),o.forEach(e),u.catch(()=>{})}}),a={get:()=>u,set(e){e!==u&&(u[v]=e)}};Object.defineProperty(r,"exports",a),Object.defineProperty(r,"namespaceObject",a),e(function(e){let t=e.map(e=>{if(null!==e&&"object"==typeof e){if(k in e)return e;if(null!=e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then){let t=Object.assign([],{status:0}),r={[v]:{},[k]:e=>e(t)};return e.then(e=>{r[v]=e,C(t)},e=>{r[U]=e,C(t)}),r}}return{[v]:e,[k]:()=>{}}}),r=()=>t.map(e=>{if(e[U])throw e[U];return e[v]}),{promise:i,resolve:l}=j(),s=Object.assign(()=>l(r),{queueCount:0});function u(e){e!==n&&!o.has(e)&&(o.add(e),e&&0===e.status&&(s.queueCount++,e.push(s)))}return t.map(e=>e[k](u)),s.queueCount?i:r()},function(e){e?l(u[U]=e):i(u[v]),C(n)}),n&&-1===n.status&&(n.status=0)};let P=function(e){let t=new URL(e,"x:/"),r={};for(let e in t)r[e]=t[e];for(let t in r.href=e,r.pathname=e.replace(/[?#].*/,""),r.origin=r.protocol="",r.toString=r.toJSON=(...t)=>e,r)Object.defineProperty(this,t,{enumerable:!0,configurable:!0,value:r[t]})};function R(e,t){throw Error(`Invariant: ${t(e)}`)}P.prototype=URL.prototype,u.U=P,u.z=function(e){throw Error("dynamic usage of require is not supported")},u.g=globalThis;let S=s.prototype,$=new Map;u.M=$;let _=new Map,E=new Map;async function T(e,t,r){let n;if("string"==typeof r)return M(e,t,q(r));let o=r.included||[],i=o.map(e=>!!$.has(e)||_.get(e));if(i.length>0&&i.every(e=>e))return void await Promise.all(i);let l=r.moduleChunks||[],s=l.map(e=>E.get(e)).filter(e=>e);if(s.length>0){if(s.length===l.length)return void await Promise.all(s);let r=new Set;for(let e of l)E.has(e)||r.add(e);for(let n of r){let r=M(e,t,q(n));E.set(n,r),s.push(r)}n=Promise.all(s)}else{for(let o of(n=M(e,t,q(r.path)),l))E.has(o)||E.set(o,n)}for(let e of o)_.has(e)||_.set(e,n);await n}S.l=function(e){return T(i.Parent,this.m.id,e)};let A=Promise.resolve(void 0),x=new WeakMap;function M(t,r,n){let o=e.loadChunkCached(t,n),l=x.get(o);if(void 0===l){let e=x.set.bind(x,o,A);l=o.then(e).catch(e=>{let o;switch(t){case i.Runtime:o=`as a runtime dependency of chunk ${r}`;break;case i.Parent:o=`from module ${r}`;break;case i.Update:o="from an HMR update";break;default:R(t,e=>`Unknown source type: ${e}`)}let l=Error(`Failed to load chunk ${n} ${o}${e?`: ${e}`:""}`,e?{cause:e}:void 0);throw l.name="ChunkLoadError",l}),x.set(o,l)}return l}function q(e){return`${t}${e.split("/").map(e=>encodeURIComponent(e)).join("/")}${r}`}S.L=function(e){return M(i.Parent,this.m.id,e)},S.R=function(e){let t=this.r(e);return t?.default??t},S.P=function(e){return`/ROOT/${e??""}`},S.q=function(e,t){m.call(this,`${e}${r}`,t)},S.b=function(e,t,o,i){let l="SharedWorker"===e.name,s=[o.map(e=>q(e)).reverse(),r];for(let e of n)s.push(globalThis[e]);let u=new URL(q(t),location.origin),a=JSON.stringify(s);return l?u.searchParams.set("params",a):u.hash="#params="+encodeURIComponent(a),new e(u,i?{...i,type:void 0}:void 0)};let N=/\.js(?:\?[^#]*)?(?:#.*)?$/,K=/\.css(?:\?[^#]*)?(?:#.*)?$/;function L(e){return K.test(e)}u.w=function(t,r,n){return e.loadWebAssembly(i.Parent,this.m.id,t,r,n)},u.u=function(t,r){return e.loadWebAssemblyModule(i.Parent,this.m.id,t,r)};let I={};u.c=I;let B=(e,t)=>{let r=I[e];if(r){if(r.error)throw r.error;return r}return W(e,i.Parent,t.id)};function W(e,t,r){let n=$.get(e);if("function"!=typeof n)throw Error(function(e,t,r){let n;switch(t){case 0:n=`as a runtime entry of chunk ${r}`;break;case 1:n=`because it was required from module ${r}`;break;case 2:n="because of an HMR update";break;default:R(t,e=>`Unknown source type: ${e}`)}return`Module ${e} was instantiated ${n}, but the module factory is not available.`}(e,t,r));let o=h(e),i=o.exports;I[e]=o;let l=new s(o,i);try{n(l,o,i)}catch(e){throw o.error=e,e}return o.namespaceObject&&o.exports!==o.namespaceObject&&g(o.exports,o.namespaceObject),o}function F(t){let r,n=function(e){if("string"==typeof e)return e;if(e)return{src:e.getAttribute("src")};if("u">typeof TURBOPACK_NEXT_CHUNK_URLS)return{src:TURBOPACK_NEXT_CHUNK_URLS.pop()};throw Error("chunk path empty but not in a worker")}(t[0]);return 2===t.length?r=t[1]:(r=void 0,!function(e,t){let r=1;for(;r<e.length;){let n,o=r+1;for(;o<e.length&&"function"!=typeof e[o];)o++;if(o===e.length)throw Error("malformed chunk format, expected a factory function");let i=e[o];for(let i=r;i<o;i++){let r=e[i],o=t.get(r);if(o){n=o;break}}let l=n??i,s=!1;for(let n=r;n<o;n++){let r=e[n];t.has(r)||(s||(l===i&&Object.defineProperty(i,"name",{value:"module evaluation"}),s=!0),t.set(r,l))}r=o+1}}(t,$)),e.registerChunk(n,r)}let X=new Map;function D(e){let t=X.get(e);if(!t){let r,n;t={resolved:!1,loadingStarted:!1,promise:new Promise((e,t)=>{r=e,n=t}),resolve:()=>{t.resolved=!0,r()},reject:n},X.set(e,t)}return t}e={async registerChunk(e,r){let n=function(e){if("string"==typeof e)return e;let r=decodeURIComponent(e.src.replace(/[?#].*$/,""));return r.startsWith(t)?r.slice(t.length):r}(e);if(D("string"==typeof e?q(e):e.src).resolve(),null!=r){for(let e of r.otherChunks)D(q("string"==typeof e?e:e.path));if(await Promise.all(r.otherChunks.map(e=>T(i.Runtime,n,e))),r.runtimeModuleIds.length>0)for(let e of r.runtimeModuleIds)!function(e,t){let r=I[t];if(r){if(r.error)throw r.error;return}W(t,i.Runtime,e)}(n,e)}},loadChunkCached:(e,t)=>(function(e,t){let r=D(t);if(r.loadingStarted)return r.promise;if(e===i.Runtime)return r.loadingStarted=!0,L(t)&&r.resolve(),r.promise;if("function"==typeof importScripts)if(L(t));else if(N.test(t))self.TURBOPACK_NEXT_CHUNK_URLS.push(t),importScripts(t);else throw Error(`can't infer type of chunk from URL ${t} in worker`);else{let e=decodeURI(t);if(L(t))if(document.querySelectorAll(`link[rel=stylesheet][href="${t}"],link[rel=stylesheet][href^="${t}?"],link[rel=stylesheet][href="${e}"],link[rel=stylesheet][href^="${e}?"]`).length>0)r.resolve();else{let e=document.createElement("link");e.rel="stylesheet",e.href=t,e.onerror=()=>{r.reject()},e.onload=()=>{r.resolve()},document.head.appendChild(e)}else if(N.test(t)){let n=document.querySelectorAll(`script[src="${t}"],script[src^="${t}?"],script[src="${e}"],script[src^="${e}?"]`);if(n.length>0)for(let e of Array.from(n))e.addEventListener("error",()=>{r.reject()});else{let e=document.createElement("script");e.src=t,e.onerror=()=>{r.reject()},document.head.appendChild(e)}}else throw Error(`can't infer type of chunk from URL ${t}`)}return r.loadingStarted=!0,r.promise})(e,t),async loadWebAssembly(e,t,r,n,o){let i=fetch(q(r)),{instance:l}=await WebAssembly.instantiateStreaming(i,o);return l.exports},async loadWebAssemblyModule(e,t,r,n){let o=fetch(q(r));return await WebAssembly.compileStreaming(o)}};let H=globalThis.TURBOPACK;globalThis.TURBOPACK={push:F},H.forEach(F)})();
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # larkup
2
2
 
3
+ ## 0.1.29
4
+
5
+ ### Patch Changes
6
+
7
+ - 19767f8: Fix isolated Marketplace tool loading in Docker, improve Video & Audio setup guidance, and reliably index PDF images.
8
+ - Updated dependencies [19767f8]
9
+ - @larkup/marketplace@0.1.5
10
+ - @larkup/tool-doc-editor@0.2.3
11
+ - @larkup/tool-video-audio@0.2.1
12
+
13
+ ## 0.1.28
14
+
15
+ ### Patch Changes
16
+
17
+ - c769d08: Retry marketplace installs against the latest published package when a stale catalog version is unavailable, and improve server and analytics UI behavior.
18
+ - Updated dependencies [c769d08]
19
+ - @larkup/marketplace@0.1.4
20
+ - @larkup/tool-doc-editor@0.2.3
21
+ - @larkup/tool-video-audio@0.2.1
22
+
3
23
  ## 0.1.27
4
24
 
5
25
  ### Patch Changes
@@ -50,10 +50,18 @@ async function describeImage(req: Request) {
50
50
  type: 'text',
51
51
  text: prompt || defaultPrompt,
52
52
  },
53
- ...images.map((image) => ({
54
- type: 'image' as const,
55
- image: image.startsWith('data:') ? image : `data:image/jpeg;base64,${image}`,
56
- })),
53
+ ...images.map((image) => {
54
+ const data = image.startsWith('data:') ? image : `data:image/jpeg;base64,${image}`;
55
+ const mediaType = data.match(/^data:([^;,]+)/)?.[1] || 'image/jpeg';
56
+ return {
57
+ // AI SDK 6 uses file parts for every binary attachment. The
58
+ // legacy `image` part emits a deprecation warning on every
59
+ // PDF/image analysis request.
60
+ type: 'file' as const,
61
+ mediaType,
62
+ data,
63
+ };
64
+ }),
57
65
  ],
58
66
  },
59
67
  ],
@@ -166,13 +166,6 @@ export function AnalyticsDashboard() {
166
166
  <Tabs value={activeTab} onValueChange={setActiveTab} className="space-y-4">
167
167
  <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
168
168
  <TabsList className="inline-flex bg-white/70 dark:bg-muted/70 h-9 items-center justify-center rounded-lg border border-border p-0.5 text-muted-foreground">
169
- <TabsTrigger
170
- value="overview"
171
- className="inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground"
172
- >
173
- <Activity className="size-3.5 mr-1.5" />
174
- Server Traffic
175
- </TabsTrigger>
176
169
  <TabsTrigger
177
170
  value="indexing"
178
171
  className="inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground"
@@ -187,6 +180,13 @@ export function AnalyticsDashboard() {
187
180
  <MessageSquare className="size-3.5 mr-1.5" />
188
181
  Chat Usage
189
182
  </TabsTrigger>
183
+ <TabsTrigger
184
+ value="overview"
185
+ className="inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground"
186
+ >
187
+ <Activity className="size-3.5 mr-1.5" />
188
+ Server Traffic
189
+ </TabsTrigger>
190
190
  </TabsList>
191
191
  <div className="flex items-center">
192
192
  <Select value={timeframe} onValueChange={(val) => val && setTimeframe(val)}>
@@ -304,6 +304,12 @@ export function MediaPanel({
304
304
  const videoAudioTool = toolsData?.tools?.find((t: any) => t.id === 'video-audio');
305
305
  const isToolInstalled = videoAudioTool?.status === 'installed';
306
306
  const enabledTools = configData?.config?.enabledTools;
307
+ const videoAudioConfig = configData?.config?.toolConfigs?.['video-audio'] ?? {};
308
+ const audioProvider =
309
+ typeof videoAudioConfig.audioProvider === 'string' ? videoAudioConfig.audioProvider : '';
310
+ const audioApiKey =
311
+ typeof videoAudioConfig.audioApiKey === 'string' ? videoAudioConfig.audioApiKey : '';
312
+ const audioConfigured = Boolean(audioProvider && (audioProvider === 'local' || audioApiKey));
307
313
  const isToolEnabled = enabledTools
308
314
  ? enabledTools.length === 0 || enabledTools.includes('video-audio')
309
315
  : true;
@@ -391,6 +397,8 @@ export function MediaPanel({
391
397
  mutate();
392
398
  onAdded();
393
399
  }}
400
+ audioConfigured={audioConfigured}
401
+ onConfigureAudio={() => router.push('/settings?section=tool-settings')}
394
402
  />
395
403
  )}
396
404
  </div>
@@ -428,7 +436,13 @@ function InstallPrompt({
428
436
  const err = await res.json();
429
437
  throw new Error(err.error || 'Install failed');
430
438
  }
431
- toast.success('Tool installed successfully');
439
+ toast.success('Video & Audio installed', {
440
+ description: 'Choose an audio provider before indexing video or audio.',
441
+ action: {
442
+ label: 'Set up audio',
443
+ onClick: () => window.location.assign('/settings?section=tool-settings'),
444
+ },
445
+ });
432
446
  onInstallComplete();
433
447
  } catch (err) {
434
448
  toast.error(err instanceof Error ? err.message : 'Failed to install tool');
@@ -509,6 +523,8 @@ function MediaContent({
509
523
  serverId,
510
524
  onMutate,
511
525
  onUploadComplete,
526
+ audioConfigured,
527
+ onConfigureAudio,
512
528
  }: {
513
529
  mediaType: 'image' | 'video' | 'audio';
514
530
  tab: MediaSubTab;
@@ -518,6 +534,8 @@ function MediaContent({
518
534
  serverId?: string;
519
535
  onMutate: () => void | Promise<unknown>;
520
536
  onUploadComplete: () => void;
537
+ audioConfigured: boolean;
538
+ onConfigureAudio: () => void;
521
539
  }) {
522
540
  const inputRef = useRef<HTMLInputElement>(null);
523
541
  const router = useRouter();
@@ -587,7 +605,8 @@ function MediaContent({
587
605
  if (
588
606
  msg.toLowerCase().includes('api key') ||
589
607
  msg.toLowerCase().includes('configuration') ||
590
- msg.toLowerCase().includes('missing provider')
608
+ msg.toLowerCase().includes('missing provider') ||
609
+ msg.toLowerCase().includes('choose an audio provider')
591
610
  ) {
592
611
  toast.error(msg, {
593
612
  duration: 10000,
@@ -601,6 +620,16 @@ function MediaContent({
601
620
  }
602
621
  }
603
622
 
623
+ function ensureAudioConfiguration(): boolean {
624
+ if (mediaType === 'image' || audioConfigured) return true;
625
+ toast.error('Set up an audio provider to index video or audio.', {
626
+ description: 'Select a provider and add its API key in Installed Tools.',
627
+ duration: 10_000,
628
+ action: { label: 'Set up audio', onClick: onConfigureAudio },
629
+ });
630
+ return false;
631
+ }
632
+
604
633
  async function processAssets(assetIds: string[]) {
605
634
  const PROCESS_BATCH_SIZE = 4;
606
635
  for (let i = 0; i < assetIds.length; i += PROCESS_BATCH_SIZE) {
@@ -635,6 +664,7 @@ function MediaContent({
635
664
  async function reviewRemoteEstimate() {
636
665
  const urls = parsedUrls();
637
666
  if (urls.length === 0) return;
667
+ if (!ensureAudioConfiguration()) return;
638
668
  setCheckingUrls(true);
639
669
  try {
640
670
  const res = await fetch(mediaApiUrl, {
@@ -655,6 +685,7 @@ function MediaContent({
655
685
  async function importRemoteUrls() {
656
686
  const urls = parsedUrls();
657
687
  if (urls.length === 0 || !remoteEstimates) return;
688
+ if (!ensureAudioConfiguration()) return;
658
689
  setImportingUrls(true);
659
690
  try {
660
691
  const res = await fetch(mediaApiUrl, {
@@ -681,6 +712,7 @@ function MediaContent({
681
712
 
682
713
  async function uploadAll() {
683
714
  if (staged.length === 0) return;
715
+ if (!ensureAudioConfiguration()) return;
684
716
  setUploading(true);
685
717
 
686
718
  const BATCH_SIZE = 5;
@@ -314,7 +314,7 @@ export function UploadPanel({ onAdded }: { onAdded: () => void }) {
314
314
 
315
315
  const res = await fetch(img.base64);
316
316
  const blob = await res.blob();
317
- const file = new File([blob], `image-${img.index}.png`, { type: 'image/png' });
317
+ const file = new File([blob], `image-${img.index}.jpg`, { type: 'image/jpeg' });
318
318
 
319
319
  const formData = new FormData();
320
320
  formData.append('file', file);
@@ -386,6 +386,7 @@ export function UploadPanel({ onAdded }: { onAdded: () => void }) {
386
386
  imageUrl: img.imageUrl,
387
387
  pageNumber: img.pageNumber,
388
388
  index: img.index,
389
+ description: img.description,
389
390
  })),
390
391
  }
391
392
  : undefined,
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { useState, useCallback, useMemo } from 'react';
4
4
  import useSWR from 'swr';
5
+ import { useRouter } from 'next/navigation';
5
6
  import {
6
7
  Download,
7
8
  Trash2,
@@ -88,6 +89,7 @@ const fetcher = (url: string) =>
88
89
  fetch(url).then((r) => r.json() as Promise<{ tools: MarketplaceTool[] }>);
89
90
 
90
91
  export function MarketplaceSection() {
92
+ const router = useRouter();
91
93
  const { data, isLoading, mutate } = useSWR('/api/marketplace', fetcher);
92
94
  const [installing, setInstalling] = useState<string | null>(null);
93
95
  const [searchQuery, setSearchQuery] = useState('');
@@ -104,7 +106,17 @@ export function MarketplaceSection() {
104
106
  const err = await res.json();
105
107
  throw new Error(err.error || 'Install failed');
106
108
  }
107
- toast.success('Tool installed successfully');
109
+ if (toolId === 'video-audio') {
110
+ toast.success('Video & Audio installed', {
111
+ description: 'Choose an audio provider before you index media.',
112
+ action: {
113
+ label: 'Set up audio',
114
+ onClick: () => router.push('/settings?section=tool-settings'),
115
+ },
116
+ });
117
+ } else {
118
+ toast.success('Tool installed successfully');
119
+ }
108
120
  mutate();
109
121
  } catch (err) {
110
122
  toast.error(err instanceof Error ? err.message : 'Failed to install tool');
@@ -112,7 +124,7 @@ export function MarketplaceSection() {
112
124
  setInstalling(null);
113
125
  }
114
126
  },
115
- [mutate],
127
+ [mutate, router],
116
128
  );
117
129
 
118
130
  const handleUninstall = useCallback(
@@ -432,18 +432,18 @@ export function ServerSection() {
432
432
  </div>
433
433
  </DialogContent>
434
434
  </Dialog>
435
- <a
436
- href={apiReferenceUrl(state.endpoint)}
437
- target="_blank"
438
- rel="noreferrer"
439
- className={cn(
440
- buttonVariants({ variant: 'outline', size: 'sm' }),
441
- 'h-8 gap-1.5 text-xs',
442
- )}
435
+ <Button
436
+ variant="outline"
437
+ size="sm"
438
+ disabled={busy === 'start' || !state.running}
439
+ render={
440
+ <a href={apiReferenceUrl(state.endpoint)} target="_blank" rel="noreferrer" />
441
+ }
442
+ className="h-8 gap-1.5 text-xs"
443
443
  >
444
444
  <ExternalLink className="size-3" />
445
445
  API reference
446
- </a>
446
+ </Button>
447
447
  </div>
448
448
  <Button
449
449
  size="sm"
package/lib/pdf-images.ts CHANGED
@@ -10,6 +10,22 @@ export async function extractImagesFromPDF(
10
10
  const numPages = pdf.numPages;
11
11
  const images: { base64: string; pageNumber: number; index: number }[] = [];
12
12
 
13
+ let imageIndex = 0;
14
+ const toDataUrl = (source: HTMLCanvasElement) => {
15
+ // Embedded PDF artwork can be several thousand pixels wide. Vision models
16
+ // do not need the raw print-resolution asset and sending it makes PDF
17
+ // ingestion slow and unreliable. Preserve diagrams while bounding input.
18
+ const maxDimension = 1_600;
19
+ const scale = Math.min(1, maxDimension / Math.max(source.width, source.height));
20
+ if (scale === 1) return source.toDataURL('image/jpeg', 0.86);
21
+
22
+ const resized = document.createElement('canvas');
23
+ resized.width = Math.max(1, Math.round(source.width * scale));
24
+ resized.height = Math.max(1, Math.round(source.height * scale));
25
+ resized.getContext('2d')?.drawImage(source, 0, 0, resized.width, resized.height);
26
+ return resized.toDataURL('image/jpeg', 0.86);
27
+ };
28
+
13
29
  for (let i = 1; i <= numPages; i++) {
14
30
  try {
15
31
  const page = await pdf.getPage(i);
@@ -25,7 +41,6 @@ export async function extractImagesFromPDF(
25
41
  }
26
42
  }
27
43
 
28
- let imgIndex = 0;
29
44
  for (const objId of imageOps) {
30
45
  try {
31
46
  const img = await new Promise<any>((resolve) => {
@@ -43,9 +58,9 @@ export async function extractImagesFromPDF(
43
58
  if (ctx) {
44
59
  ctx.drawImage(img.bitmap, 0, 0);
45
60
  images.push({
46
- base64: canvas.toDataURL('image/png'),
61
+ base64: toDataUrl(canvas),
47
62
  pageNumber: i,
48
- index: imgIndex++,
63
+ index: imageIndex++,
49
64
  });
50
65
  }
51
66
  } else if (img && img.data && img.width && img.height) {
@@ -61,9 +76,9 @@ export async function extractImagesFromPDF(
61
76
  );
62
77
  ctx.putImageData(imageData, 0, 0);
63
78
  images.push({
64
- base64: canvas.toDataURL('image/png'),
79
+ base64: toDataUrl(canvas),
65
80
  pageNumber: i,
66
- index: imgIndex++,
81
+ index: imageIndex++,
67
82
  });
68
83
  }
69
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "larkup",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "larkup": "./bin/larkup.js"
@@ -53,13 +53,13 @@
53
53
  "xlsx": "^0.18.5",
54
54
  "zod": "^4.4.3",
55
55
  "zustand": "^5.0.14",
56
+ "@larkup/marketplace": "0.1.5",
56
57
  "@larkup/core": "0.2.2",
57
58
  "@larkup/sandbox": "0.1.2",
58
- "@larkup/marketplace": "0.1.3",
59
- "@larkup/scraper": "0.1.23",
60
- "@larkup/tool-doc-editor": "0.2.3",
61
59
  "@larkup/vector-stores": "0.1.22",
62
- "@larkup/tool-video-audio": "0.2.1"
60
+ "@larkup/tool-video-audio": "0.2.1",
61
+ "@larkup/scraper": "0.1.23",
62
+ "@larkup/tool-doc-editor": "0.2.3"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@tailwindcss/postcss": "^4.2.0",