@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
|
@@ -15,9 +15,34 @@ import type {
|
|
|
15
15
|
ChatSessionMount,
|
|
16
16
|
} from "@/hooks/use-chat-history";
|
|
17
17
|
import { assembleRetrievalConfiguration } from "@/components/retrieval/assemble-retrieval-configuration";
|
|
18
|
+
import { newId } from "@/lib/random-id";
|
|
18
19
|
|
|
19
20
|
export type MountItem = ChatSessionMount;
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* 绑定里存的 scope 是*写* scope:四个字段都齐全且非通配符。
|
|
24
|
+
* 服务端在检索时自行派生读 scope(agentId="*", runId="*"),客户端
|
|
25
|
+
* 永远不发通配符。
|
|
26
|
+
*/
|
|
27
|
+
export interface ChatMemoryWriteScope {
|
|
28
|
+
appId: string;
|
|
29
|
+
tenantId: string;
|
|
30
|
+
agentId: string;
|
|
31
|
+
runId: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ChatMemoryBinding {
|
|
35
|
+
id: string;
|
|
36
|
+
memoryStoreName: string;
|
|
37
|
+
scope: ChatMemoryWriteScope;
|
|
38
|
+
topK?: number;
|
|
39
|
+
autoSave: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type ChatMemoryPatch =
|
|
43
|
+
Partial<Omit<ChatMemoryBinding, "id" | "scope">> &
|
|
44
|
+
{ scope?: Partial<ChatMemoryWriteScope> };
|
|
45
|
+
|
|
21
46
|
export interface ChatConfigState {
|
|
22
47
|
providerId: string;
|
|
23
48
|
model: string;
|
|
@@ -27,6 +52,7 @@ export interface ChatConfigState {
|
|
|
27
52
|
perKbTopK: number;
|
|
28
53
|
retrieval: ChatRetrievalConfig;
|
|
29
54
|
mounts: MountItem[];
|
|
55
|
+
memory?: ChatMemoryBinding;
|
|
30
56
|
}
|
|
31
57
|
|
|
32
58
|
/** Default aggregate topK applied when a session is first created. Mirrors
|
|
@@ -51,7 +77,7 @@ export const DEFAULT_RETRIEVAL: ChatRetrievalConfig = {
|
|
|
51
77
|
weightFullText: 0.3,
|
|
52
78
|
};
|
|
53
79
|
|
|
54
|
-
const INITIAL_STATE: ChatConfigState = {
|
|
80
|
+
export const INITIAL_STATE: ChatConfigState = {
|
|
55
81
|
providerId: "",
|
|
56
82
|
model: "",
|
|
57
83
|
systemPrompt: "",
|
|
@@ -72,12 +98,15 @@ type Action =
|
|
|
72
98
|
| { type: "SET_RETRIEVAL"; value: ChatRetrievalConfig }
|
|
73
99
|
| { type: "ADD_MOUNT"; mount: MountItem }
|
|
74
100
|
| { type: "UPDATE_MOUNT"; id: string; patch: Partial<MountItem> }
|
|
101
|
+
| { type: "RESET_MOUNT_RETRIEVAL"; id: string }
|
|
75
102
|
| { type: "REMOVE_MOUNT"; id: string }
|
|
76
103
|
| { type: "REORDER_MOUNTS"; ids: string[] }
|
|
104
|
+
| { type: "SET_MEMORY"; binding: Omit<ChatMemoryBinding, "id"> | undefined }
|
|
105
|
+
| { type: "UPDATE_MEMORY"; patch: ChatMemoryPatch }
|
|
77
106
|
| { type: "HYDRATE"; state: Partial<ChatConfigState> }
|
|
78
107
|
| { type: "RESET" };
|
|
79
108
|
|
|
80
|
-
function reducer(state: ChatConfigState, action: Action): ChatConfigState {
|
|
109
|
+
export function reducer(state: ChatConfigState, action: Action): ChatConfigState {
|
|
81
110
|
switch (action.type) {
|
|
82
111
|
case "SET_PROVIDER":
|
|
83
112
|
return { ...state, providerId: action.providerId, model: action.model };
|
|
@@ -108,6 +137,21 @@ function reducer(state: ChatConfigState, action: Action): ChatConfigState {
|
|
|
108
137
|
m.id === action.id ? { ...m, ...action.patch } : m,
|
|
109
138
|
),
|
|
110
139
|
};
|
|
140
|
+
// 清除单 KB 的自定义检索参数:透过 partial spread 调用者不能以 undefined
|
|
141
|
+
// 重置字段({ retrieval: undefined } 仍会使原始键存在),这里重建 mount
|
|
142
|
+
// 折叠对象,确保字段从存在变为不存在,让后续 `??` fallback 生效。
|
|
143
|
+
case "RESET_MOUNT_RETRIEVAL":
|
|
144
|
+
return {
|
|
145
|
+
...state,
|
|
146
|
+
mounts: state.mounts.map((m) => {
|
|
147
|
+
if (m.id !== action.id) return m;
|
|
148
|
+
// 按需保留 id / knowledgeBaseName / subspace;丢弃 retrieval / topK。
|
|
149
|
+
const { retrieval: _retrieval, topK: _topK, ...rest } = m;
|
|
150
|
+
void _retrieval;
|
|
151
|
+
void _topK;
|
|
152
|
+
return rest;
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
111
155
|
case "REMOVE_MOUNT":
|
|
112
156
|
return { ...state, mounts: state.mounts.filter((m) => m.id !== action.id) };
|
|
113
157
|
case "REORDER_MOUNTS": {
|
|
@@ -119,6 +163,31 @@ function reducer(state: ChatConfigState, action: Action): ChatConfigState {
|
|
|
119
163
|
}
|
|
120
164
|
case "HYDRATE":
|
|
121
165
|
return { ...state, ...action.state };
|
|
166
|
+
// SET_MEMORY 同一绑定的 id 保持稳定;只有从无到有时才铸新 id,避免不必要的 React key 抖动。
|
|
167
|
+
case "SET_MEMORY": {
|
|
168
|
+
if (!action.binding) return { ...state, memory: undefined };
|
|
169
|
+
const runId = action.binding.scope.runId || newId("run");
|
|
170
|
+
return {
|
|
171
|
+
...state,
|
|
172
|
+
memory: {
|
|
173
|
+
id: state.memory?.id ?? newId("memory"),
|
|
174
|
+
...action.binding,
|
|
175
|
+
scope: { ...action.binding.scope, runId },
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
case "UPDATE_MEMORY": {
|
|
180
|
+
if (!state.memory) return state;
|
|
181
|
+
const { scope: patchScope, ...rest } = action.patch;
|
|
182
|
+
return {
|
|
183
|
+
...state,
|
|
184
|
+
memory: {
|
|
185
|
+
...state.memory,
|
|
186
|
+
...rest,
|
|
187
|
+
scope: { ...state.memory.scope, ...(patchScope ?? {}) },
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
122
191
|
case "RESET":
|
|
123
192
|
return INITIAL_STATE;
|
|
124
193
|
default:
|
|
@@ -136,8 +205,12 @@ export interface ChatConfigContextValue extends ChatConfigState {
|
|
|
136
205
|
setRetrieval(value: ChatRetrievalConfig): void;
|
|
137
206
|
addMount(mount: MountItem): void;
|
|
138
207
|
updateMount(id: string, patch: Partial<MountItem>): void;
|
|
208
|
+
/** Drop the per-KB retrieval/topK overrides for `id` so it inherits global defaults. */
|
|
209
|
+
resetMountRetrieval(id: string): void;
|
|
139
210
|
removeMount(id: string): void;
|
|
140
211
|
reorderMounts(ids: string[]): void;
|
|
212
|
+
setMemory(binding: Omit<ChatMemoryBinding, "id"> | undefined): void;
|
|
213
|
+
updateMemory(patch: ChatMemoryPatch): void;
|
|
141
214
|
hydrate(state: Partial<ChatConfigState>): void;
|
|
142
215
|
reset(): void;
|
|
143
216
|
/** Serialize the current config for persistence into a chat session. */
|
|
@@ -162,8 +235,12 @@ export function ChatConfigProvider({ children }: { children: ReactNode }) {
|
|
|
162
235
|
setRetrieval: (v) => dispatch({ type: "SET_RETRIEVAL", value: v }),
|
|
163
236
|
addMount: (m) => dispatch({ type: "ADD_MOUNT", mount: m }),
|
|
164
237
|
updateMount: (id, patch) => dispatch({ type: "UPDATE_MOUNT", id, patch }),
|
|
238
|
+
resetMountRetrieval: (id) =>
|
|
239
|
+
dispatch({ type: "RESET_MOUNT_RETRIEVAL", id }),
|
|
165
240
|
removeMount: (id) => dispatch({ type: "REMOVE_MOUNT", id }),
|
|
166
241
|
reorderMounts: (ids) => dispatch({ type: "REORDER_MOUNTS", ids }),
|
|
242
|
+
setMemory: (b) => dispatch({ type: "SET_MEMORY", binding: b }),
|
|
243
|
+
updateMemory: (p) => dispatch({ type: "UPDATE_MEMORY", patch: p }),
|
|
167
244
|
hydrate: (s) => dispatch({ type: "HYDRATE", state: s }),
|
|
168
245
|
reset: () => dispatch({ type: "RESET" }),
|
|
169
246
|
toSessionConfig: () => ({
|
|
@@ -175,6 +252,7 @@ export function ChatConfigProvider({ children }: { children: ReactNode }) {
|
|
|
175
252
|
perKbTopK: state.perKbTopK,
|
|
176
253
|
retrieval: state.retrieval,
|
|
177
254
|
mounts: state.mounts,
|
|
255
|
+
memory: state.memory,
|
|
178
256
|
}),
|
|
179
257
|
}),
|
|
180
258
|
[state],
|
|
@@ -198,31 +276,50 @@ export function useChatConfig(): ChatConfigContextValue {
|
|
|
198
276
|
* return undefined when no KB is mounted. Kept as a plain helper so it can
|
|
199
277
|
* run outside React rendering (e.g. in onClick handlers).
|
|
200
278
|
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* per KB, and the caller (chat route) applies a global aggregate cap after
|
|
205
|
-
* merging by score.
|
|
279
|
+
* 每个 mount 优先使用自己的 `retrieval` / `topK` override;未设置时 fallback
|
|
280
|
+
* 到会话级的 `state.retrieval` / `state.perKbTopK`。上层在 chat route 合并后
|
|
281
|
+
* 仍由 `state.aggregateTopK` 统一截断,跨 KB 的打分可比性责任交给服务端。
|
|
206
282
|
*/
|
|
207
283
|
export function buildRagFromMounts(state: ChatConfigState) {
|
|
208
284
|
if (!state.mounts.length) return undefined;
|
|
209
|
-
const retrievalConfiguration = assembleRetrievalConfiguration(
|
|
210
|
-
state.retrieval,
|
|
211
|
-
state.perKbTopK,
|
|
212
|
-
);
|
|
213
285
|
return {
|
|
214
|
-
knowledgeBases: state.mounts.map((m) =>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
286
|
+
knowledgeBases: state.mounts.map((m) => {
|
|
287
|
+
const effectiveRetrieval = m.retrieval ?? state.retrieval;
|
|
288
|
+
const effectiveTopK = m.topK ?? state.perKbTopK;
|
|
289
|
+
const retrievalConfiguration = assembleRetrievalConfiguration(
|
|
290
|
+
effectiveRetrieval,
|
|
291
|
+
effectiveTopK,
|
|
292
|
+
);
|
|
293
|
+
return {
|
|
294
|
+
knowledgeBaseName: m.knowledgeBaseName,
|
|
295
|
+
...(m.subspace?.length ? { subspace: m.subspace } : {}),
|
|
296
|
+
...(retrievalConfiguration
|
|
297
|
+
? { retrievalConfiguration: retrievalConfiguration as Record<string, unknown> }
|
|
298
|
+
: {}),
|
|
299
|
+
topK: effectiveTopK,
|
|
300
|
+
};
|
|
301
|
+
}),
|
|
222
302
|
topK: state.aggregateTopK,
|
|
223
303
|
};
|
|
224
304
|
}
|
|
225
305
|
|
|
306
|
+
/**
|
|
307
|
+
* 把当前绑定序列化成 `/api/v1/llm/chat` 请求体里的 `memory` 段。
|
|
308
|
+
* 任一 scope 字段为空 ⇒ 视作未绑定,返回 undefined。
|
|
309
|
+
*/
|
|
310
|
+
export function buildMemoryFromBinding(state: ChatConfigState) {
|
|
311
|
+
const m = state.memory;
|
|
312
|
+
if (!m) return undefined;
|
|
313
|
+
const { appId, tenantId, agentId, runId } = m.scope;
|
|
314
|
+
if (!appId || !tenantId || !agentId || !runId) return undefined;
|
|
315
|
+
return {
|
|
316
|
+
memoryStoreName: m.memoryStoreName,
|
|
317
|
+
scope: { appId, tenantId, agentId, runId },
|
|
318
|
+
...(typeof m.topK === "number" ? { topK: m.topK } : {}),
|
|
319
|
+
autoSave: m.autoSave,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
226
323
|
/** Hook shortcut so downstream components don't have to re-derive the rag. */
|
|
227
324
|
export function useChatRag() {
|
|
228
325
|
const cfg = useChatConfig();
|
|
@@ -25,6 +25,7 @@ import { TemperatureSlider } from "@/components/shared/temperature-slider";
|
|
|
25
25
|
import { newId } from "@/lib/random-id";
|
|
26
26
|
|
|
27
27
|
import { AddMountRow } from "./add-mount-row";
|
|
28
|
+
import { MemoryBindSection } from "./memory-bind-section";
|
|
28
29
|
import { MountEmptyState } from "./mount-empty-state";
|
|
29
30
|
import { MountRow } from "./mount-row";
|
|
30
31
|
import { UnifiedRetrievalSection } from "./unified-retrieval-section";
|
|
@@ -186,6 +187,7 @@ export function ChatMountConfig({ open, onOpenChange, onSave }: ChatMountConfigP
|
|
|
186
187
|
key={mount.id}
|
|
187
188
|
mount={mount}
|
|
188
189
|
subspaceEnabled={kb?.subspace === true}
|
|
190
|
+
knowledgeBase={kb}
|
|
189
191
|
/>
|
|
190
192
|
);
|
|
191
193
|
})}
|
|
@@ -214,6 +216,9 @@ export function ChatMountConfig({ open, onOpenChange, onSave }: ChatMountConfigP
|
|
|
214
216
|
: undefined
|
|
215
217
|
}
|
|
216
218
|
/>
|
|
219
|
+
|
|
220
|
+
{/* ---------- Memory binding ---------- */}
|
|
221
|
+
<MemoryBindSection />
|
|
217
222
|
</div>
|
|
218
223
|
|
|
219
224
|
<SheetFooter className="gap-2 border-t border-[hsl(var(--border))] bg-[hsl(var(--surface))] px-6 py-3 sm:items-center sm:justify-between sm:space-x-0">
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { useId, useState } from "react";
|
|
5
|
+
import { Brain, Check, Copy, Plus, Sparkles, Trash2 } from "lucide-react";
|
|
6
|
+
import { toast } from "sonner";
|
|
7
|
+
|
|
8
|
+
import { useMemoryStores } from "@/hooks/use-memory-stores";
|
|
9
|
+
import { Button } from "@/components/ui/button";
|
|
10
|
+
import { Input } from "@/components/ui/input";
|
|
11
|
+
import { Label } from "@/components/ui/label";
|
|
12
|
+
import { Switch } from "@/components/ui/switch";
|
|
13
|
+
import {
|
|
14
|
+
Select,
|
|
15
|
+
SelectContent,
|
|
16
|
+
SelectItem,
|
|
17
|
+
SelectTrigger,
|
|
18
|
+
SelectValue,
|
|
19
|
+
} from "@/components/ui/select";
|
|
20
|
+
import { useChatConfig } from "@/components/chat/chat-config-context";
|
|
21
|
+
import { cn } from "@/lib/utils";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 抽屉里的「记忆库」区块。
|
|
25
|
+
*
|
|
26
|
+
* 骨架与同抽屉里的「挂载的知识库 / 统一检索参数」section 严格对齐:
|
|
27
|
+
* - 同样的 `border-t pt-4` 外壳 + 「标题 + 副标题 + 右侧紧凑数字输入」的 header
|
|
28
|
+
* - 未绑定 → 与 MountEmptyState 同款 hero 卡片(gradient bg、primary-soft icon tile)
|
|
29
|
+
* - 已绑定 → 与 MountRow 同款单行 chip 展示选中的 store;下方独立配置子区
|
|
30
|
+
*
|
|
31
|
+
* 绑定状态来自抽屉 reducer(跨会话 hydrate),故继续用受控 Input/Select,
|
|
32
|
+
* 不迁 react-hook-form —— 双向同步成本远高于收益。
|
|
33
|
+
*/
|
|
34
|
+
export function MemoryBindSection() {
|
|
35
|
+
const cfg = useChatConfig();
|
|
36
|
+
const { data: storesPage, isLoading } = useMemoryStores();
|
|
37
|
+
const stores = storesPage?.items ?? [];
|
|
38
|
+
const binding = cfg.memory;
|
|
39
|
+
const topKId = useId();
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className="space-y-3 border-t border-[hsl(var(--border))] pt-4">
|
|
43
|
+
<div className="flex items-center justify-between">
|
|
44
|
+
<div>
|
|
45
|
+
<Label className="text-sm font-medium">绑定的记忆库</Label>
|
|
46
|
+
<p className="mt-0.5 text-xs text-muted-foreground">
|
|
47
|
+
{binding
|
|
48
|
+
? `每轮检索 Top-${binding.topK ?? 5},对话后写回当前范围`
|
|
49
|
+
: "绑定后服务端在每轮对话前检索、对话后写回;同一应用 + 租户下记忆跨智能体可共享"}
|
|
50
|
+
</p>
|
|
51
|
+
</div>
|
|
52
|
+
{binding && (
|
|
53
|
+
<div className="flex items-center gap-1.5">
|
|
54
|
+
<Label
|
|
55
|
+
htmlFor={topKId}
|
|
56
|
+
className="text-xs text-muted-foreground"
|
|
57
|
+
title="每轮检索返回的记忆条数上限"
|
|
58
|
+
>
|
|
59
|
+
Top-K
|
|
60
|
+
</Label>
|
|
61
|
+
<Input
|
|
62
|
+
id={topKId}
|
|
63
|
+
type="number"
|
|
64
|
+
min={1}
|
|
65
|
+
max={50}
|
|
66
|
+
className="h-8 w-20"
|
|
67
|
+
value={binding.topK ?? 5}
|
|
68
|
+
onChange={(e) => {
|
|
69
|
+
const n = parseInt(e.target.value, 10);
|
|
70
|
+
const clamped =
|
|
71
|
+
Number.isFinite(n) && n >= 1 && n <= 50 ? n : 5;
|
|
72
|
+
cfg.updateMemory({ topK: clamped });
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
{!binding ? (
|
|
80
|
+
<MemoryBindEmptyState
|
|
81
|
+
stores={stores}
|
|
82
|
+
isLoading={isLoading}
|
|
83
|
+
onBind={() =>
|
|
84
|
+
cfg.setMemory({
|
|
85
|
+
memoryStoreName: stores[0]?.memoryStoreName ?? "",
|
|
86
|
+
scope: { appId: "", tenantId: "", agentId: "", runId: "" },
|
|
87
|
+
autoSave: true,
|
|
88
|
+
topK: 5,
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
/>
|
|
92
|
+
) : (
|
|
93
|
+
<>
|
|
94
|
+
<MemoryStoreRow
|
|
95
|
+
value={binding.memoryStoreName}
|
|
96
|
+
stores={stores}
|
|
97
|
+
onChange={(v) => cfg.updateMemory({ memoryStoreName: v })}
|
|
98
|
+
onUnbind={() => cfg.setMemory(undefined)}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<MemoryBindingForm
|
|
102
|
+
appId={binding.scope.appId}
|
|
103
|
+
tenantId={binding.scope.tenantId}
|
|
104
|
+
agentId={binding.scope.agentId}
|
|
105
|
+
runId={binding.scope.runId}
|
|
106
|
+
autoSave={binding.autoSave}
|
|
107
|
+
onScopeChange={(patch) => cfg.updateMemory({ scope: patch })}
|
|
108
|
+
onAutoSaveChange={(v) => cfg.updateMemory({ autoSave: v })}
|
|
109
|
+
/>
|
|
110
|
+
</>
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 未绑定时的 hero 空态。结构、token、动效与 `MountEmptyState` 一致:
|
|
118
|
+
* gradient 背景 + dashed primary 边框 + 居中 icon tile + 行动按钮。
|
|
119
|
+
*/
|
|
120
|
+
function MemoryBindEmptyState(props: {
|
|
121
|
+
stores: ReadonlyArray<{ memoryStoreName: string }>;
|
|
122
|
+
isLoading: boolean;
|
|
123
|
+
onBind: () => void;
|
|
124
|
+
}) {
|
|
125
|
+
const { stores, isLoading, onBind } = props;
|
|
126
|
+
const hasNoStores = !isLoading && stores.length === 0;
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div
|
|
130
|
+
className="animate-home-reveal relative overflow-hidden rounded-lg border border-dashed border-[hsl(var(--primary)/0.35)] bg-gradient-to-br from-[hsl(var(--primary-soft))] via-[hsl(var(--surface))] to-[hsl(var(--surface))] px-5 py-6 text-center"
|
|
131
|
+
role="region"
|
|
132
|
+
aria-label="绑定记忆库"
|
|
133
|
+
>
|
|
134
|
+
<Sparkles
|
|
135
|
+
className="pointer-events-none absolute right-3 top-3 h-3.5 w-3.5 text-[hsl(var(--primary)/0.45)]"
|
|
136
|
+
aria-hidden
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<div className="mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-xl bg-[hsl(var(--primary-soft))] ring-1 ring-[hsl(var(--primary)/0.18)]">
|
|
140
|
+
<Brain className="h-6 w-6 text-[hsl(var(--primary))]" />
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<h3 className="text-sm font-semibold text-[hsl(var(--foreground))]">
|
|
144
|
+
{hasNoStores ? "还没有任何记忆库" : "绑定记忆库以让对话拥有长期记忆"}
|
|
145
|
+
</h3>
|
|
146
|
+
<p className="mx-auto mt-1 max-w-[320px] text-xs leading-relaxed text-[hsl(var(--muted-foreground))]">
|
|
147
|
+
{hasNoStores
|
|
148
|
+
? "创建第一个记忆库后,即可在对话中绑定并自动写回 / 检索"
|
|
149
|
+
: "绑定后服务端会在每轮对话前检索相关记忆注入到 system prompt,对话结束后自动写回到当前范围"}
|
|
150
|
+
</p>
|
|
151
|
+
|
|
152
|
+
<div className="mt-4 flex flex-col items-center gap-2">
|
|
153
|
+
{hasNoStores ? (
|
|
154
|
+
<Button asChild size="default" className="h-9 px-4">
|
|
155
|
+
<Link href="/memory/create">
|
|
156
|
+
<Brain className="h-4 w-4" />
|
|
157
|
+
创建记忆库
|
|
158
|
+
</Link>
|
|
159
|
+
</Button>
|
|
160
|
+
) : (
|
|
161
|
+
<Button
|
|
162
|
+
type="button"
|
|
163
|
+
size="default"
|
|
164
|
+
className="h-9 px-4"
|
|
165
|
+
disabled={isLoading}
|
|
166
|
+
onClick={onBind}
|
|
167
|
+
>
|
|
168
|
+
<Plus className="h-4 w-4" />
|
|
169
|
+
绑定记忆库
|
|
170
|
+
</Button>
|
|
171
|
+
)}
|
|
172
|
+
|
|
173
|
+
{!hasNoStores && !isLoading ? (
|
|
174
|
+
<p className="text-[11px] text-[hsl(var(--muted-foreground))]">
|
|
175
|
+
从已有的{" "}
|
|
176
|
+
<span className="font-medium text-[hsl(var(--foreground))]">
|
|
177
|
+
{stores.length}
|
|
178
|
+
</span>{" "}
|
|
179
|
+
个记忆库中选择
|
|
180
|
+
</p>
|
|
181
|
+
) : null}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 已绑定时展示选中的 store —— 与 MountRow 同款 chip:圆角浅 muted 背景 +
|
|
189
|
+
* 单行 + 末尾删除(解除绑定)。把"切换 store"做成行内 Select,避免再起一行。
|
|
190
|
+
*/
|
|
191
|
+
function MemoryStoreRow(props: {
|
|
192
|
+
value: string;
|
|
193
|
+
stores: ReadonlyArray<{ memoryStoreName: string }>;
|
|
194
|
+
onChange: (v: string) => void;
|
|
195
|
+
onUnbind: () => void;
|
|
196
|
+
}) {
|
|
197
|
+
return (
|
|
198
|
+
<div className="flex items-center gap-2 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.3)] px-3 py-2">
|
|
199
|
+
<Brain className="h-3.5 w-3.5 shrink-0 text-[hsl(var(--primary))]" />
|
|
200
|
+
<Select value={props.value} onValueChange={props.onChange}>
|
|
201
|
+
<SelectTrigger className="h-8 flex-1 border-0 bg-transparent px-1 text-sm font-medium shadow-none hover:bg-[hsl(var(--muted)/0.5)] focus:ring-0 focus:ring-offset-0">
|
|
202
|
+
<SelectValue placeholder="选择记忆库" />
|
|
203
|
+
</SelectTrigger>
|
|
204
|
+
<SelectContent>
|
|
205
|
+
{props.stores.map((s) => (
|
|
206
|
+
<SelectItem key={s.memoryStoreName} value={s.memoryStoreName}>
|
|
207
|
+
{s.memoryStoreName}
|
|
208
|
+
</SelectItem>
|
|
209
|
+
))}
|
|
210
|
+
</SelectContent>
|
|
211
|
+
</Select>
|
|
212
|
+
<Button
|
|
213
|
+
type="button"
|
|
214
|
+
variant="ghost"
|
|
215
|
+
size="icon"
|
|
216
|
+
className="h-7 w-7"
|
|
217
|
+
onClick={props.onUnbind}
|
|
218
|
+
title="解除绑定"
|
|
219
|
+
>
|
|
220
|
+
<Trash2 className="h-3.5 w-3.5 text-muted-foreground" />
|
|
221
|
+
</Button>
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* 写 scope + autoSave + runId 的配置子区。
|
|
228
|
+
*
|
|
229
|
+
* 视觉对齐 UnifiedRetrievalSection:浅分割线起头,本区共享同一种「次级
|
|
230
|
+
* label」节奏(`text-xs font-medium uppercase tracking-wider text-muted-foreground`)。
|
|
231
|
+
*/
|
|
232
|
+
function MemoryBindingForm(props: {
|
|
233
|
+
appId: string;
|
|
234
|
+
tenantId: string;
|
|
235
|
+
agentId: string;
|
|
236
|
+
runId: string;
|
|
237
|
+
autoSave: boolean;
|
|
238
|
+
onScopeChange: (patch: {
|
|
239
|
+
appId?: string;
|
|
240
|
+
tenantId?: string;
|
|
241
|
+
agentId?: string;
|
|
242
|
+
}) => void;
|
|
243
|
+
onAutoSaveChange: (v: boolean) => void;
|
|
244
|
+
}) {
|
|
245
|
+
return (
|
|
246
|
+
<div className="space-y-4 border-t border-[hsl(var(--border-light))] pt-3">
|
|
247
|
+
<div className="space-y-2.5">
|
|
248
|
+
<div>
|
|
249
|
+
<Label className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
|
250
|
+
写入范围
|
|
251
|
+
</Label>
|
|
252
|
+
<p className="mt-1 text-[11px] leading-relaxed text-muted-foreground">
|
|
253
|
+
服务端在检索时把「智能体 / 会话」派生为通配 <code className="rounded bg-muted px-1 py-0.5 font-mono text-[10px]">*</code>,
|
|
254
|
+
因此同一应用 + 租户下不同智能体 / 不同会话可以读取彼此的记忆
|
|
255
|
+
</p>
|
|
256
|
+
</div>
|
|
257
|
+
<div className="grid grid-cols-2 gap-3">
|
|
258
|
+
<ScopeField
|
|
259
|
+
label="应用 *"
|
|
260
|
+
value={props.appId}
|
|
261
|
+
onChange={(v) => props.onScopeChange({ appId: v })}
|
|
262
|
+
/>
|
|
263
|
+
<ScopeField
|
|
264
|
+
label="租户 *"
|
|
265
|
+
value={props.tenantId}
|
|
266
|
+
onChange={(v) => props.onScopeChange({ tenantId: v })}
|
|
267
|
+
/>
|
|
268
|
+
<div className="col-span-2">
|
|
269
|
+
<ScopeField
|
|
270
|
+
label="智能体 *"
|
|
271
|
+
value={props.agentId}
|
|
272
|
+
onChange={(v) => props.onScopeChange({ agentId: v })}
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<div className="flex flex-row items-center justify-between gap-4 rounded-md border border-[hsl(var(--border))] p-3">
|
|
279
|
+
<div className="space-y-0.5">
|
|
280
|
+
<Label className="text-sm">对话后自动写入记忆</Label>
|
|
281
|
+
<p className="text-xs text-muted-foreground">
|
|
282
|
+
自动归档:把本轮用户 / 助手消息写入当前范围
|
|
283
|
+
</p>
|
|
284
|
+
</div>
|
|
285
|
+
<Switch
|
|
286
|
+
checked={props.autoSave}
|
|
287
|
+
onCheckedChange={props.onAutoSaveChange}
|
|
288
|
+
/>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
<RunIdField runId={props.runId} />
|
|
292
|
+
</div>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function ScopeField(props: {
|
|
297
|
+
label: string;
|
|
298
|
+
value: string;
|
|
299
|
+
onChange: (v: string) => void;
|
|
300
|
+
}) {
|
|
301
|
+
const id = useId();
|
|
302
|
+
const invalid = !props.value;
|
|
303
|
+
return (
|
|
304
|
+
<div className="space-y-1">
|
|
305
|
+
<Label htmlFor={id} className="text-xs">
|
|
306
|
+
{props.label}
|
|
307
|
+
</Label>
|
|
308
|
+
<Input
|
|
309
|
+
id={id}
|
|
310
|
+
value={props.value}
|
|
311
|
+
onChange={(e) => props.onChange(e.target.value)}
|
|
312
|
+
aria-invalid={invalid}
|
|
313
|
+
className={cn(
|
|
314
|
+
"h-9",
|
|
315
|
+
invalid && "border-[hsl(var(--destructive))]",
|
|
316
|
+
)}
|
|
317
|
+
/>
|
|
318
|
+
</div>
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function RunIdField({ runId }: { runId: string }) {
|
|
323
|
+
const [copied, setCopied] = useState(false);
|
|
324
|
+
|
|
325
|
+
async function handleCopy() {
|
|
326
|
+
if (!runId) return;
|
|
327
|
+
try {
|
|
328
|
+
await navigator.clipboard.writeText(runId);
|
|
329
|
+
setCopied(true);
|
|
330
|
+
toast.success("已复制会话 ID");
|
|
331
|
+
setTimeout(() => setCopied(false), 1500);
|
|
332
|
+
} catch {
|
|
333
|
+
toast.error("复制失败,请手动选择文本");
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return (
|
|
338
|
+
<div className="space-y-1.5">
|
|
339
|
+
<div className="flex items-center justify-between">
|
|
340
|
+
<Label className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
|
341
|
+
会话 ID
|
|
342
|
+
</Label>
|
|
343
|
+
<span
|
|
344
|
+
className="text-[10px] text-muted-foreground"
|
|
345
|
+
title="会话 ID 由当前对话自动生成并在整个对话内复用,用于串联同一会话的记忆"
|
|
346
|
+
>
|
|
347
|
+
自动生成 · 自动复用
|
|
348
|
+
</span>
|
|
349
|
+
</div>
|
|
350
|
+
<div className="flex items-center gap-2">
|
|
351
|
+
<code className="flex-1 truncate rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] px-2.5 py-1.5 font-mono text-[11px] text-muted-foreground">
|
|
352
|
+
{runId || "—"}
|
|
353
|
+
</code>
|
|
354
|
+
<Button
|
|
355
|
+
type="button"
|
|
356
|
+
variant="ghost"
|
|
357
|
+
size="icon"
|
|
358
|
+
className="h-8 w-8 shrink-0"
|
|
359
|
+
aria-label="复制会话 ID"
|
|
360
|
+
disabled={!runId}
|
|
361
|
+
onClick={handleCopy}
|
|
362
|
+
>
|
|
363
|
+
{copied ? (
|
|
364
|
+
<Check className="h-3.5 w-3.5 text-[hsl(var(--primary))]" />
|
|
365
|
+
) : (
|
|
366
|
+
<Copy className="h-3.5 w-3.5" />
|
|
367
|
+
)}
|
|
368
|
+
</Button>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
);
|
|
372
|
+
}
|