@tablestore/tablestore-agent-cli 0.2.1 → 0.2.4
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 +9 -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 +40 -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/build-manifest.json +5 -5
- package/dist/dashboard-runtime/dashboard/.next/prerender-manifest.json +3 -3
- 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.js.nft.json +1 -1
- 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_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/chunks/0p91_next_dist_esm_build_templates_app-route_0n~ec7s.js +9 -6
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__02p1x3t._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0fglxiw._.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 +1 -1
- 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]__08faq-z._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0c94d.y._.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 → [root-of-the-server]__0lgg04c._.js} +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__10rkv6z._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_01-2v37._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_01ag-vl._.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/_0atzifq._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0f4u0.1._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0gbt~hy._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0gl7kh7._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0j-q~ro._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0jghj2_._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0jlyg05._.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/{_0l~-9i0._.js → _0tdjkbc._.js} +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0tej2s.._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_10u~-xc._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_12r9c8h._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0.glq39._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_00ofp7q._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_05.qn9h._.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_0xf3ffa._.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_app_(dashboard)_memory_[store]_settings_page_tsx_0y26.xu._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_units_page_tsx_0.6xnei._.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/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/00wmf85833643.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/02tj1_rhgobzv.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0mea2ylxe.umh.js → 02zf3qddfaw~u.js} +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/039i70t10axdd.css +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/04bfame9rk.3d.js +5 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/07rwb_uq9qcx4.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/07ygw8215kyvc.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0b5hr027rat4w.js +138 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0__g1ogrdh412.js → 0bkm-5yza5~d2.js} +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0lrw.bnws62y9.js → 0d7d.b.v9noym.js} +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0cto67_iw~p9z.js → 0fdofp-3kkc4g.js} +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0i8hdbek9j-fu.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ioivx4pbmayb.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0j-v5f_oscvfu.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0lp2g_27uyhuz.js → 0je7fmsrz2vok.js} +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jukioxtp1mn3.js +138 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0klidr2i6cd.g.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k~bkh1586r2i.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0nakvv2p1kjnf.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0t5vdnq4s.2yv.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0un~rqes29pcr.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0v.u57bsjppd_.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0fagnytrt.3oe.js → 0veza1g0elxa7.js} +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0x3w~yxvm1xsq.js +4 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0x5gol39unrgb.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/12s59v_sk0q-z.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{06uuhz24tvdt..js → 14~eqof4660i3.js} +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/16y3764x-fh1n.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/17mcnyr~1j7ih.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{turbopack-0w.hw6u8qra5z.js → turbopack-0~gu0g2v-1f11.js} +1 -1
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/chat/page.tsx +5 -0
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/knowledge-base/[name]/documents/documents-client.tsx +4 -1
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/knowledge-base/[name]/layout-client.tsx +62 -26
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/messages/page.tsx +8 -4
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/requests/page.tsx +6 -2
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/requests/request-detail-dialog.tsx +9 -9
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/requests/requests-table.tsx +2 -2
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/search/page.tsx +5 -1
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/settings/page.tsx +56 -17
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/units/page.tsx +11 -7
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/create/page.tsx +1 -1
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/page.tsx +1 -1
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/knowledge-bases/[name]/documents/[docId]/route.ts +67 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/memory-helpers.ts +45 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/route.ts +334 -16
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/logs/client/route.ts +13 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/oss/list/route.ts +1 -0
- package/dist/dashboard-runtime/dashboard/src/app/globals.css +23 -0
- package/dist/dashboard-runtime/dashboard/src/components/chat/chat-config-context.tsx +116 -19
- package/dist/dashboard-runtime/dashboard/src/components/chat/chat-mount-config.tsx +5 -0
- package/dist/dashboard-runtime/dashboard/src/components/chat/memory-bind-section.tsx +372 -0
- package/dist/dashboard-runtime/dashboard/src/components/chat/mount-retrieval-dialog.tsx +360 -0
- package/dist/dashboard-runtime/dashboard/src/components/chat/mount-row.tsx +49 -5
- package/dist/dashboard-runtime/dashboard/src/components/chat/unified-retrieval-section.tsx +61 -26
- package/dist/dashboard-runtime/dashboard/src/components/documents/doc-chunks-dialog.tsx +72 -20
- package/dist/dashboard-runtime/dashboard/src/components/documents/doc-detail-panel.tsx +578 -76
- package/dist/dashboard-runtime/dashboard/src/components/documents/doc-upload-dialog.tsx +9 -81
- package/dist/dashboard-runtime/dashboard/src/components/documents/oss-browser.tsx +42 -26
- package/dist/dashboard-runtime/dashboard/src/components/instance/connect-instance-form.tsx +5 -0
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/embedding-config-form.tsx +16 -2
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-card.tsx +37 -24
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-create-form.tsx +173 -86
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-settings-form.tsx +319 -280
- package/dist/dashboard-runtime/dashboard/src/components/layout/detail-sidebar.tsx +47 -18
- package/dist/dashboard-runtime/dashboard/src/components/layout/sidebar-instance-card.tsx +2 -2
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-add-dialog.tsx +2 -2
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-create-form.tsx +84 -56
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-edit-dialog.tsx +2 -2
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-messages-table.tsx +3 -3
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-requests-table.tsx +12 -12
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-scope-bar.tsx +20 -11
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-search-form.tsx +7 -7
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-search-results.tsx +6 -6
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-settings-form.tsx +90 -21
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-store-card.tsx +1 -1
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-store-list.tsx +1 -1
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-unit-detail-panel.tsx +4 -4
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-unit-table.tsx +2 -2
- package/dist/dashboard-runtime/dashboard/src/components/qa/qa-message.tsx +216 -5
- package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-form.tsx +241 -24
- package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-rerank-fields.tsx +1 -0
- package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-result-card.tsx +52 -4
- package/dist/dashboard-runtime/dashboard/src/components/shared/metadata-field-input.tsx +54 -0
- package/dist/dashboard-runtime/dashboard/src/components/shared/status-badge.tsx +10 -5
- package/dist/dashboard-runtime/dashboard/src/components/ui/nav-tab-bar.tsx +1 -1
- package/dist/dashboard-runtime/dashboard/src/hooks/use-chat-history.ts +60 -5
- package/dist/dashboard-runtime/dashboard/src/hooks/use-document.ts +29 -0
- package/dist/dashboard-runtime/dashboard/src/hooks/use-oss-list.ts +7 -5
- package/dist/dashboard-runtime/dashboard/src/hooks/use-qa-chat.ts +65 -11
- package/dist/dashboard-runtime/dashboard/src/hooks/use-update-document.ts +15 -0
- package/dist/dashboard-runtime/dashboard/src/lib/api-error-toast.ts +62 -0
- package/dist/dashboard-runtime/dashboard/src/lib/constants.ts +8 -0
- package/dist/dashboard-runtime/dashboard/src/lib/metadata-form.ts +88 -0
- package/dist/dashboard-runtime/dashboard/src/lib/query-keys.ts +14 -0
- package/dist/dashboard-runtime/dashboard/src/lib/server/api-helpers.ts +18 -5
- package/dist/dashboard-runtime/dashboard/src/lib/server/llm-client.ts +19 -1
- package/dist/dashboard-runtime/dashboard/src/lib/server/oss-client.ts +45 -16
- package/dist/dashboard-runtime/dashboard/src/schemas/knowledge-base.ts +6 -0
- package/dist/dashboard-runtime/dashboard/src/schemas/llm-chat.ts +20 -0
- package/dist/dashboard-runtime/dashboard/src/schemas/retrieval.ts +46 -27
- package/dist/dashboard-runtime/dashboard/src/services/api-client.ts +31 -2
- package/dist/dashboard-runtime/dashboard/src/services/documents.ts +36 -3
- package/dist/dashboard-runtime/dashboard/src/types/knowledge-base.ts +10 -0
- package/dist/dashboard-runtime/dashboard/src/types/llm-chat.ts +33 -0
- package/dist/dashboard-runtime/dashboard/src/types/retrieval.ts +9 -4
- package/dist/dashboard-runtime/dashboard/tailwind.config.ts +4 -0
- package/dist/dashboard-runtime/dashboard/vitest.config.mjs +5 -2
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
- 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/logging.js +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 +21 -5
- 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/kb-client.d.ts +1 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.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/logging.js +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 +21 -5
- package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
- package/dist/utils/read-image-input.d.ts +47 -0
- package/dist/utils/read-image-input.d.ts.map +1 -0
- package/dist/utils/read-image-input.js +89 -0
- package/dist/utils/read-image-input.js.map +1 -0
- package/package.json +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0aqzu8w._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0hozzu6._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0kd7szs._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0tr8-3u._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0xzh5yw._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_12~3vfk._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_13_lb.o._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0ejgygh._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_ui_0-tuf-h._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/00tz~p479bdgl.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/02i9olo-312mq.js +0 -138
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/062k9jbtd9.lv.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/069zf4m5f.se2.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/07cp19da_kfld.js +0 -5
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/086esp1n941jl.js +0 -138
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/09uxq~55qug8c.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0d29.l~3ip181.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ewpzgu_qf0wf.js +0 -4
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jc31diex030o.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k79upjc40aky.css +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0snnsfosp3~gq.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0t0yqi68~eil6.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0th7u6qvdy3x2.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0tmwptel_4y0o.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u6_s-0w8.yr..js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u9wtl06_b72x.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0v9d5wl9nsva3.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0~kfzxrhgbkaz.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/14.dp0-y_mhjo.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/15bzqpm440jvz.js +0 -1
- /package/dist/dashboard-runtime/dashboard/.next/static/{doYIl-pd6Sqax3bfUgN3q → EIbKHHti0Z1ephKfJzCKH}/_buildManifest.js +0 -0
- /package/dist/dashboard-runtime/dashboard/.next/static/{doYIl-pd6Sqax3bfUgN3q → EIbKHHti0Z1ephKfJzCKH}/_clientMiddlewareManifest.js +0 -0
- /package/dist/dashboard-runtime/dashboard/.next/static/{doYIl-pd6Sqax3bfUgN3q → EIbKHHti0Z1ephKfJzCKH}/_ssgManifest.js +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
4
|
import { useForm } from "react-hook-form";
|
|
5
5
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
6
|
-
import { Check, Code2, Copy, Search } from "lucide-react";
|
|
6
|
+
import { Check, Code2, Copy, ImageIcon, Search, Upload, X } from "lucide-react";
|
|
7
7
|
import { toast } from "sonner";
|
|
8
8
|
import { Button } from "@/components/ui/button";
|
|
9
9
|
import { Input } from "@/components/ui/input";
|
|
@@ -26,12 +26,13 @@ import {
|
|
|
26
26
|
TooltipProvider,
|
|
27
27
|
TooltipTrigger,
|
|
28
28
|
} from "@/components/ui/tooltip";
|
|
29
|
+
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
|
29
30
|
import { type FilterBuilderHandle } from "./filter-builder";
|
|
30
31
|
import { RetrievalParamsFields } from "./retrieval-params-fields";
|
|
31
32
|
import { assembleRetrievalConfiguration } from "./assemble-retrieval-configuration";
|
|
32
33
|
import { retrievalSchema, type RetrievalInput } from "@/schemas/retrieval";
|
|
33
34
|
import type { KnowledgeBase } from "@/types/knowledge-base";
|
|
34
|
-
import type { RetrievalRequest } from "@/types/retrieval";
|
|
35
|
+
import type { RetrievalQuery, RetrievalRequest } from "@/types/retrieval";
|
|
35
36
|
|
|
36
37
|
interface RetrievalFormProps {
|
|
37
38
|
knowledgeBaseName: string;
|
|
@@ -59,9 +60,18 @@ export function assembleRetrievalRequest(
|
|
|
59
60
|
const config = assembleRetrievalConfiguration(v, undefined) ?? {};
|
|
60
61
|
if (filter) config.filter = filter;
|
|
61
62
|
|
|
63
|
+
const retrievalQuery: RetrievalQuery =
|
|
64
|
+
v.queryType === "IMAGE" && v.imageInput
|
|
65
|
+
? {
|
|
66
|
+
type: "IMAGE" as const,
|
|
67
|
+
imageBase64: v.imageInput,
|
|
68
|
+
...(v.query ? { text: v.query } : {}),
|
|
69
|
+
}
|
|
70
|
+
: { type: "TEXT" as const, text: v.query ?? "" };
|
|
71
|
+
|
|
62
72
|
const req: RetrievalRequest = {
|
|
63
73
|
knowledgeBaseName,
|
|
64
|
-
retrievalQuery
|
|
74
|
+
retrievalQuery,
|
|
65
75
|
};
|
|
66
76
|
if (v.subspace?.length) req.subspace = v.subspace;
|
|
67
77
|
if (Object.keys(config).length > 0) req.retrievalConfiguration = config;
|
|
@@ -100,7 +110,9 @@ export function retrievalDefaultsFromKB(
|
|
|
100
110
|
|
|
101
111
|
return {
|
|
102
112
|
knowledgeBaseName,
|
|
113
|
+
queryType: "TEXT" as const,
|
|
103
114
|
query: "",
|
|
115
|
+
imageInput: "",
|
|
104
116
|
subspace: [],
|
|
105
117
|
topK: kbRerankTopK,
|
|
106
118
|
denseTopK: kbDenseTopK,
|
|
@@ -214,6 +226,9 @@ export function RetrievalForm({
|
|
|
214
226
|
isLoading,
|
|
215
227
|
}: RetrievalFormProps) {
|
|
216
228
|
const filterRef = useRef<FilterBuilderHandle>(null);
|
|
229
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
230
|
+
const [fileName, setFileName] = useState("");
|
|
231
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
217
232
|
|
|
218
233
|
const form = useForm<RetrievalInput>({
|
|
219
234
|
resolver: zodResolver(retrievalSchema),
|
|
@@ -234,6 +249,12 @@ export function RetrievalForm({
|
|
|
234
249
|
return assembleRetrievalRequest(knowledgeBaseName, values, filter) as unknown as Record<string, unknown>;
|
|
235
250
|
};
|
|
236
251
|
|
|
252
|
+
const isMultimodal = knowledgeBase?.multimodal === true;
|
|
253
|
+
const queryType = form.watch("queryType") ?? "TEXT";
|
|
254
|
+
|
|
255
|
+
// Force TEXT mode for non-multimodal KBs
|
|
256
|
+
const effectiveQueryType = isMultimodal ? queryType : "TEXT";
|
|
257
|
+
|
|
237
258
|
return (
|
|
238
259
|
<Form {...form}>
|
|
239
260
|
<form
|
|
@@ -245,27 +266,223 @@ export function RetrievalForm({
|
|
|
245
266
|
<RequestPreviewButton buildRequestJson={buildRequestJson} />
|
|
246
267
|
</div>
|
|
247
268
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
<
|
|
254
|
-
|
|
255
|
-
<
|
|
256
|
-
<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
{isMultimodal && (
|
|
270
|
+
<FormField
|
|
271
|
+
control={form.control}
|
|
272
|
+
name="queryType"
|
|
273
|
+
render={({ field }) => (
|
|
274
|
+
<FormItem>
|
|
275
|
+
<FormLabel>查询类型</FormLabel>
|
|
276
|
+
<FormControl>
|
|
277
|
+
<ToggleGroup
|
|
278
|
+
type="single"
|
|
279
|
+
value={field.value ?? "TEXT"}
|
|
280
|
+
onValueChange={(v) => {
|
|
281
|
+
if (v && v !== field.value) {
|
|
282
|
+
field.onChange(v);
|
|
283
|
+
// Clear both inputs on type switch to avoid stale values
|
|
284
|
+
form.setValue("query", "");
|
|
285
|
+
form.setValue("imageInput", "");
|
|
286
|
+
}
|
|
287
|
+
}}
|
|
288
|
+
className="grid w-full grid-cols-2 gap-0 overflow-hidden rounded-lg border border-border bg-[hsl(var(--muted)/0.4)] p-0 sm:max-w-md"
|
|
289
|
+
>
|
|
290
|
+
<ToggleGroupItem value="TEXT" className="h-9">
|
|
291
|
+
TEXT
|
|
292
|
+
</ToggleGroupItem>
|
|
293
|
+
<ToggleGroupItem value="IMAGE" className="h-9">
|
|
294
|
+
IMAGE
|
|
295
|
+
</ToggleGroupItem>
|
|
296
|
+
</ToggleGroup>
|
|
297
|
+
</FormControl>
|
|
298
|
+
</FormItem>
|
|
299
|
+
)}
|
|
300
|
+
/>
|
|
301
|
+
)}
|
|
302
|
+
|
|
303
|
+
{effectiveQueryType === "TEXT" ? (
|
|
304
|
+
<FormField
|
|
305
|
+
control={form.control}
|
|
306
|
+
name="query"
|
|
307
|
+
render={({ field }) => (
|
|
308
|
+
<FormItem>
|
|
309
|
+
<FormLabel>查询内容</FormLabel>
|
|
310
|
+
<FormControl>
|
|
311
|
+
<div className="relative">
|
|
312
|
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[hsl(var(--muted-foreground))]" />
|
|
313
|
+
<Input
|
|
314
|
+
placeholder="输入检索查询..."
|
|
315
|
+
className="pl-9"
|
|
316
|
+
maxLength={128}
|
|
317
|
+
{...field}
|
|
318
|
+
/>
|
|
319
|
+
</div>
|
|
320
|
+
</FormControl>
|
|
321
|
+
<FormMessage />
|
|
322
|
+
</FormItem>
|
|
323
|
+
)}
|
|
324
|
+
/>
|
|
325
|
+
) : (
|
|
326
|
+
<>
|
|
327
|
+
{/* Image file upload */}
|
|
328
|
+
<FormField
|
|
329
|
+
control={form.control}
|
|
330
|
+
name="imageInput"
|
|
331
|
+
render={({ field }) => {
|
|
332
|
+
const acceptedTypes = ["image/jpeg", "image/png", "image/webp", "image/bmp", "image/tiff"];
|
|
333
|
+
|
|
334
|
+
const handleFile = (file: File) => {
|
|
335
|
+
if (!acceptedTypes.includes(file.type)) {
|
|
336
|
+
toast.error("不支持的图片格式,请选择 JPG/PNG/WebP/BMP/TIFF 格式");
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const reader = new FileReader();
|
|
340
|
+
reader.onload = () => {
|
|
341
|
+
field.onChange(reader.result as string);
|
|
342
|
+
setFileName(file.name || "pasted-image");
|
|
343
|
+
};
|
|
344
|
+
reader.onerror = () => {
|
|
345
|
+
toast.error("图片读取失败,请重试");
|
|
346
|
+
};
|
|
347
|
+
reader.readAsDataURL(file);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const handleRemove = () => {
|
|
351
|
+
field.onChange("");
|
|
352
|
+
setFileName("");
|
|
353
|
+
if (fileInputRef.current) {
|
|
354
|
+
fileInputRef.current.value = "";
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const handlePaste = (e: React.ClipboardEvent) => {
|
|
359
|
+
const items = e.clipboardData?.items;
|
|
360
|
+
if (!items) return;
|
|
361
|
+
|
|
362
|
+
for (const item of Array.from(items)) {
|
|
363
|
+
if (item.type.startsWith("image/")) {
|
|
364
|
+
e.preventDefault();
|
|
365
|
+
const file = item.getAsFile();
|
|
366
|
+
if (file) handleFile(file);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
return (
|
|
373
|
+
<FormItem>
|
|
374
|
+
<FormLabel>图片输入</FormLabel>
|
|
375
|
+
<FormControl>
|
|
376
|
+
<div
|
|
377
|
+
key={queryType}
|
|
378
|
+
onPaste={handlePaste}
|
|
379
|
+
tabIndex={0}
|
|
380
|
+
className="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-md"
|
|
381
|
+
>
|
|
382
|
+
<input
|
|
383
|
+
ref={fileInputRef}
|
|
384
|
+
type="file"
|
|
385
|
+
accept="image/jpeg,image/png,image/webp,image/bmp,image/tiff"
|
|
386
|
+
className="hidden"
|
|
387
|
+
onChange={(e) => {
|
|
388
|
+
const file = e.target.files?.[0];
|
|
389
|
+
if (file) handleFile(file);
|
|
390
|
+
}}
|
|
391
|
+
/>
|
|
392
|
+
|
|
393
|
+
{!field.value ? (
|
|
394
|
+
<div
|
|
395
|
+
onClick={() => fileInputRef.current?.click()}
|
|
396
|
+
onDragOver={(e) => {
|
|
397
|
+
e.preventDefault();
|
|
398
|
+
setIsDragging(true);
|
|
399
|
+
}}
|
|
400
|
+
onDragLeave={() => setIsDragging(false)}
|
|
401
|
+
onDrop={(e) => {
|
|
402
|
+
e.preventDefault();
|
|
403
|
+
setIsDragging(false);
|
|
404
|
+
const file = e.dataTransfer.files[0];
|
|
405
|
+
if (file) handleFile(file);
|
|
406
|
+
}}
|
|
407
|
+
className={`border-2 border-dashed rounded-lg p-8 flex flex-col items-center gap-3 cursor-pointer transition-colors ${
|
|
408
|
+
isDragging
|
|
409
|
+
? "border-primary bg-accent/50"
|
|
410
|
+
: "border-border hover:border-primary/50 hover:bg-accent/50"
|
|
411
|
+
}`}
|
|
412
|
+
>
|
|
413
|
+
<Upload className="w-8 h-8 text-muted-foreground" />
|
|
414
|
+
<p className="text-sm text-muted-foreground">
|
|
415
|
+
点击、拖拽或粘贴图片到此处
|
|
416
|
+
</p>
|
|
417
|
+
<p className="text-xs text-muted-foreground/70">
|
|
418
|
+
支持 JPG/PNG/WebP/BMP/TIFF
|
|
419
|
+
</p>
|
|
420
|
+
</div>
|
|
421
|
+
) : (
|
|
422
|
+
/* 已选择态 - 悬停遮罩式 */
|
|
423
|
+
<div className="group border border-border rounded-md overflow-hidden">
|
|
424
|
+
{/* 图片预览区域 */}
|
|
425
|
+
<div className="relative flex justify-center bg-muted/30 p-3">
|
|
426
|
+
<img
|
|
427
|
+
src={field.value}
|
|
428
|
+
alt="已选择的图片预览"
|
|
429
|
+
className="max-h-[200px] max-w-full rounded object-contain"
|
|
430
|
+
/>
|
|
431
|
+
{/* 悬停遮罩 + 操作按钮 */}
|
|
432
|
+
<div className="absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-3">
|
|
433
|
+
<button
|
|
434
|
+
type="button"
|
|
435
|
+
onClick={() => fileInputRef.current?.click()}
|
|
436
|
+
className="px-3 py-1.5 rounded bg-white/90 text-sm font-medium text-foreground hover:bg-white flex items-center gap-1.5"
|
|
437
|
+
>
|
|
438
|
+
<Upload className="w-3.5 h-3.5" />
|
|
439
|
+
重新选择
|
|
440
|
+
</button>
|
|
441
|
+
<button
|
|
442
|
+
type="button"
|
|
443
|
+
onClick={handleRemove}
|
|
444
|
+
className="px-3 py-1.5 rounded bg-white/90 text-sm font-medium text-destructive hover:bg-white flex items-center gap-1.5"
|
|
445
|
+
>
|
|
446
|
+
<X className="w-3.5 h-3.5" />
|
|
447
|
+
删除
|
|
448
|
+
</button>
|
|
449
|
+
</div>
|
|
450
|
+
</div>
|
|
451
|
+
{/* 底部文件信息栏 */}
|
|
452
|
+
<div className="px-3 py-2 border-t border-border flex items-center gap-2 text-sm text-muted-foreground">
|
|
453
|
+
<ImageIcon className="w-3.5 h-3.5" />
|
|
454
|
+
<span className="truncate">{fileName}</span>
|
|
455
|
+
</div>
|
|
456
|
+
</div>
|
|
457
|
+
)}
|
|
458
|
+
</div>
|
|
459
|
+
</FormControl>
|
|
460
|
+
<FormMessage />
|
|
461
|
+
</FormItem>
|
|
462
|
+
);
|
|
463
|
+
}}
|
|
464
|
+
/>
|
|
465
|
+
|
|
466
|
+
{/* Supplementary text */}
|
|
467
|
+
<FormField
|
|
468
|
+
control={form.control}
|
|
469
|
+
name="query"
|
|
470
|
+
render={({ field }) => (
|
|
471
|
+
<FormItem>
|
|
472
|
+
<FormLabel>补充文本(可选)</FormLabel>
|
|
473
|
+
<FormControl>
|
|
474
|
+
<Input
|
|
475
|
+
placeholder="补充文本描述..."
|
|
476
|
+
maxLength={128}
|
|
477
|
+
{...field}
|
|
478
|
+
/>
|
|
479
|
+
</FormControl>
|
|
480
|
+
<FormMessage />
|
|
481
|
+
</FormItem>
|
|
482
|
+
)}
|
|
483
|
+
/>
|
|
484
|
+
</>
|
|
485
|
+
)}
|
|
269
486
|
|
|
270
487
|
<RetrievalParamsFields
|
|
271
488
|
form={form}
|
package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-rerank-fields.tsx
CHANGED
|
@@ -175,6 +175,7 @@ const PROVIDER_OPTIONS: { value: string; label: string }[] = [
|
|
|
175
175
|
const BAILIAN_MODEL_OPTIONS: { value: string; label: string }[] = [
|
|
176
176
|
{ value: "gte-rerank-v2", label: "gte-rerank-v2" },
|
|
177
177
|
{ value: "qwen3-rerank", label: "qwen3-rerank" },
|
|
178
|
+
{ value: "qwen3-vl-rerank", label: "qwen3-vl-rerank (多模态)" },
|
|
178
179
|
];
|
|
179
180
|
|
|
180
181
|
function ModelFields({ form }: { form: UseFormReturn<RetrievalInput> }) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
1
2
|
import { Card, CardContent } from "@/components/ui/card";
|
|
2
3
|
import { Badge } from "@/components/ui/badge";
|
|
4
|
+
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
|
|
3
5
|
import type { RetrievalResult } from "@/types/retrieval";
|
|
6
|
+
import { IMAGE_FALLBACK_DATA_PREFIX } from "@/lib/constants";
|
|
4
7
|
|
|
5
8
|
interface RetrievalResultCardProps {
|
|
6
9
|
result: RetrievalResult;
|
|
@@ -8,12 +11,24 @@ interface RetrievalResultCardProps {
|
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
export function RetrievalResultCard({ result, rank }: RetrievalResultCardProps) {
|
|
14
|
+
const [zoomedImage, setZoomedImage] = useState<string | null>(null);
|
|
11
15
|
const fileName = result.ossKey?.split("/").pop() || result.ossKey || "未知文件";
|
|
12
16
|
|
|
17
|
+
const isImageChunk = result.chunkType?.toLowerCase() === "image";
|
|
18
|
+
const chunkBadgeVariant = isImageChunk ? "default" : "secondary";
|
|
19
|
+
|
|
20
|
+
// 当后端只返回裸 base64(无 data URL 前缀)时,补充通用 MIME 兜底。
|
|
21
|
+
// 浏览器会按内容嗅探解码,这里只需是合法 image/* 类型以避免 CSP 拒绝渲染。
|
|
22
|
+
const imageSrc = result.imageBase64
|
|
23
|
+
? result.imageBase64.startsWith("data:")
|
|
24
|
+
? result.imageBase64
|
|
25
|
+
: `${IMAGE_FALLBACK_DATA_PREFIX}${result.imageBase64}`
|
|
26
|
+
: undefined;
|
|
27
|
+
|
|
13
28
|
return (
|
|
14
29
|
<Card className="transition-shadow hover:shadow-sm">
|
|
15
30
|
<CardContent className="p-4 space-y-3">
|
|
16
|
-
{/* 头部: 排名 + Score */}
|
|
31
|
+
{/* 头部: 排名 + Score + chunkType */}
|
|
17
32
|
<div className="flex items-center justify-between">
|
|
18
33
|
<div className="flex items-center gap-2">
|
|
19
34
|
<span className="flex h-6 w-6 items-center justify-center rounded-full bg-[hsl(var(--primary-50))] text-xs font-semibold text-primary">
|
|
@@ -22,6 +37,11 @@ export function RetrievalResultCard({ result, rank }: RetrievalResultCardProps)
|
|
|
22
37
|
<Badge variant="outline" className="font-mono text-xs">
|
|
23
38
|
{result.score.toFixed(4)}
|
|
24
39
|
</Badge>
|
|
40
|
+
{result.chunkType && (
|
|
41
|
+
<Badge variant={chunkBadgeVariant} className="text-xs">
|
|
42
|
+
{result.chunkType.toUpperCase()}
|
|
43
|
+
</Badge>
|
|
44
|
+
)}
|
|
25
45
|
</div>
|
|
26
46
|
{result.subspace && (
|
|
27
47
|
<Badge variant="secondary" className="text-xs">
|
|
@@ -37,9 +57,23 @@ export function RetrievalResultCard({ result, rank }: RetrievalResultCardProps)
|
|
|
37
57
|
</div>
|
|
38
58
|
|
|
39
59
|
{/* 内容片段 */}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
{isImageChunk && result.imageBase64 && imageSrc && (
|
|
61
|
+
<img
|
|
62
|
+
src={imageSrc}
|
|
63
|
+
alt="检索结果图片"
|
|
64
|
+
className="max-w-[200px] rounded-md cursor-pointer hover:opacity-80 transition-opacity"
|
|
65
|
+
onClick={() => setZoomedImage(imageSrc)}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
{result.content && (
|
|
69
|
+
<p
|
|
70
|
+
className={`leading-relaxed text-foreground/90 whitespace-pre-wrap ${
|
|
71
|
+
isImageChunk ? "text-xs" : "text-sm line-clamp-6"
|
|
72
|
+
}`}
|
|
73
|
+
>
|
|
74
|
+
{result.content}
|
|
75
|
+
</p>
|
|
76
|
+
)}
|
|
43
77
|
|
|
44
78
|
{/* Metadata */}
|
|
45
79
|
{result.metadata && Object.keys(result.metadata).length > 0 && (
|
|
@@ -56,6 +90,20 @@ export function RetrievalResultCard({ result, rank }: RetrievalResultCardProps)
|
|
|
56
90
|
</div>
|
|
57
91
|
)}
|
|
58
92
|
</CardContent>
|
|
93
|
+
|
|
94
|
+
{/* 图片放大预览 */}
|
|
95
|
+
<Dialog open={!!zoomedImage} onOpenChange={() => setZoomedImage(null)}>
|
|
96
|
+
<DialogContent className="max-w-[90vw] max-h-[90vh] p-2 flex items-center justify-center border-none bg-black/90 data-[state=open]:animate-none data-[state=closed]:animate-none duration-0">
|
|
97
|
+
<DialogTitle className="sr-only">图片放大预览</DialogTitle>
|
|
98
|
+
{zoomedImage && (
|
|
99
|
+
<img
|
|
100
|
+
src={zoomedImage}
|
|
101
|
+
alt="放大预览"
|
|
102
|
+
className="max-w-full max-h-[85vh] object-contain"
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
</DialogContent>
|
|
106
|
+
</Dialog>
|
|
59
107
|
</Card>
|
|
60
108
|
);
|
|
61
109
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Input } from "@/components/ui/input";
|
|
4
|
+
import {
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue,
|
|
10
|
+
} from "@/components/ui/select";
|
|
11
|
+
import type { MetadataField } from "@/types/knowledge-base";
|
|
12
|
+
|
|
13
|
+
interface MetadataFieldInputProps {
|
|
14
|
+
field: MetadataField;
|
|
15
|
+
value: string;
|
|
16
|
+
onChange: (next: string) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Controlled input for a single KB metadata schema field. Empty string means
|
|
21
|
+
* "field unset" — the parent form's converter skips empty values when
|
|
22
|
+
* building the request payload.
|
|
23
|
+
*/
|
|
24
|
+
export function MetadataFieldInput({
|
|
25
|
+
field,
|
|
26
|
+
value,
|
|
27
|
+
onChange,
|
|
28
|
+
}: MetadataFieldInputProps) {
|
|
29
|
+
if (field.type === "boolean") {
|
|
30
|
+
return (
|
|
31
|
+
<Select value={value} onValueChange={onChange}>
|
|
32
|
+
<SelectTrigger>
|
|
33
|
+
<SelectValue placeholder="不设置" />
|
|
34
|
+
</SelectTrigger>
|
|
35
|
+
<SelectContent>
|
|
36
|
+
<SelectItem value="true">true</SelectItem>
|
|
37
|
+
<SelectItem value="false">false</SelectItem>
|
|
38
|
+
</SelectContent>
|
|
39
|
+
</Select>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const isList = field.type.endsWith("_list");
|
|
44
|
+
const isNumber = field.type === "long" || field.type === "double";
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Input
|
|
48
|
+
type={isNumber ? "number" : field.type === "date" ? "date" : "text"}
|
|
49
|
+
placeholder={isList ? "值1, 值2, 值3" : isNumber ? "输入数字" : "输入值"}
|
|
50
|
+
value={value}
|
|
51
|
+
onChange={(e) => onChange(e.target.value)}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -8,12 +8,17 @@ interface StatusBadgeProps {
|
|
|
8
8
|
label?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
// Both `success` / `success-soft` (and friends) are registered in
|
|
12
|
+
// tailwind.config.ts and back themselves with HSL CSS variables that
|
|
13
|
+
// already swap inside the `.dark` selector in globals.css, so a single
|
|
14
|
+
// utility class covers both themes. Adding a separate `dark:bg-*`
|
|
15
|
+
// override here would actually clobber the soft token in dark mode.
|
|
11
16
|
const STATUS_CLASS_MAP: Record<BadgeStatus, string> = {
|
|
12
|
-
completed: "bg-
|
|
13
|
-
pending: "bg-
|
|
14
|
-
indexing: "bg-
|
|
15
|
-
failed: "bg-
|
|
16
|
-
deleting: "bg-
|
|
17
|
+
completed: "bg-success-soft text-success",
|
|
18
|
+
pending: "bg-warning-soft text-warning",
|
|
19
|
+
indexing: "bg-info-soft text-info",
|
|
20
|
+
failed: "bg-danger-soft text-danger",
|
|
21
|
+
deleting: "bg-warning-soft text-warning",
|
|
17
22
|
};
|
|
18
23
|
|
|
19
24
|
const STATUS_LABEL_MAP: Record<BadgeStatus, string> = {
|
|
@@ -6,7 +6,7 @@ import { usePathname } from "next/navigation"
|
|
|
6
6
|
|
|
7
7
|
import { cn } from "@/lib/utils"
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type NavTabBarProps = React.HTMLAttributes<HTMLDivElement>;
|
|
10
10
|
|
|
11
11
|
export function NavTabBar({ className, children, ...props }: NavTabBarProps) {
|
|
12
12
|
return (
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
4
4
|
|
|
5
|
+
import { newId } from "@/lib/random-id";
|
|
5
6
|
import type { ChatMessage } from "@/types/llm-chat";
|
|
6
7
|
|
|
7
8
|
/** Legacy global key kept for read-only migration. */
|
|
@@ -31,15 +32,17 @@ const TITLE_MAX_LENGTH = 24;
|
|
|
31
32
|
* the exact retrieval setup the user had. Kept structural (not depending on
|
|
32
33
|
* the context module) so this hook remains free of UI layer imports.
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* aggregate ranking meaningless. The read path tolerates and migrates legacy
|
|
38
|
-
* entries silently. */
|
|
35
|
+
* Per-KB `retrieval` / `topK` 为可选 override:留空则在请求组装阶段继承会话级
|
|
36
|
+
* 全局参数,单 KB 自定义并不会破坏跨 KB 排序——上层在合并前就已经按 KB 各自
|
|
37
|
+
* 的配置打分,再由聚合 topK 统一截断。 */
|
|
39
38
|
export interface ChatSessionMount {
|
|
40
39
|
id: string;
|
|
41
40
|
knowledgeBaseName: string;
|
|
42
41
|
subspace?: string[];
|
|
42
|
+
/** Per-mount retrieval override; falls back to session-wide config when omitted. */
|
|
43
|
+
retrieval?: ChatRetrievalConfig;
|
|
44
|
+
/** Per-mount per-KB topK override; falls back to session-wide perKbTopK when omitted. */
|
|
45
|
+
topK?: number;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/** Flat retrieval configuration that mirrors a subset of `RetrievalInput`.
|
|
@@ -57,6 +60,21 @@ export interface ChatRetrievalConfig {
|
|
|
57
60
|
modelProvider?: string;
|
|
58
61
|
}
|
|
59
62
|
|
|
63
|
+
export interface ChatSessionMemoryScope {
|
|
64
|
+
appId: string;
|
|
65
|
+
tenantId: string;
|
|
66
|
+
agentId: string;
|
|
67
|
+
runId: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ChatSessionMemoryBinding {
|
|
71
|
+
id: string;
|
|
72
|
+
memoryStoreName: string;
|
|
73
|
+
scope: ChatSessionMemoryScope;
|
|
74
|
+
topK?: number;
|
|
75
|
+
autoSave: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
60
78
|
export interface ChatSessionConfig {
|
|
61
79
|
providerId?: string;
|
|
62
80
|
model?: string;
|
|
@@ -69,6 +87,7 @@ export interface ChatSessionConfig {
|
|
|
69
87
|
/** Session-wide retrieval params shared by every mounted KB. */
|
|
70
88
|
retrieval?: ChatRetrievalConfig;
|
|
71
89
|
mounts: ChatSessionMount[];
|
|
90
|
+
memory?: ChatSessionMemoryBinding;
|
|
72
91
|
}
|
|
73
92
|
|
|
74
93
|
export interface ChatSession {
|
|
@@ -133,11 +152,47 @@ function sanitizeSessions(parsed: unknown): ChatSession[] {
|
|
|
133
152
|
id: m.id,
|
|
134
153
|
knowledgeBaseName: m.knowledgeBaseName,
|
|
135
154
|
...(m.subspace && m.subspace.length ? { subspace: m.subspace } : {}),
|
|
155
|
+
...(m.retrieval ? { retrieval: m.retrieval } : {}),
|
|
156
|
+
...(typeof m.topK === "number" ? { topK: m.topK } : {}),
|
|
136
157
|
})),
|
|
158
|
+
memory: sanitizeMemoryBinding(s.config?.memory),
|
|
137
159
|
},
|
|
138
160
|
}));
|
|
139
161
|
}
|
|
140
162
|
|
|
163
|
+
function sanitizeMemoryBinding(
|
|
164
|
+
raw: unknown,
|
|
165
|
+
): ChatSessionMemoryBinding | undefined {
|
|
166
|
+
if (!raw || typeof raw !== "object") return undefined;
|
|
167
|
+
const r = raw as Partial<ChatSessionMemoryBinding>;
|
|
168
|
+
if (typeof r.memoryStoreName !== "string" || !r.memoryStoreName) return undefined;
|
|
169
|
+
const s = r.scope;
|
|
170
|
+
if (
|
|
171
|
+
!s ||
|
|
172
|
+
typeof s.appId !== "string" ||
|
|
173
|
+
typeof s.tenantId !== "string" ||
|
|
174
|
+
typeof s.agentId !== "string" ||
|
|
175
|
+
typeof s.runId !== "string" ||
|
|
176
|
+
!s.appId ||
|
|
177
|
+
!s.tenantId ||
|
|
178
|
+
!s.agentId ||
|
|
179
|
+
!s.runId
|
|
180
|
+
) {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
// 兜底分支只服务于"老快照 / 被手动改坏的数据"。正常路径的 binding 由 reducer
|
|
185
|
+
// 在 SET_MEMORY 时就铸了稳定 id;这里 newId() 每次重生属于可接受代价。
|
|
186
|
+
id: typeof r.id === "string" && r.id ? r.id : newId("memory"),
|
|
187
|
+
memoryStoreName: r.memoryStoreName,
|
|
188
|
+
scope: { appId: s.appId, tenantId: s.tenantId, agentId: s.agentId, runId: s.runId },
|
|
189
|
+
...(Number.isInteger(r.topK) && (r.topK as number) > 0
|
|
190
|
+
? { topK: r.topK as number }
|
|
191
|
+
: {}),
|
|
192
|
+
autoSave: r.autoSave !== false,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
141
196
|
function readStorageKey(storageKey: string): ChatSession[] {
|
|
142
197
|
if (typeof window === "undefined") return [];
|
|
143
198
|
try {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { getDocument } from "@/services/documents";
|
|
3
|
+
import { queryKeys } from "@/lib/query-keys";
|
|
4
|
+
import { useRuntimeContext } from "@/providers/runtime-context-provider";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Fetch a single document via DescribeDocument. The list endpoint omits the
|
|
8
|
+
* `metadata` field, so anything that needs to render or edit metadata must
|
|
9
|
+
* use this hook rather than reading from the listDocuments cache.
|
|
10
|
+
*/
|
|
11
|
+
export function useDocument(
|
|
12
|
+
knowledgeBaseName: string,
|
|
13
|
+
docId: string | null | undefined,
|
|
14
|
+
options?: { subspace?: string; enabled?: boolean },
|
|
15
|
+
) {
|
|
16
|
+
const { context, ready } = useRuntimeContext();
|
|
17
|
+
const { subspace, enabled = true } = options ?? {};
|
|
18
|
+
return useQuery({
|
|
19
|
+
queryKey: queryKeys.document(
|
|
20
|
+
context.dataScopeKey,
|
|
21
|
+
knowledgeBaseName,
|
|
22
|
+
docId,
|
|
23
|
+
subspace,
|
|
24
|
+
),
|
|
25
|
+
queryFn: () => getDocument(knowledgeBaseName, docId as string, { subspace }),
|
|
26
|
+
enabled: ready && !!knowledgeBaseName && !!docId && enabled,
|
|
27
|
+
staleTime: 30_000,
|
|
28
|
+
});
|
|
29
|
+
}
|