@tablestore/tablestore-agent-cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/kb/create.d.ts.map +1 -1
- package/dist/commands/kb/create.js +21 -0
- package/dist/commands/kb/create.js.map +1 -1
- package/dist/commands/kb/retrieve.d.ts.map +1 -1
- package/dist/commands/kb/retrieve.js +3 -3
- package/dist/commands/kb/retrieve.js.map +1 -1
- package/dist/dashboard-runtime/dashboard/.next/BUILD_ID +1 -1
- package/dist/dashboard-runtime/dashboard/.next/app-path-routes-manifest.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/build-manifest.json +5 -5
- package/dist/dashboard-runtime/dashboard/.next/prerender-manifest.json +3 -3
- package/dist/dashboard-runtime/dashboard/.next/routes-manifest.json +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.rsc +14 -14
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/status/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/token/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/token/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/use/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/chunks/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/chunks/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/upload/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/retrieve/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/chat/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/models/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/test/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/logs/client/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/messages/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/requests/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/search/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/[memoryId]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/runtime/context/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.rsc +14 -14
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_head.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_index.segment.rsc +10 -10
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.rsc +17 -17
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_full.segment.rsc +17 -17
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_head.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_index.segment.rsc +10 -10
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding.segment.rsc +4 -4
- package/dist/dashboard-runtime/dashboard/.next/server/app/page/build-manifest.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app-paths-manifest.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0n~ec7s.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0cee_lo._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0lvi0g-._.js +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0q8vcw8._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/dashboard__next-internal_server_app_api_v1_oss_list_route_actions_00xq2u..js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0b1r_app_(dashboard)_knowledge-base_[name]_documents_documents-client_tsx_0g2uxmt._.js +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0e95_src_app_(dashboard)_knowledge-base_[name]_settings_settings-client_tsx_13312zk._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0aqzu8w._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0hozzu6._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0jb9ccl._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__13ylf4x._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_02bg849._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_09yzbcp._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0db498n._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0jghj2_._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0kd7szs._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0n4gd_6._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0ogxvev._.js +7 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0tr8-3u._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0xzh5yw._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_12~3vfk._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_13_lb.o._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_065m1.j._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0ejgygh._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0y49vhd._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_10dsqx~._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_knowledge-base_create_page_tsx_0916~g-._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_0ls1exu._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_0ugdjlb._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_ui_0-tuf-h._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_08h.f_8._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0jns_ph._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0pf30rh._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0~k~1nt._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/functions-config-manifest.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/middleware-build-manifest.js +5 -5
- package/dist/dashboard-runtime/dashboard/.next/server/pages/404.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/pages/500.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/00tz~p479bdgl.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/02i9olo-312mq.js +138 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/062k9jbtd9.lv.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/06uuhz24tvdt..js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/07cp19da_kfld.js +5 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/086esp1n941jl.js +138 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/08qlxn-3d_rtu.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/09uxq~55qug8c.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0__g1ogrdh412.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ab-ev0u1~ch5.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0bw682qzkh2ni.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0d29.l~3ip181.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ewpzgu_qf0wf.js +4 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jc31diex030o.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k79upjc40aky.css +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0lp2g_27uyhuz.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0snnsfosp3~gq.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0tmwptel_4y0o.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u9wtl06_b72x.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0uv55p7kzteex.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0v9d5wl9nsva3.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0xko7~ja3xuc-.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/14.dp0-y_mhjo.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/15wxh8ltqt88_.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/183~u3-4a74db.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{turbopack-0ybyy.9-.w~ub.js → turbopack-0w.hw6u8qra5z.js} +1 -1
- package/dist/dashboard-runtime/dashboard/package.json +1 -0
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/knowledge-base/[name]/settings/settings-client.tsx +1 -1
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/knowledge-bases/[name]/documents/route.ts +44 -3
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/oss/list/route.ts +125 -0
- package/dist/dashboard-runtime/dashboard/src/app/globals.css +46 -31
- package/dist/dashboard-runtime/dashboard/src/components/chat/add-mount-row.tsx +21 -55
- package/dist/dashboard-runtime/dashboard/src/components/chat/chat-mount-config.tsx +35 -27
- package/dist/dashboard-runtime/dashboard/src/components/chat/mount-empty-state.tsx +87 -0
- package/dist/dashboard-runtime/dashboard/src/components/chat/mount-picker.tsx +87 -0
- package/dist/dashboard-runtime/dashboard/src/components/chat/unified-retrieval-section.tsx +3 -2
- package/dist/dashboard-runtime/dashboard/src/components/documents/doc-upload-dialog.tsx +155 -54
- package/dist/dashboard-runtime/dashboard/src/components/documents/oss-browser.tsx +264 -0
- package/dist/dashboard-runtime/dashboard/src/components/documents/oss-import-tab.tsx +143 -0
- package/dist/dashboard-runtime/dashboard/src/components/instance/connect-instance-form.tsx +60 -60
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-create-form.tsx +52 -35
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-settings-form.tsx +152 -76
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/knowledge-base-retrieval-config.ts +110 -0
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/retrieval-result-count-field.tsx +106 -0
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/retrieval-result-count.ts +11 -0
- package/dist/dashboard-runtime/dashboard/src/components/layout/detail-sidebar.tsx +84 -4
- package/dist/dashboard-runtime/dashboard/src/components/retrieval/assemble-retrieval-configuration.ts +22 -3
- package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-form.tsx +10 -3
- package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-params-fields.tsx +114 -56
- package/dist/dashboard-runtime/dashboard/src/hooks/use-detail-sidebar-collapsed.ts +86 -0
- package/dist/dashboard-runtime/dashboard/src/hooks/use-oss-import.ts +148 -0
- package/dist/dashboard-runtime/dashboard/src/hooks/use-oss-list.ts +89 -0
- package/dist/dashboard-runtime/dashboard/src/lib/extension-filter.ts +62 -0
- package/dist/dashboard-runtime/dashboard/src/lib/glob-filter.ts +76 -0
- package/dist/dashboard-runtime/dashboard/src/lib/oss-selection.ts +58 -0
- package/dist/dashboard-runtime/dashboard/src/lib/server/oss-client.ts +65 -0
- package/dist/dashboard-runtime/dashboard/src/schemas/knowledge-base.ts +3 -3
- package/dist/dashboard-runtime/dashboard/src/schemas/llm-chat.ts +1 -1
- package/dist/dashboard-runtime/dashboard/src/schemas/retrieval.ts +4 -1
- package/dist/dashboard-runtime/dashboard/src/services/api-client.ts +11 -6
- package/dist/dashboard-runtime/dashboard/src/services/documents.ts +27 -8
- package/dist/dashboard-runtime/dashboard/src/services/oss.ts +36 -0
- package/dist/dashboard-runtime/dashboard/src/types/knowledge-base.ts +1 -1
- package/dist/dashboard-runtime/dashboard/vitest.config.mjs +6 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0lvo_@radix-ui_react-popper_dist_index_mjs_13rqw99._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0id.4_g._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0p7j-9i._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0.1szyw._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0251rsp._.js +0 -7
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_038vjn1._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_06tznmj._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_09y~hs8._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0_ow0x1._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0t373jc._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_12guzbo._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0jns2ew._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0aw_rgu._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0ld4qfm._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_125b4co._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0-ov0wxgu5b65.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/00-qnlax_4630.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/034uozc1ki09_.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/03zdsc.dicedw.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/05hmbxh7h5ct-.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/08tdws.ontiw1.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0azwigiwuhh08.css +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0b54rtt1-cxht.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0cdo38.8y_jr2.js +0 -138
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0cy.fvgx7dgqx.js +0 -4
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0fa.nak91jfo-.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0fv6q06wgazh_.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0g9y74cipd10n.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ga6neugwmh.1.js +0 -5
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0hkir82jccgck.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k-x6_7dhqb~c.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0n42fh.zwyk35.js +0 -138
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0q6lk_p74rti7.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u39cc6mmeqb3.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0uay29z9qqouw.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0v0e.nl_9fjba.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0wd0_x8u.jzur.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0wf-nssu2qd_2.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0x7pw1zo7nxno.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0zbi5n76awxz1.js +0 -1
- /package/dist/dashboard-runtime/dashboard/.next/static/{uYteIiFtKdPhUhmILps5X → doYIl-pd6Sqax3bfUgN3q}/_buildManifest.js +0 -0
- /package/dist/dashboard-runtime/dashboard/.next/static/{uYteIiFtKdPhUhmILps5X → doYIl-pd6Sqax3bfUgN3q}/_clientMiddlewareManifest.js +0 -0
- /package/dist/dashboard-runtime/dashboard/.next/static/{uYteIiFtKdPhUhmILps5X → doYIl-pd6Sqax3bfUgN3q}/_ssgManifest.js +0 -0
|
@@ -24,14 +24,33 @@ export function assembleRetrievalConfiguration(
|
|
|
24
24
|
v: Partial<RetrievalInput>,
|
|
25
25
|
topK: number | undefined,
|
|
26
26
|
): RetrievalConfiguration | undefined {
|
|
27
|
-
const
|
|
27
|
+
const denseTopK = getResultCount(v.denseTopK, v.topK, topK);
|
|
28
|
+
const fullTextTopK = getResultCount(v.fullTextTopK, v.topK, topK);
|
|
29
|
+
const rerankTopK = getResultCount(v.rerankTopK, v.topK, topK);
|
|
30
|
+
const reranking = buildRerankingConfiguration(v, rerankTopK);
|
|
28
31
|
const config: RetrievalConfiguration = {};
|
|
29
32
|
if (v.searchType?.length) config.searchType = v.searchType;
|
|
30
|
-
if (
|
|
33
|
+
if (denseTopK !== undefined) {
|
|
34
|
+
config.denseVectorSearchConfiguration = { numberOfResults: denseTopK };
|
|
35
|
+
}
|
|
36
|
+
if (fullTextTopK !== undefined) {
|
|
37
|
+
config.fullTextSearchConfiguration = { numberOfResults: fullTextTopK };
|
|
38
|
+
}
|
|
31
39
|
if (reranking) config.rerankingConfiguration = reranking;
|
|
32
40
|
return Object.keys(config).length > 0 ? config : undefined;
|
|
33
41
|
}
|
|
34
42
|
|
|
43
|
+
function getResultCount(
|
|
44
|
+
primary: number | undefined,
|
|
45
|
+
legacyTopK: number | undefined,
|
|
46
|
+
fallbackTopK: number | undefined,
|
|
47
|
+
): number | undefined {
|
|
48
|
+
if (typeof primary === "number") return primary;
|
|
49
|
+
if (typeof legacyTopK === "number") return legacyTopK;
|
|
50
|
+
if (typeof fallbackTopK === "number") return fallbackTopK;
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
35
54
|
/** Build the nested `rerankingConfiguration` sub-object from flat form fields. */
|
|
36
55
|
function buildRerankingConfiguration(
|
|
37
56
|
v: Partial<RetrievalInput>,
|
|
@@ -40,8 +59,8 @@ function buildRerankingConfiguration(
|
|
|
40
59
|
if (!v.rerankType) return undefined;
|
|
41
60
|
const base: RerankingConfiguration = {
|
|
42
61
|
type: v.rerankType,
|
|
43
|
-
numberOfResults: topK,
|
|
44
62
|
};
|
|
63
|
+
if (topK !== undefined) base.numberOfResults = topK;
|
|
45
64
|
if (v.rerankType === "RRF") {
|
|
46
65
|
base.rrfConfiguration = {
|
|
47
66
|
k: v.rrfK,
|
|
@@ -56,7 +56,7 @@ export function assembleRetrievalRequest(
|
|
|
56
56
|
v: RetrievalInput,
|
|
57
57
|
filter: Record<string, unknown> | undefined,
|
|
58
58
|
): RetrievalRequest {
|
|
59
|
-
const config = assembleRetrievalConfiguration(v,
|
|
59
|
+
const config = assembleRetrievalConfiguration(v, undefined) ?? {};
|
|
60
60
|
if (filter) config.filter = filter;
|
|
61
61
|
|
|
62
62
|
const req: RetrievalRequest = {
|
|
@@ -79,6 +79,8 @@ export function retrievalDefaultsFromKB(
|
|
|
79
79
|
): RetrievalInput {
|
|
80
80
|
const kbSearchType = knowledgeBase?.retrievalConfiguration?.searchType ?? ["DENSE_VECTOR"];
|
|
81
81
|
const kbRerank = knowledgeBase?.retrievalConfiguration?.rerankingConfiguration;
|
|
82
|
+
const kbDense = knowledgeBase?.retrievalConfiguration?.denseVectorSearchConfiguration;
|
|
83
|
+
const kbFullText = knowledgeBase?.retrievalConfiguration?.fullTextSearchConfiguration;
|
|
82
84
|
const kbRrf = kbRerank?.rrfConfiguration;
|
|
83
85
|
const kbWeight = kbRerank?.weightConfiguration;
|
|
84
86
|
const kbModel = kbRerank?.modelConfiguration;
|
|
@@ -92,13 +94,18 @@ export function retrievalDefaultsFromKB(
|
|
|
92
94
|
: kbRerank?.type === "MODEL"
|
|
93
95
|
? "MODEL"
|
|
94
96
|
: "WEIGHT";
|
|
95
|
-
const
|
|
97
|
+
const kbDenseTopK = kbDense?.numberOfResults ?? kbRerank?.numberOfResults ?? 20;
|
|
98
|
+
const kbFullTextTopK = kbFullText?.numberOfResults ?? kbRerank?.numberOfResults ?? 20;
|
|
99
|
+
const kbRerankTopK = kbRerank?.numberOfResults ?? 20;
|
|
96
100
|
|
|
97
101
|
return {
|
|
98
102
|
knowledgeBaseName,
|
|
99
103
|
query: "",
|
|
100
104
|
subspace: [],
|
|
101
|
-
topK:
|
|
105
|
+
topK: kbRerankTopK,
|
|
106
|
+
denseTopK: kbDenseTopK,
|
|
107
|
+
fullTextTopK: kbFullTextTopK,
|
|
108
|
+
rerankTopK: kbRerankTopK,
|
|
102
109
|
searchType: kbSearchType,
|
|
103
110
|
rerankType: kbRerankType,
|
|
104
111
|
rrfK: kbRrf?.k ?? 60,
|
package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-params-fields.tsx
CHANGED
|
@@ -4,7 +4,6 @@ import { useEffect, useRef } from "react";
|
|
|
4
4
|
import type { UseFormReturn } from "react-hook-form";
|
|
5
5
|
import { Check, ChevronDown, HelpCircle, Info } from "lucide-react";
|
|
6
6
|
|
|
7
|
-
import { Input } from "@/components/ui/input";
|
|
8
7
|
import { Button } from "@/components/ui/button";
|
|
9
8
|
import { useSubspaceOptional } from "@/contexts/subspace-context";
|
|
10
9
|
import {
|
|
@@ -27,6 +26,7 @@ import {
|
|
|
27
26
|
TooltipTrigger,
|
|
28
27
|
} from "@/components/ui/tooltip";
|
|
29
28
|
import { TagInput } from "@/components/shared/tag-input";
|
|
29
|
+
import { RetrievalResultCountField } from "@/components/knowledge-base/retrieval-result-count-field";
|
|
30
30
|
import { FilterBuilder, type FilterBuilderHandle } from "./filter-builder";
|
|
31
31
|
import { RetrievalRerankFields } from "./retrieval-rerank-fields";
|
|
32
32
|
import type { RetrievalInput } from "@/schemas/retrieval";
|
|
@@ -58,6 +58,7 @@ export interface RetrievalParamsFieldsProps {
|
|
|
58
58
|
* label. Used for verbose explanations that would otherwise wrap the
|
|
59
59
|
* label across multiple lines and break left/right column alignment. */
|
|
60
60
|
topKHint?: string;
|
|
61
|
+
topKMode?: "split" | "single";
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
export function RetrievalParamsFields({
|
|
@@ -66,11 +67,13 @@ export function RetrievalParamsFields({
|
|
|
66
67
|
filterRef,
|
|
67
68
|
topKLabel = "返回数量",
|
|
68
69
|
topKHint,
|
|
70
|
+
topKMode = "split",
|
|
69
71
|
}: RetrievalParamsFieldsProps) {
|
|
70
72
|
const currentSearchType = form.watch("searchType");
|
|
73
|
+
const denseEnabled = !!currentSearchType?.includes("DENSE_VECTOR");
|
|
74
|
+
const fullTextEnabled = !!currentSearchType?.includes("FULL_TEXT");
|
|
71
75
|
const hybrid =
|
|
72
|
-
|
|
73
|
-
!!currentSearchType?.includes("FULL_TEXT");
|
|
76
|
+
denseEnabled && fullTextEnabled;
|
|
74
77
|
const metadataFields = knowledgeBase?.metadata ?? [];
|
|
75
78
|
|
|
76
79
|
// Pre-fill the subspace field with the active scope, but only once per
|
|
@@ -114,59 +117,14 @@ export function RetrievalParamsFields({
|
|
|
114
117
|
/>
|
|
115
118
|
)}
|
|
116
119
|
|
|
117
|
-
<div className="grid gap-4 sm:grid-cols-2">
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
{topKHint ? (
|
|
126
|
-
<TooltipProvider delayDuration={150}>
|
|
127
|
-
<Tooltip>
|
|
128
|
-
<TooltipTrigger asChild>
|
|
129
|
-
<button
|
|
130
|
-
type="button"
|
|
131
|
-
tabIndex={-1}
|
|
132
|
-
aria-label="字段说明"
|
|
133
|
-
className="inline-flex h-5 w-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-[hsl(var(--muted))] hover:text-foreground"
|
|
134
|
-
>
|
|
135
|
-
<HelpCircle className="h-3.5 w-3.5" />
|
|
136
|
-
</button>
|
|
137
|
-
</TooltipTrigger>
|
|
138
|
-
<TooltipContent
|
|
139
|
-
side="top"
|
|
140
|
-
sideOffset={6}
|
|
141
|
-
className="z-[60] max-w-[240px] border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-3 py-2 text-xs leading-relaxed text-[hsl(var(--popover-foreground))] shadow-md"
|
|
142
|
-
>
|
|
143
|
-
{topKHint}
|
|
144
|
-
</TooltipContent>
|
|
145
|
-
</Tooltip>
|
|
146
|
-
</TooltipProvider>
|
|
147
|
-
) : null}
|
|
148
|
-
</div>
|
|
149
|
-
<FormControl>
|
|
150
|
-
<Input
|
|
151
|
-
type="number"
|
|
152
|
-
min={1}
|
|
153
|
-
max={100}
|
|
154
|
-
className="h-9"
|
|
155
|
-
{...field}
|
|
156
|
-
onChange={(event) =>
|
|
157
|
-
field.onChange(
|
|
158
|
-
event.target.value
|
|
159
|
-
? Number(event.target.value)
|
|
160
|
-
: undefined,
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
/>
|
|
164
|
-
</FormControl>
|
|
165
|
-
<FormMessage />
|
|
166
|
-
</FormItem>
|
|
167
|
-
)}
|
|
168
|
-
/>
|
|
169
|
-
|
|
120
|
+
<div className={topKMode === "single" ? "grid gap-4 sm:grid-cols-2" : "space-y-4"}>
|
|
121
|
+
{topKMode === "single" ? (
|
|
122
|
+
<TopKNumberField
|
|
123
|
+
form={form}
|
|
124
|
+
label={topKLabel}
|
|
125
|
+
hint={topKHint}
|
|
126
|
+
/>
|
|
127
|
+
) : null}
|
|
170
128
|
<FormField
|
|
171
129
|
control={form.control}
|
|
172
130
|
name="searchType"
|
|
@@ -202,6 +160,44 @@ export function RetrievalParamsFields({
|
|
|
202
160
|
/>
|
|
203
161
|
</div>
|
|
204
162
|
|
|
163
|
+
{topKMode === "split" ? (
|
|
164
|
+
<div className="space-y-3">
|
|
165
|
+
<div className="space-y-1">
|
|
166
|
+
<p className="text-sm font-medium text-[hsl(var(--foreground))]">
|
|
167
|
+
返回数量
|
|
168
|
+
</p>
|
|
169
|
+
<p className="text-xs text-[hsl(var(--muted-foreground))]">
|
|
170
|
+
控制每路召回参与排序的候选数,以及 Rerank 后实际返回的片段数。
|
|
171
|
+
</p>
|
|
172
|
+
</div>
|
|
173
|
+
<div className="grid grid-cols-[repeat(auto-fit,minmax(min(260px,100%),1fr))] gap-3">
|
|
174
|
+
<RetrievalResultCountField
|
|
175
|
+
control={form.control}
|
|
176
|
+
name="denseTopK"
|
|
177
|
+
label="向量召回数"
|
|
178
|
+
description="向量检索参与后续排序的候选片段数。"
|
|
179
|
+
max={100}
|
|
180
|
+
muted={!denseEnabled}
|
|
181
|
+
/>
|
|
182
|
+
<RetrievalResultCountField
|
|
183
|
+
control={form.control}
|
|
184
|
+
name="fullTextTopK"
|
|
185
|
+
label="全文召回数"
|
|
186
|
+
description="全文检索参与后续排序的候选片段数。"
|
|
187
|
+
max={100}
|
|
188
|
+
muted={!fullTextEnabled}
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
<RetrievalResultCountField
|
|
192
|
+
control={form.control}
|
|
193
|
+
name="rerankTopK"
|
|
194
|
+
label="重排序返回数"
|
|
195
|
+
description="Rerank 后保留并返回的片段数。"
|
|
196
|
+
max={200}
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
) : null}
|
|
200
|
+
|
|
205
201
|
<div className="space-y-2">
|
|
206
202
|
<FormField
|
|
207
203
|
control={form.control}
|
|
@@ -279,3 +275,65 @@ export function RetrievalParamsFields({
|
|
|
279
275
|
</>
|
|
280
276
|
);
|
|
281
277
|
}
|
|
278
|
+
|
|
279
|
+
function TopKNumberField({
|
|
280
|
+
form,
|
|
281
|
+
label,
|
|
282
|
+
hint,
|
|
283
|
+
}: {
|
|
284
|
+
form: UseFormReturn<RetrievalInput>;
|
|
285
|
+
label: string;
|
|
286
|
+
hint?: string;
|
|
287
|
+
}) {
|
|
288
|
+
return (
|
|
289
|
+
<FormField
|
|
290
|
+
control={form.control}
|
|
291
|
+
name="topK"
|
|
292
|
+
render={({ field }) => (
|
|
293
|
+
<FormItem className="space-y-1.5">
|
|
294
|
+
<div className="flex items-center gap-1">
|
|
295
|
+
<FormLabel className="leading-tight">{label}</FormLabel>
|
|
296
|
+
{hint ? (
|
|
297
|
+
<TooltipProvider delayDuration={150}>
|
|
298
|
+
<Tooltip>
|
|
299
|
+
<TooltipTrigger asChild>
|
|
300
|
+
<button
|
|
301
|
+
type="button"
|
|
302
|
+
tabIndex={-1}
|
|
303
|
+
aria-label="字段说明"
|
|
304
|
+
className="inline-flex h-5 w-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-[hsl(var(--muted))] hover:text-foreground"
|
|
305
|
+
>
|
|
306
|
+
<HelpCircle className="h-3.5 w-3.5" />
|
|
307
|
+
</button>
|
|
308
|
+
</TooltipTrigger>
|
|
309
|
+
<TooltipContent
|
|
310
|
+
side="top"
|
|
311
|
+
sideOffset={6}
|
|
312
|
+
className="z-[60] max-w-[240px] border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-3 py-2 text-xs leading-relaxed text-[hsl(var(--popover-foreground))] shadow-md"
|
|
313
|
+
>
|
|
314
|
+
{hint}
|
|
315
|
+
</TooltipContent>
|
|
316
|
+
</Tooltip>
|
|
317
|
+
</TooltipProvider>
|
|
318
|
+
) : null}
|
|
319
|
+
</div>
|
|
320
|
+
<FormControl>
|
|
321
|
+
<input
|
|
322
|
+
type="number"
|
|
323
|
+
min={0}
|
|
324
|
+
max={100}
|
|
325
|
+
className="flex h-9 w-full rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-3 py-1 text-sm transition-colors focus-visible:border-[hsl(var(--primary))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--primary)/0.2)]"
|
|
326
|
+
{...field}
|
|
327
|
+
onChange={(event) =>
|
|
328
|
+
field.onChange(
|
|
329
|
+
event.target.value ? Number(event.target.value) : undefined,
|
|
330
|
+
)
|
|
331
|
+
}
|
|
332
|
+
/>
|
|
333
|
+
</FormControl>
|
|
334
|
+
<FormMessage />
|
|
335
|
+
</FormItem>
|
|
336
|
+
)}
|
|
337
|
+
/>
|
|
338
|
+
);
|
|
339
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Mirror of {@link useSidebarCollapsed} for the *secondary* (detail-page)
|
|
7
|
+
* sidebar. Same persistence + cross-instance + cross-tab sync pattern, with
|
|
8
|
+
* a separate localStorage key so the two sidebars collapse independently.
|
|
9
|
+
*
|
|
10
|
+
* The reason for two hooks rather than one with a key parameter: each
|
|
11
|
+
* useSyncExternalStore needs a stable subscribe / snapshot pair, and a
|
|
12
|
+
* single subscribe shared between two state slots would notify all
|
|
13
|
+
* consumers on every change. Splitting keeps the dependency graph clean
|
|
14
|
+
* and avoids the "primary toggle re-renders every detail page" gotcha.
|
|
15
|
+
*/
|
|
16
|
+
const STORAGE_KEY = "detail-sidebar.collapsed";
|
|
17
|
+
const EVENT_NAME = "detail-sidebar-collapsed-change";
|
|
18
|
+
|
|
19
|
+
let cachedValue: boolean | null = null;
|
|
20
|
+
|
|
21
|
+
function readFromStorage(): boolean {
|
|
22
|
+
if (cachedValue !== null) return cachedValue;
|
|
23
|
+
if (typeof window === "undefined") {
|
|
24
|
+
cachedValue = false;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
cachedValue = window.localStorage.getItem(STORAGE_KEY) === "1";
|
|
29
|
+
} catch {
|
|
30
|
+
cachedValue = false;
|
|
31
|
+
}
|
|
32
|
+
return cachedValue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function subscribe(notify: () => void): () => void {
|
|
36
|
+
if (typeof window === "undefined") return () => {};
|
|
37
|
+
const handler = (event: Event) => {
|
|
38
|
+
const detail = (event as CustomEvent<boolean>).detail;
|
|
39
|
+
cachedValue = Boolean(detail);
|
|
40
|
+
notify();
|
|
41
|
+
};
|
|
42
|
+
const onStorage = (event: StorageEvent) => {
|
|
43
|
+
if (event.key !== STORAGE_KEY) return;
|
|
44
|
+
cachedValue = event.newValue === "1";
|
|
45
|
+
notify();
|
|
46
|
+
};
|
|
47
|
+
window.addEventListener(EVENT_NAME, handler as EventListener);
|
|
48
|
+
window.addEventListener("storage", onStorage);
|
|
49
|
+
return () => {
|
|
50
|
+
window.removeEventListener(EVENT_NAME, handler as EventListener);
|
|
51
|
+
window.removeEventListener("storage", onStorage);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function getSnapshot(): boolean {
|
|
56
|
+
return readFromStorage();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// During SSR the detail sidebar starts expanded; hydration reconciles.
|
|
60
|
+
function getServerSnapshot(): boolean {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function useDetailSidebarCollapsed() {
|
|
65
|
+
const collapsed = useSyncExternalStore(
|
|
66
|
+
subscribe,
|
|
67
|
+
getSnapshot,
|
|
68
|
+
getServerSnapshot,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const setCollapsed = useCallback((next: boolean) => {
|
|
72
|
+
cachedValue = next;
|
|
73
|
+
try {
|
|
74
|
+
window.localStorage.setItem(STORAGE_KEY, next ? "1" : "0");
|
|
75
|
+
} catch {
|
|
76
|
+
// Ignore — private mode / quota / etc.
|
|
77
|
+
}
|
|
78
|
+
window.dispatchEvent(new CustomEvent(EVENT_NAME, { detail: next }));
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
81
|
+
const toggle = useCallback(() => {
|
|
82
|
+
setCollapsed(!readFromStorage());
|
|
83
|
+
}, [setCollapsed]);
|
|
84
|
+
|
|
85
|
+
return { collapsed, setCollapsed, toggle };
|
|
86
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
addDocuments,
|
|
6
|
+
UPLOAD_TIMEOUT_MS,
|
|
7
|
+
type AddDocumentItem,
|
|
8
|
+
type DocumentOperationResult,
|
|
9
|
+
} from "@/services/documents";
|
|
10
|
+
import { invalidateKnowledgeBaseQueries } from "@/lib/query-keys";
|
|
11
|
+
|
|
12
|
+
export interface OssImportProgress {
|
|
13
|
+
phase: "upload" | "done";
|
|
14
|
+
totalItems: number;
|
|
15
|
+
completedItems: number;
|
|
16
|
+
errors: string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface OssImportVariables {
|
|
20
|
+
knowledgeBaseName: string;
|
|
21
|
+
/** ossKeys for individually-checked files. Submitted as-is, no filters. */
|
|
22
|
+
fileKeys: string[];
|
|
23
|
+
/** Folder prefixes (ending with `/`). Server recurses; filters apply. */
|
|
24
|
+
folderPrefixes: string[];
|
|
25
|
+
/** Glob arrays produced by `lib/glob-filter.ts`. Sent to the server only
|
|
26
|
+
* on folder items — file items don't carry filters. */
|
|
27
|
+
inclusionFilters?: string[];
|
|
28
|
+
exclusionFilters?: string[];
|
|
29
|
+
subspace?: string;
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const SUBMISSION_BATCH_SIZE = 10; // matches services/documents.ts BATCH_SIZE
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Submit an OSS-mode import to the KB.
|
|
37
|
+
*
|
|
38
|
+
* The KB API natively accepts a folder ossKey (`oss://<bucket>/docs/2026/`)
|
|
39
|
+
* and recurses on the server side, so the client doesn't need to expand
|
|
40
|
+
* folders into individual keys. Each {@link OssSelection} item becomes one
|
|
41
|
+
* `AddDocumentItem`:
|
|
42
|
+
*
|
|
43
|
+
* - file selection → `{ ossKey }` (no filters)
|
|
44
|
+
* - folder selection → `{ ossKey, inclusionFilters?, exclusionFilters? }`
|
|
45
|
+
*
|
|
46
|
+
* The full document list is submitted via `addDocuments`, which already
|
|
47
|
+
* handles `BATCH_SIZE` chunking internally. We re-batch here only because
|
|
48
|
+
* we want incremental progress — `addDocuments` doesn't expose a callback.
|
|
49
|
+
*
|
|
50
|
+
* Per-batch failures are tolerated: surviving batches' results are kept and
|
|
51
|
+
* the failed slice is recorded as `status: "failed"` per ossKey. This
|
|
52
|
+
* mirrors `useUploadDocuments`'s tolerance for partial-failure import.
|
|
53
|
+
*/
|
|
54
|
+
export function useOssImport() {
|
|
55
|
+
const queryClient = useQueryClient();
|
|
56
|
+
const [progress, setProgress] = useState<OssImportProgress | null>(null);
|
|
57
|
+
|
|
58
|
+
const resetProgress = useCallback(() => setProgress(null), []);
|
|
59
|
+
|
|
60
|
+
const mutation = useMutation({
|
|
61
|
+
mutationFn: async (vars: OssImportVariables) => {
|
|
62
|
+
// Build the AddDocumentItem list. Filters attach only to folder items —
|
|
63
|
+
// a checked file is an explicit user intent and bypasses include/exclude
|
|
64
|
+
// (matches the local-folder semantics).
|
|
65
|
+
const items: AddDocumentItem[] = [
|
|
66
|
+
...vars.fileKeys.map<AddDocumentItem>((ossKey) => ({
|
|
67
|
+
ossKey,
|
|
68
|
+
...(vars.metadata ? { metadata: vars.metadata } : {}),
|
|
69
|
+
})),
|
|
70
|
+
...vars.folderPrefixes.map<AddDocumentItem>((ossKey) => ({
|
|
71
|
+
ossKey,
|
|
72
|
+
...(vars.metadata ? { metadata: vars.metadata } : {}),
|
|
73
|
+
...(vars.inclusionFilters
|
|
74
|
+
? { inclusionFilters: vars.inclusionFilters }
|
|
75
|
+
: {}),
|
|
76
|
+
...(vars.exclusionFilters
|
|
77
|
+
? { exclusionFilters: vars.exclusionFilters }
|
|
78
|
+
: {}),
|
|
79
|
+
})),
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
if (items.length === 0) {
|
|
83
|
+
setProgress({ phase: "done", totalItems: 0, completedItems: 0, errors: [] });
|
|
84
|
+
return { documentDetails: [] as DocumentOperationResult[] };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setProgress({
|
|
88
|
+
phase: "upload",
|
|
89
|
+
totalItems: items.length,
|
|
90
|
+
completedItems: 0,
|
|
91
|
+
errors: [],
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const allResults: DocumentOperationResult[] = [];
|
|
95
|
+
const allErrors: string[] = [];
|
|
96
|
+
for (let i = 0; i < items.length; i += SUBMISSION_BATCH_SIZE) {
|
|
97
|
+
const slice = items.slice(i, i + SUBMISSION_BATCH_SIZE);
|
|
98
|
+
try {
|
|
99
|
+
const resp = await addDocuments(
|
|
100
|
+
{
|
|
101
|
+
knowledgeBaseName: vars.knowledgeBaseName,
|
|
102
|
+
subspace: vars.subspace,
|
|
103
|
+
documents: slice,
|
|
104
|
+
},
|
|
105
|
+
{ timeoutMs: UPLOAD_TIMEOUT_MS },
|
|
106
|
+
);
|
|
107
|
+
allResults.push(...resp.documentDetails);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
110
|
+
allErrors.push(`批次 ${Math.floor(i / SUBMISSION_BATCH_SIZE) + 1}: ${message}`);
|
|
111
|
+
for (const item of slice) {
|
|
112
|
+
allResults.push({
|
|
113
|
+
ossKey: item.ossKey,
|
|
114
|
+
status: "failed",
|
|
115
|
+
failureReason: message,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
setProgress((p) =>
|
|
120
|
+
p
|
|
121
|
+
? {
|
|
122
|
+
...p,
|
|
123
|
+
completedItems: Math.min(p.totalItems, p.completedItems + slice.length),
|
|
124
|
+
}
|
|
125
|
+
: p,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
setProgress({
|
|
130
|
+
phase: "done",
|
|
131
|
+
totalItems: items.length,
|
|
132
|
+
completedItems: items.length,
|
|
133
|
+
errors: allErrors,
|
|
134
|
+
});
|
|
135
|
+
return { documentDetails: allResults };
|
|
136
|
+
},
|
|
137
|
+
onSuccess: () => {
|
|
138
|
+
invalidateKnowledgeBaseQueries(queryClient);
|
|
139
|
+
},
|
|
140
|
+
onSettled: () => {
|
|
141
|
+
// Match the local upload hook's "linger briefly so the user reads the
|
|
142
|
+
// final state" gesture before clearing.
|
|
143
|
+
setTimeout(resetProgress, 300);
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return { ...mutation, progress };
|
|
148
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
listOssObjects,
|
|
5
|
+
type OssListFile,
|
|
6
|
+
type OssListFolder,
|
|
7
|
+
type OssListPage,
|
|
8
|
+
} from "@/services/oss";
|
|
9
|
+
|
|
10
|
+
interface UseOssListOptions {
|
|
11
|
+
prefix: string;
|
|
12
|
+
search?: string;
|
|
13
|
+
/** When false, pauses fetching — useful while the parent tab is hidden. */
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface UseOssListResult {
|
|
18
|
+
folders: OssListFolder[];
|
|
19
|
+
files: OssListFile[];
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
isFetchingNextPage: boolean;
|
|
22
|
+
hasNextPage: boolean;
|
|
23
|
+
fetchNextPage: () => void;
|
|
24
|
+
refetch: () => void;
|
|
25
|
+
error: Error | null;
|
|
26
|
+
/** Forwarded so the UI can render the "OSS_FORBIDDEN / NOT_CONFIGURED" state. */
|
|
27
|
+
errorCode: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const PAGE_SIZE = 100;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Query key shape mirrors `lib/query-keys.ts` conventions: a stable string
|
|
34
|
+
* head plus the variable identifiers. Co-located with the hook because no
|
|
35
|
+
* other module needs to invalidate this cache (the page is read-only).
|
|
36
|
+
*/
|
|
37
|
+
function queryKey(prefix: string, search: string) {
|
|
38
|
+
return ["oss-list", prefix, search] as const;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function useOssList(options: UseOssListOptions): UseOssListResult {
|
|
42
|
+
const { prefix, search = "", enabled = true } = options;
|
|
43
|
+
|
|
44
|
+
const query = useInfiniteQuery<OssListPage, Error>({
|
|
45
|
+
queryKey: queryKey(prefix, search),
|
|
46
|
+
queryFn: ({ pageParam }) =>
|
|
47
|
+
listOssObjects({
|
|
48
|
+
prefix,
|
|
49
|
+
continuationToken: typeof pageParam === "string" ? pageParam : undefined,
|
|
50
|
+
maxResults: PAGE_SIZE,
|
|
51
|
+
search: search || undefined,
|
|
52
|
+
}),
|
|
53
|
+
getNextPageParam: (last) => last.nextContinuationToken ?? undefined,
|
|
54
|
+
initialPageParam: undefined,
|
|
55
|
+
enabled,
|
|
56
|
+
// Listings are invalidated by re-mounting the dialog, not by mutations.
|
|
57
|
+
staleTime: 30_000,
|
|
58
|
+
refetchOnWindowFocus: false,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const folders: OssListFolder[] = [];
|
|
62
|
+
const files: OssListFile[] = [];
|
|
63
|
+
for (const page of query.data?.pages ?? []) {
|
|
64
|
+
folders.push(...page.folders);
|
|
65
|
+
files.push(...page.files);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Surface error code from the standard envelope so the UI can switch on it.
|
|
69
|
+
const errorCode =
|
|
70
|
+
query.error && typeof query.error === "object" && "code" in query.error
|
|
71
|
+
? String((query.error as { code: unknown }).code ?? "")
|
|
72
|
+
: null;
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
folders,
|
|
76
|
+
files,
|
|
77
|
+
isLoading: query.isLoading,
|
|
78
|
+
isFetchingNextPage: query.isFetchingNextPage,
|
|
79
|
+
hasNextPage: Boolean(query.hasNextPage),
|
|
80
|
+
fetchNextPage: () => {
|
|
81
|
+
if (query.hasNextPage && !query.isFetchingNextPage) query.fetchNextPage();
|
|
82
|
+
},
|
|
83
|
+
refetch: () => {
|
|
84
|
+
void query.refetch();
|
|
85
|
+
},
|
|
86
|
+
error: query.error ?? null,
|
|
87
|
+
errorCode,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared filename-extension and recursion rules used by both the local-folder
|
|
3
|
+
* upload mode and the server-side OSS prefix expansion. Keeping the rule shape
|
|
4
|
+
* and matching logic in one place is what guarantees the two paths agree.
|
|
5
|
+
*
|
|
6
|
+
* `include` / `exclude` are lowercase, dotted suffixes ([".md", ".pdf"]).
|
|
7
|
+
* They apply to the file's basename, not to its path — directory names never
|
|
8
|
+
* count toward the suffix check.
|
|
9
|
+
*/
|
|
10
|
+
export interface ExtensionRules {
|
|
11
|
+
include: string[];
|
|
12
|
+
exclude: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RecursiveExtensionRules extends ExtensionRules {
|
|
16
|
+
recursive: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a comma-separated extension list like ".md, pdf , .TXT" into a
|
|
21
|
+
* lowercase, dot-prefixed array: [".md", ".pdf", ".txt"]. Empty tokens are
|
|
22
|
+
* dropped; missing leading dots are added.
|
|
23
|
+
*/
|
|
24
|
+
export function parseExtensionList(raw: string): string[] {
|
|
25
|
+
return raw
|
|
26
|
+
.split(",")
|
|
27
|
+
.map((s) => s.trim().toLowerCase())
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.map((ext) => (ext.startsWith(".") ? ext : `.${ext}`));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Pure name-based check. No path or depth involved — caller handles those. */
|
|
33
|
+
export function matchesExtension(name: string, rules: ExtensionRules): boolean {
|
|
34
|
+
const lower = name.toLowerCase();
|
|
35
|
+
if (rules.include.length > 0 && !rules.include.some((ext) => lower.endsWith(ext))) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (rules.exclude.length > 0 && rules.exclude.some((ext) => lower.endsWith(ext))) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Filter a File[] picked through `<input webkitdirectory>` or drag-drop.
|
|
46
|
+
*
|
|
47
|
+
* The `webkitRelativePath` shape is "<root>/<...subpath>", so the top-level
|
|
48
|
+
* file inside the picked folder lives at depth 1. That's why the recursive
|
|
49
|
+
* cutoff here is `depth > 1` — anything deeper is a subdirectory.
|
|
50
|
+
*/
|
|
51
|
+
export function filterFolderFiles(
|
|
52
|
+
files: File[],
|
|
53
|
+
rules: RecursiveExtensionRules,
|
|
54
|
+
): File[] {
|
|
55
|
+
return files.filter((file) => {
|
|
56
|
+
const rel = file.webkitRelativePath || file.name;
|
|
57
|
+
const depth = (rel.match(/\//g) || []).length;
|
|
58
|
+
if (!rules.recursive && depth > 1) return false;
|
|
59
|
+
return matchesExtension(file.name, rules);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|