@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.
Files changed (342) hide show
  1. package/dist/commands/kb/create.d.ts.map +1 -1
  2. package/dist/commands/kb/create.js +9 -0
  3. package/dist/commands/kb/create.js.map +1 -1
  4. package/dist/commands/kb/retrieve.d.ts.map +1 -1
  5. package/dist/commands/kb/retrieve.js +40 -3
  6. package/dist/commands/kb/retrieve.js.map +1 -1
  7. package/dist/dashboard-runtime/dashboard/.next/BUILD_ID +1 -1
  8. package/dist/dashboard-runtime/dashboard/.next/build-manifest.json +5 -5
  9. package/dist/dashboard-runtime/dashboard/.next/prerender-manifest.json +3 -3
  10. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page/build-manifest.json +2 -2
  11. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  12. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  13. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page/build-manifest.json +2 -2
  14. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page.js.nft.json +1 -1
  15. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page_client-reference-manifest.js +1 -1
  16. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page/build-manifest.json +2 -2
  17. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page.js.nft.json +1 -1
  18. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page_client-reference-manifest.js +1 -1
  19. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page/build-manifest.json +2 -2
  20. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page.js.nft.json +1 -1
  21. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page_client-reference-manifest.js +1 -1
  22. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page/build-manifest.json +2 -2
  23. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page.js.nft.json +1 -1
  24. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page_client-reference-manifest.js +1 -1
  25. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page/build-manifest.json +2 -2
  26. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page.js.nft.json +1 -1
  27. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page_client-reference-manifest.js +1 -1
  28. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page/build-manifest.json +2 -2
  29. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page.js.nft.json +1 -1
  30. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page_client-reference-manifest.js +1 -1
  31. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page/build-manifest.json +2 -2
  32. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page.js.nft.json +1 -1
  33. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page_client-reference-manifest.js +1 -1
  34. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page/build-manifest.json +2 -2
  35. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page.js.nft.json +1 -1
  36. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page_client-reference-manifest.js +1 -1
  37. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page/build-manifest.json +2 -2
  38. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page.js.nft.json +1 -1
  39. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page_client-reference-manifest.js +1 -1
  40. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page/build-manifest.json +2 -2
  41. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page.js.nft.json +1 -1
  42. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  43. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page/build-manifest.json +2 -2
  44. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page.js.nft.json +1 -1
  45. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page_client-reference-manifest.js +1 -1
  46. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page/build-manifest.json +2 -2
  47. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page.js.nft.json +1 -1
  48. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page_client-reference-manifest.js +1 -1
  49. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page/build-manifest.json +2 -2
  50. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page.js.nft.json +1 -1
  51. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page_client-reference-manifest.js +1 -1
  52. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page/build-manifest.json +2 -2
  53. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page.js.nft.json +1 -1
  54. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page_client-reference-manifest.js +1 -1
  55. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page/build-manifest.json +2 -2
  56. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page.js.nft.json +1 -1
  57. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page_client-reference-manifest.js +1 -1
  58. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page/build-manifest.json +2 -2
  59. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page.js.nft.json +1 -1
  60. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page_client-reference-manifest.js +1 -1
  61. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page/build-manifest.json +2 -2
  62. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page.js.nft.json +1 -1
  63. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page_client-reference-manifest.js +1 -1
  64. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page/build-manifest.json +2 -2
  65. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
  66. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
  67. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page/build-manifest.json +2 -2
  68. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
  69. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  70. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error/page/build-manifest.json +2 -2
  71. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.html +1 -1
  72. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.rsc +1 -1
  73. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  74. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  75. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  76. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  77. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  78. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page/build-manifest.json +2 -2
  79. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  80. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.html +1 -1
  81. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.rsc +14 -14
  82. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  83. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +3 -3
  84. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  85. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  86. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  87. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  88. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/status/route.js.nft.json +1 -1
  89. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/token/route.js.nft.json +1 -1
  90. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/route.js.nft.json +1 -1
  91. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/token/route.js.nft.json +1 -1
  92. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/use/route.js.nft.json +1 -1
  93. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/route.js.nft.json +1 -1
  94. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/chunks/route.js.nft.json +1 -1
  95. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/chunks/route.js.nft.json +1 -1
  96. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/route.js.nft.json +1 -1
  97. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/route.js.nft.json +1 -1
  98. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/upload/route.js.nft.json +1 -1
  99. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/retrieve/route.js.nft.json +1 -1
  100. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/route.js.nft.json +1 -1
  101. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/route.js.nft.json +1 -1
  102. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/chat/route.js.nft.json +1 -1
  103. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/models/route.js.nft.json +1 -1
  104. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/route.js.nft.json +1 -1
  105. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/test/route.js.nft.json +1 -1
  106. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/route.js.nft.json +1 -1
  107. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/logs/client/route.js.nft.json +1 -1
  108. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/messages/route.js.nft.json +1 -1
  109. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/requests/route.js.nft.json +1 -1
  110. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/route.js.nft.json +1 -1
  111. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/search/route.js.nft.json +1 -1
  112. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/[memoryId]/route.js.nft.json +1 -1
  113. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/route.js.nft.json +1 -1
  114. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/route.js.nft.json +1 -1
  115. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route.js.nft.json +1 -1
  116. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/runtime/context/route.js.nft.json +1 -1
  117. package/dist/dashboard-runtime/dashboard/.next/server/app/index.html +1 -1
  118. package/dist/dashboard-runtime/dashboard/.next/server/app/index.rsc +14 -14
  119. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  120. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_full.segment.rsc +14 -14
  121. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_head.segment.rsc +3 -3
  122. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_index.segment.rsc +10 -10
  123. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  124. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page/build-manifest.json +2 -2
  125. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  126. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.html +1 -1
  127. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.rsc +17 -17
  128. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_full.segment.rsc +17 -17
  129. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_head.segment.rsc +3 -3
  130. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_index.segment.rsc +10 -10
  131. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
  132. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  133. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding.segment.rsc +4 -4
  134. package/dist/dashboard-runtime/dashboard/.next/server/app/page/build-manifest.json +2 -2
  135. package/dist/dashboard-runtime/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  136. package/dist/dashboard-runtime/dashboard/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0n~ec7s.js +9 -6
  137. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__02p1x3t._.js +1 -1
  138. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0fglxiw._.js +1 -1
  139. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0lvi0g-._.js +2 -2
  140. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0q8vcw8._.js +1 -1
  141. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0b1r_app_(dashboard)_knowledge-base_[name]_documents_documents-client_tsx_0g2uxmt._.js +2 -2
  142. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0e95_src_app_(dashboard)_knowledge-base_[name]_settings_settings-client_tsx_13312zk._.js +1 -1
  143. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__08faq-z._.js +3 -0
  144. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0c94d.y._.js +3 -0
  145. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0jb9ccl._.js +1 -1
  146. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__13ylf4x._.js → [root-of-the-server]__0lgg04c._.js} +2 -2
  147. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__10rkv6z._.js +1 -1
  148. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_01-2v37._.js +1 -1
  149. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_01ag-vl._.js +3 -0
  150. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_09yzbcp._.js +1 -1
  151. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0atzifq._.js +3 -0
  152. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0f4u0.1._.js +1 -1
  153. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0gbt~hy._.js +1 -1
  154. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0gl7kh7._.js +3 -0
  155. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0j-q~ro._.js +1 -1
  156. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0jghj2_._.js +1 -1
  157. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0jlyg05._.js +3 -0
  158. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0n4gd_6._.js +1 -1
  159. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0l~-9i0._.js → _0tdjkbc._.js} +2 -2
  160. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0tej2s.._.js +1 -1
  161. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_10u~-xc._.js +3 -0
  162. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_12r9c8h._.js +1 -1
  163. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0.glq39._.js +3 -0
  164. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_00ofp7q._.js +1 -1
  165. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_05.qn9h._.js +3 -0
  166. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_065m1.j._.js +1 -1
  167. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0xf3ffa._.js +1 -1
  168. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0y49vhd._.js +1 -1
  169. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_10dsqx~._.js +1 -1
  170. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_knowledge-base_create_page_tsx_0916~g-._.js +1 -1
  171. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_settings_page_tsx_0y26.xu._.js +1 -1
  172. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_units_page_tsx_0.6xnei._.js +1 -1
  173. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_0ls1exu._.js +1 -1
  174. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_0ugdjlb._.js +1 -1
  175. package/dist/dashboard-runtime/dashboard/.next/server/middleware-build-manifest.js +5 -5
  176. package/dist/dashboard-runtime/dashboard/.next/server/pages/404.html +1 -1
  177. package/dist/dashboard-runtime/dashboard/.next/server/pages/500.html +1 -1
  178. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.js +1 -1
  179. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.json +1 -1
  180. package/dist/dashboard-runtime/dashboard/.next/static/chunks/00wmf85833643.js +1 -0
  181. package/dist/dashboard-runtime/dashboard/.next/static/chunks/02tj1_rhgobzv.js +1 -0
  182. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0mea2ylxe.umh.js → 02zf3qddfaw~u.js} +1 -1
  183. package/dist/dashboard-runtime/dashboard/.next/static/chunks/039i70t10axdd.css +1 -0
  184. package/dist/dashboard-runtime/dashboard/.next/static/chunks/04bfame9rk.3d.js +5 -0
  185. package/dist/dashboard-runtime/dashboard/.next/static/chunks/07rwb_uq9qcx4.js +1 -0
  186. package/dist/dashboard-runtime/dashboard/.next/static/chunks/07ygw8215kyvc.js +1 -0
  187. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0b5hr027rat4w.js +138 -0
  188. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0__g1ogrdh412.js → 0bkm-5yza5~d2.js} +1 -1
  189. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0lrw.bnws62y9.js → 0d7d.b.v9noym.js} +1 -1
  190. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0cto67_iw~p9z.js → 0fdofp-3kkc4g.js} +1 -1
  191. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0i8hdbek9j-fu.js +1 -0
  192. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ioivx4pbmayb.js +1 -0
  193. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0j-v5f_oscvfu.js +1 -0
  194. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0lp2g_27uyhuz.js → 0je7fmsrz2vok.js} +1 -1
  195. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jukioxtp1mn3.js +138 -0
  196. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0klidr2i6cd.g.js +1 -0
  197. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k~bkh1586r2i.js +1 -0
  198. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0nakvv2p1kjnf.js +1 -0
  199. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0t5vdnq4s.2yv.js +1 -0
  200. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0un~rqes29pcr.js +1 -0
  201. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0v.u57bsjppd_.js +1 -0
  202. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0fagnytrt.3oe.js → 0veza1g0elxa7.js} +1 -1
  203. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0x3w~yxvm1xsq.js +4 -0
  204. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0x5gol39unrgb.js +1 -0
  205. package/dist/dashboard-runtime/dashboard/.next/static/chunks/12s59v_sk0q-z.js +1 -0
  206. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{06uuhz24tvdt..js → 14~eqof4660i3.js} +1 -1
  207. package/dist/dashboard-runtime/dashboard/.next/static/chunks/16y3764x-fh1n.js +1 -0
  208. package/dist/dashboard-runtime/dashboard/.next/static/chunks/17mcnyr~1j7ih.js +1 -0
  209. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{turbopack-0w.hw6u8qra5z.js → turbopack-0~gu0g2v-1f11.js} +1 -1
  210. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/chat/page.tsx +5 -0
  211. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/knowledge-base/[name]/documents/documents-client.tsx +4 -1
  212. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/knowledge-base/[name]/layout-client.tsx +62 -26
  213. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/messages/page.tsx +8 -4
  214. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/requests/page.tsx +6 -2
  215. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/requests/request-detail-dialog.tsx +9 -9
  216. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/requests/requests-table.tsx +2 -2
  217. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/search/page.tsx +5 -1
  218. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/settings/page.tsx +56 -17
  219. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/units/page.tsx +11 -7
  220. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/create/page.tsx +1 -1
  221. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/page.tsx +1 -1
  222. package/dist/dashboard-runtime/dashboard/src/app/api/v1/knowledge-bases/[name]/documents/[docId]/route.ts +67 -0
  223. package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/memory-helpers.ts +45 -0
  224. package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/route.ts +334 -16
  225. package/dist/dashboard-runtime/dashboard/src/app/api/v1/logs/client/route.ts +13 -0
  226. package/dist/dashboard-runtime/dashboard/src/app/api/v1/oss/list/route.ts +1 -0
  227. package/dist/dashboard-runtime/dashboard/src/app/globals.css +23 -0
  228. package/dist/dashboard-runtime/dashboard/src/components/chat/chat-config-context.tsx +116 -19
  229. package/dist/dashboard-runtime/dashboard/src/components/chat/chat-mount-config.tsx +5 -0
  230. package/dist/dashboard-runtime/dashboard/src/components/chat/memory-bind-section.tsx +372 -0
  231. package/dist/dashboard-runtime/dashboard/src/components/chat/mount-retrieval-dialog.tsx +360 -0
  232. package/dist/dashboard-runtime/dashboard/src/components/chat/mount-row.tsx +49 -5
  233. package/dist/dashboard-runtime/dashboard/src/components/chat/unified-retrieval-section.tsx +61 -26
  234. package/dist/dashboard-runtime/dashboard/src/components/documents/doc-chunks-dialog.tsx +72 -20
  235. package/dist/dashboard-runtime/dashboard/src/components/documents/doc-detail-panel.tsx +578 -76
  236. package/dist/dashboard-runtime/dashboard/src/components/documents/doc-upload-dialog.tsx +9 -81
  237. package/dist/dashboard-runtime/dashboard/src/components/documents/oss-browser.tsx +42 -26
  238. package/dist/dashboard-runtime/dashboard/src/components/instance/connect-instance-form.tsx +5 -0
  239. package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/embedding-config-form.tsx +16 -2
  240. package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-card.tsx +37 -24
  241. package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-create-form.tsx +173 -86
  242. package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/kb-settings-form.tsx +319 -280
  243. package/dist/dashboard-runtime/dashboard/src/components/layout/detail-sidebar.tsx +47 -18
  244. package/dist/dashboard-runtime/dashboard/src/components/layout/sidebar-instance-card.tsx +2 -2
  245. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-add-dialog.tsx +2 -2
  246. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-create-form.tsx +84 -56
  247. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-edit-dialog.tsx +2 -2
  248. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-messages-table.tsx +3 -3
  249. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-requests-table.tsx +12 -12
  250. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-scope-bar.tsx +20 -11
  251. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-search-form.tsx +7 -7
  252. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-search-results.tsx +6 -6
  253. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-settings-form.tsx +90 -21
  254. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-store-card.tsx +1 -1
  255. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-store-list.tsx +1 -1
  256. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-unit-detail-panel.tsx +4 -4
  257. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-unit-table.tsx +2 -2
  258. package/dist/dashboard-runtime/dashboard/src/components/qa/qa-message.tsx +216 -5
  259. package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-form.tsx +241 -24
  260. package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-rerank-fields.tsx +1 -0
  261. package/dist/dashboard-runtime/dashboard/src/components/retrieval/retrieval-result-card.tsx +52 -4
  262. package/dist/dashboard-runtime/dashboard/src/components/shared/metadata-field-input.tsx +54 -0
  263. package/dist/dashboard-runtime/dashboard/src/components/shared/status-badge.tsx +10 -5
  264. package/dist/dashboard-runtime/dashboard/src/components/ui/nav-tab-bar.tsx +1 -1
  265. package/dist/dashboard-runtime/dashboard/src/hooks/use-chat-history.ts +60 -5
  266. package/dist/dashboard-runtime/dashboard/src/hooks/use-document.ts +29 -0
  267. package/dist/dashboard-runtime/dashboard/src/hooks/use-oss-list.ts +7 -5
  268. package/dist/dashboard-runtime/dashboard/src/hooks/use-qa-chat.ts +65 -11
  269. package/dist/dashboard-runtime/dashboard/src/hooks/use-update-document.ts +15 -0
  270. package/dist/dashboard-runtime/dashboard/src/lib/api-error-toast.ts +62 -0
  271. package/dist/dashboard-runtime/dashboard/src/lib/constants.ts +8 -0
  272. package/dist/dashboard-runtime/dashboard/src/lib/metadata-form.ts +88 -0
  273. package/dist/dashboard-runtime/dashboard/src/lib/query-keys.ts +14 -0
  274. package/dist/dashboard-runtime/dashboard/src/lib/server/api-helpers.ts +18 -5
  275. package/dist/dashboard-runtime/dashboard/src/lib/server/llm-client.ts +19 -1
  276. package/dist/dashboard-runtime/dashboard/src/lib/server/oss-client.ts +45 -16
  277. package/dist/dashboard-runtime/dashboard/src/schemas/knowledge-base.ts +6 -0
  278. package/dist/dashboard-runtime/dashboard/src/schemas/llm-chat.ts +20 -0
  279. package/dist/dashboard-runtime/dashboard/src/schemas/retrieval.ts +46 -27
  280. package/dist/dashboard-runtime/dashboard/src/services/api-client.ts +31 -2
  281. package/dist/dashboard-runtime/dashboard/src/services/documents.ts +36 -3
  282. package/dist/dashboard-runtime/dashboard/src/types/knowledge-base.ts +10 -0
  283. package/dist/dashboard-runtime/dashboard/src/types/llm-chat.ts +33 -0
  284. package/dist/dashboard-runtime/dashboard/src/types/retrieval.ts +9 -4
  285. package/dist/dashboard-runtime/dashboard/tailwind.config.ts +4 -0
  286. package/dist/dashboard-runtime/dashboard/vitest.config.mjs +5 -2
  287. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts +1 -0
  288. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
  289. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -0
  290. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
  291. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
  292. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/logging.js +1 -1
  293. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
  294. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +21 -5
  295. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
  296. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts +1 -0
  297. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
  298. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -0
  299. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
  300. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
  301. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/logging.js +1 -1
  302. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
  303. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +21 -5
  304. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
  305. package/dist/utils/read-image-input.d.ts +47 -0
  306. package/dist/utils/read-image-input.d.ts.map +1 -0
  307. package/dist/utils/read-image-input.js +89 -0
  308. package/dist/utils/read-image-input.js.map +1 -0
  309. package/package.json +2 -2
  310. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0aqzu8w._.js +0 -3
  311. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0hozzu6._.js +0 -3
  312. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0kd7szs._.js +0 -3
  313. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0tr8-3u._.js +0 -3
  314. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0xzh5yw._.js +0 -3
  315. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_12~3vfk._.js +0 -3
  316. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_13_lb.o._.js +0 -3
  317. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0ejgygh._.js +0 -3
  318. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_ui_0-tuf-h._.js +0 -3
  319. package/dist/dashboard-runtime/dashboard/.next/static/chunks/00tz~p479bdgl.js +0 -1
  320. package/dist/dashboard-runtime/dashboard/.next/static/chunks/02i9olo-312mq.js +0 -138
  321. package/dist/dashboard-runtime/dashboard/.next/static/chunks/062k9jbtd9.lv.js +0 -1
  322. package/dist/dashboard-runtime/dashboard/.next/static/chunks/069zf4m5f.se2.js +0 -1
  323. package/dist/dashboard-runtime/dashboard/.next/static/chunks/07cp19da_kfld.js +0 -5
  324. package/dist/dashboard-runtime/dashboard/.next/static/chunks/086esp1n941jl.js +0 -138
  325. package/dist/dashboard-runtime/dashboard/.next/static/chunks/09uxq~55qug8c.js +0 -1
  326. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0d29.l~3ip181.js +0 -1
  327. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ewpzgu_qf0wf.js +0 -4
  328. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jc31diex030o.js +0 -1
  329. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k79upjc40aky.css +0 -1
  330. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0snnsfosp3~gq.js +0 -1
  331. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0t0yqi68~eil6.js +0 -1
  332. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0th7u6qvdy3x2.js +0 -1
  333. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0tmwptel_4y0o.js +0 -1
  334. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u6_s-0w8.yr..js +0 -1
  335. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u9wtl06_b72x.js +0 -1
  336. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0v9d5wl9nsva3.js +0 -1
  337. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0~kfzxrhgbkaz.js +0 -1
  338. package/dist/dashboard-runtime/dashboard/.next/static/chunks/14.dp0-y_mhjo.js +0 -1
  339. package/dist/dashboard-runtime/dashboard/.next/static/chunks/15bzqpm440jvz.js +0 -1
  340. /package/dist/dashboard-runtime/dashboard/.next/static/{doYIl-pd6Sqax3bfUgN3q → EIbKHHti0Z1ephKfJzCKH}/_buildManifest.js +0 -0
  341. /package/dist/dashboard-runtime/dashboard/.next/static/{doYIl-pd6Sqax3bfUgN3q → EIbKHHti0Z1ephKfJzCKH}/_clientMiddlewareManifest.js +0 -0
  342. /package/dist/dashboard-runtime/dashboard/.next/static/{doYIl-pd6Sqax3bfUgN3q → EIbKHHti0Z1ephKfJzCKH}/_ssgManifest.js +0 -0
@@ -1,5 +1,6 @@
1
1
  import { useInfiniteQuery } from "@tanstack/react-query";
2
2
 
3
+ import { ApiClientError } from "@/services/api-client";
3
4
  import {
4
5
  listOssObjects,
5
6
  type OssListFile,
@@ -23,6 +24,8 @@ export interface UseOssListResult {
23
24
  fetchNextPage: () => void;
24
25
  refetch: () => void;
25
26
  error: Error | null;
27
+ /** Cast back to ApiClientError when present, so the UI can read displayMessage / upstream details. */
28
+ apiError: ApiClientError | null;
26
29
  /** Forwarded so the UI can render the "OSS_FORBIDDEN / NOT_CONFIGURED" state. */
27
30
  errorCode: string | null;
28
31
  }
@@ -65,11 +68,9 @@ export function useOssList(options: UseOssListOptions): UseOssListResult {
65
68
  files.push(...page.files);
66
69
  }
67
70
 
68
- // Surface error code from the standard envelope so the UI can switch on it.
69
- const errorCode =
70
- query.error && typeof query.error === "object" && "code" in query.error
71
- ? String((query.error as { code: unknown }).code ?? "")
72
- : null;
71
+ const apiError =
72
+ query.error instanceof ApiClientError ? query.error : null;
73
+ const errorCode = apiError ? apiError.code : null;
73
74
 
74
75
  return {
75
76
  folders,
@@ -84,6 +85,7 @@ export function useOssList(options: UseOssListOptions): UseOssListResult {
84
85
  void query.refetch();
85
86
  },
86
87
  error: query.error ?? null,
88
+ apiError,
87
89
  errorCode,
88
90
  };
89
91
  }
@@ -29,6 +29,8 @@ export interface UseQaChatOptions {
29
29
  systemPrompt: string;
30
30
  temperature?: number;
31
31
  rag?: ChatRequestBody["rag"];
32
+ /** 绑定的记忆库写 scope(完整四字段)。undefined ⇒ 该轮不开启记忆。 */
33
+ memory?: ChatRequestBody["memory"];
32
34
  /**
33
35
  * Invoked after each streaming turn settles (done / error / abort) with the
34
36
  * final message list. The chat homepage uses this to upsert the session
@@ -37,6 +39,39 @@ export interface UseQaChatOptions {
37
39
  onPersist?: (messages: ChatMessage[]) => void;
38
40
  }
39
41
 
42
+ /**
43
+ * Compose the wire body sent to `/api/v1/llm/chat` for one turn. Pulled out
44
+ * of `_runAssistantTurn` so it can be unit-tested without spinning up React
45
+ * (the dashboard's vitest config runs in node env, so renderHook is not
46
+ * available). The function MUST stay pure — no refs, no state, no closures
47
+ * over hook-local mutables.
48
+ */
49
+ export function buildChatRequestBody(
50
+ opts: Pick<
51
+ UseQaChatOptions,
52
+ | "activeInstance"
53
+ | "providerId"
54
+ | "model"
55
+ | "systemPrompt"
56
+ | "temperature"
57
+ | "rag"
58
+ | "memory"
59
+ >,
60
+ historyToSend: Array<{ role: ChatRole; content: string }>,
61
+ turnId: string,
62
+ ): ChatRequestBody {
63
+ return {
64
+ activeInstance: opts.activeInstance,
65
+ providerId: opts.providerId,
66
+ model: opts.model,
67
+ messages: historyToSend,
68
+ systemPrompt: opts.systemPrompt,
69
+ temperature: opts.temperature,
70
+ rag: opts.rag,
71
+ ...(opts.memory ? { memory: { ...opts.memory, turnId } } : {}),
72
+ };
73
+ }
74
+
40
75
  export interface UseQaChatResult {
41
76
  messages: ChatMessage[];
42
77
  isStreaming: boolean;
@@ -184,6 +219,7 @@ export function useQaChat(options: UseQaChatOptions): UseQaChatResult {
184
219
  async (
185
220
  assistantId: string,
186
221
  historyToSend: Array<{ role: ChatRole; content: string }>,
222
+ turnId: string,
187
223
  ) => {
188
224
  const opts = optionsRef.current;
189
225
  const controller = new AbortController();
@@ -203,15 +239,7 @@ export function useQaChat(options: UseQaChatOptions): UseQaChatResult {
203
239
  };
204
240
 
205
241
  try {
206
- const body: ChatRequestBody = {
207
- activeInstance: opts.activeInstance,
208
- providerId: opts.providerId,
209
- model: opts.model,
210
- messages: historyToSend,
211
- systemPrompt: opts.systemPrompt,
212
- temperature: opts.temperature,
213
- rag: opts.rag,
214
- };
242
+ const body = buildChatRequestBody(opts, historyToSend, turnId);
215
243
 
216
244
  if (devFlag("logChatRequest")) {
217
245
  // Diagnostic surface for the cross-session bleed investigation.
@@ -246,6 +274,21 @@ export function useQaChat(options: UseQaChatOptions): UseQaChatResult {
246
274
  retrievedChunks: event.chunks,
247
275
  retrievalGroups: event.byKnowledgeBase,
248
276
  });
277
+ } else if (event.type === "memory.start") {
278
+ // 把服务端真正发起的 SearchMemories query 落到当前 message 上:
279
+ // - chunks 命中时,服务端复用 rewriter 重写后的 query;
280
+ // - chunks 为空时,回退到原始用户输入。
281
+ // 渲染层把它放在「参考 N 条记忆」触发栏的副标题位置,便于
282
+ // 用户/调试者一眼看出「服务端到底拿什么去搜的记忆」。
283
+ updateAssistant({ memoryQuery: event.query });
284
+ } else if (event.type === "memory.done") {
285
+ // 永远写一次,即便是空数组——零命中由 MemoryHitsBlock 内部
286
+ // 的 `length > 0` 守卫吞掉,不在 hook 这层做条件分支,避免
287
+ // 「想看为什么没召回」时 message 上没有信号可查。
288
+ updateAssistant({ memoryHits: event.hits });
289
+ } else if (event.type === "memory.save.skipped") {
290
+ // 写回失败不打断对话流,留给 logger 处理。
291
+ console.warn("[chat] memory.save.skipped:", event.reason);
249
292
  } else if (event.type === "reasoning.delta") {
250
293
  const buf = pendingDeltasRef.current.get(assistantId) ?? {};
251
294
  buf.reasoning = (buf.reasoning ?? "") + event.delta;
@@ -339,12 +382,14 @@ export function useQaChat(options: UseQaChatOptions): UseQaChatResult {
339
382
  }
340
383
 
341
384
  setError(null);
385
+ const turnId = newId("turn");
342
386
  const userMsg: ChatMessage = {
343
387
  id: newId(),
344
388
  role: "user",
345
389
  content: trimmed,
346
390
  createdAt: Date.now(),
347
391
  status: "done",
392
+ turnId,
348
393
  };
349
394
  const assistantId = newId();
350
395
  // Snapshot whether this turn is RAG-enabled. The pill uses this to pick
@@ -376,7 +421,7 @@ export function useQaChat(options: UseQaChatOptions): UseQaChatResult {
376
421
  setMessages(nextMessages);
377
422
  setIsStreaming(true);
378
423
 
379
- await _runAssistantTurn(assistantId, historyToSend);
424
+ await _runAssistantTurn(assistantId, historyToSend, turnId);
380
425
  },
381
426
  [_runAssistantTurn],
382
427
  );
@@ -406,6 +451,15 @@ export function useQaChat(options: UseQaChatOptions): UseQaChatResult {
406
451
  const anchor = truncated[truncated.length - 1];
407
452
  if (!anchor || anchor.role !== "user") return;
408
453
 
454
+ // 复用 anchor 用户消息原有的 turnId;老消息(Task 10 之前持久化的)
455
+ // 没有 turnId 时退回新生成。把新生成的 turnId 回写到 anchor 上,
456
+ // 这样后续再次 reissueTurn 仍能复用同一个值(避免每次重发都触发新写入)。
457
+ const turnId = anchor.turnId ?? newId("turn");
458
+ if (!anchor.turnId) {
459
+ const idx = truncated.length - 1;
460
+ truncated[idx] = { ...anchor, turnId };
461
+ }
462
+
409
463
  setError(null);
410
464
 
411
465
  const assistantId = newId();
@@ -430,7 +484,7 @@ export function useQaChat(options: UseQaChatOptions): UseQaChatResult {
430
484
  setMessages(nextMessages);
431
485
  setIsStreaming(true);
432
486
 
433
- await _runAssistantTurn(assistantId, historyToSend);
487
+ await _runAssistantTurn(assistantId, historyToSend, turnId);
434
488
  },
435
489
  [_runAssistantTurn],
436
490
  );
@@ -0,0 +1,15 @@
1
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
2
+ import { updateDocument, type UpdateDocumentRequest } from "@/services/documents";
3
+
4
+ export function useUpdateDocument() {
5
+ const queryClient = useQueryClient();
6
+
7
+ return useMutation({
8
+ mutationFn: (request: UpdateDocumentRequest) => updateDocument(request),
9
+ // Returning the invalidate promise makes `mutateAsync` await the refetch,
10
+ // so callers see fresh data the moment `await mutate(...)` resolves
11
+ // instead of a brief flash of pre-update state.
12
+ onSuccess: () =>
13
+ queryClient.invalidateQueries({ queryKey: ["knowledge-bases"] }),
14
+ });
15
+ }
@@ -0,0 +1,62 @@
1
+ "use client";
2
+
3
+ import { toast } from "sonner";
4
+
5
+ import { ApiClientError } from "@/services/api-client";
6
+
7
+ interface ShowApiErrorOptions {
8
+ /**
9
+ * Used as the toast title when the error has no actionable code (e.g. a
10
+ * raw `Error` from a non-API path). Ignored for `ApiClientError`, which
11
+ * always shows `[CODE] message` so codes stay grep-able.
12
+ */
13
+ fallbackTitle?: string;
14
+ }
15
+
16
+ /**
17
+ * Standard error toast for any API failure.
18
+ *
19
+ * - `ApiClientError`: title is `[upstreamCode || code] message` so the user
20
+ * sees `[SignatureDoesNotMatch]` instead of just "Access denied", and
21
+ * the diagnostic context (trace id, upstream request id) lands in the
22
+ * description for support attachments.
23
+ * - Other errors: title is `fallbackTitle` if provided, otherwise the
24
+ * error's `message`.
25
+ */
26
+ export function showApiError(
27
+ error: unknown,
28
+ options: ShowApiErrorOptions = {},
29
+ ): void {
30
+ if (error instanceof ApiClientError) {
31
+ const description = formatErrorContext(error);
32
+ if (description) {
33
+ toast.error(error.displayMessage, { description });
34
+ } else {
35
+ toast.error(error.displayMessage);
36
+ }
37
+ return;
38
+ }
39
+ const message = error instanceof Error ? error.message : String(error ?? "未知错误");
40
+ toast.error(options.fallbackTitle ?? message);
41
+ }
42
+
43
+ /**
44
+ * Compact one-line context block shown beneath the main error message
45
+ * (toast description or EmptyState subtitle). Each part is short enough
46
+ * that the line stays readable but informative enough for a support agent
47
+ * to find the corresponding log entry.
48
+ */
49
+ export function formatErrorContext(error: ApiClientError): string {
50
+ const parts: string[] = [];
51
+ const upstreamReq = error.details?.upstreamRequestId;
52
+ if (upstreamReq) parts.push(`OSS RequestId: ${upstreamReq}`);
53
+ if (error.traceId) parts.push(`Trace: ${shortId(error.traceId)}`);
54
+ if (error.requestId && error.requestId !== upstreamReq) {
55
+ parts.push(`Req: ${shortId(error.requestId)}`);
56
+ }
57
+ return parts.join(" · ");
58
+ }
59
+
60
+ function shortId(id: string): string {
61
+ return id.length > 8 ? `${id.slice(0, 8)}…` : id;
62
+ }
@@ -20,3 +20,11 @@ export const METADATA_TYPES = [
20
20
  ] as const;
21
21
 
22
22
  export type MetadataType = (typeof METADATA_TYPES)[number];
23
+
24
+ /**
25
+ * 当后端返回裸 base64(无 data URL 前缀)时,补充的 MIME 类型兜底值。
26
+ * 浏览器会根据实际内容嗅探真实格式,此处只需保证是合法的 image/* 类型
27
+ * 以避免 CSP 拒绝渲染。选用 image/jpeg 是因为知识库文档处理产出的图片
28
+ * 绝大多数为 JPEG 格式。
29
+ */
30
+ export const IMAGE_FALLBACK_DATA_PREFIX = "data:image/jpeg;base64,";
@@ -0,0 +1,88 @@
1
+ import type { MetadataField } from "@/types/knowledge-base";
2
+
3
+ /**
4
+ * Convert a record of string form values into the typed shape the backend
5
+ * expects, driven by the KB metadata schema.
6
+ *
7
+ * Empty / undefined inputs are SKIPPED — the resulting object simply does
8
+ * not contain that key. Combined with the backend's overwrite semantics,
9
+ * this is how "clear a field" works at the form layer.
10
+ */
11
+ export function convertMetadataValues(
12
+ values: Record<string, string>,
13
+ fields: MetadataField[],
14
+ ): Record<string, unknown> {
15
+ const result: Record<string, unknown> = {};
16
+ for (const field of fields) {
17
+ const raw = values[field.name];
18
+ if (raw === undefined || raw === "") continue;
19
+ switch (field.type) {
20
+ case "long":
21
+ result[field.name] = parseInt(raw, 10);
22
+ break;
23
+ case "double":
24
+ result[field.name] = parseFloat(raw);
25
+ break;
26
+ case "boolean":
27
+ result[field.name] = raw === "true";
28
+ break;
29
+ case "string_list":
30
+ case "long_list":
31
+ case "double_list":
32
+ case "boolean_list":
33
+ case "date_list": {
34
+ const parts = raw.split(",").map((s) => s.trim()).filter(Boolean);
35
+ if (field.type === "long_list")
36
+ result[field.name] = parts.map((p) => parseInt(p, 10));
37
+ else if (field.type === "double_list")
38
+ result[field.name] = parts.map((p) => parseFloat(p));
39
+ else if (field.type === "boolean_list")
40
+ result[field.name] = parts.map((p) => p === "true");
41
+ else result[field.name] = parts;
42
+ break;
43
+ }
44
+ default:
45
+ result[field.name] = raw;
46
+ }
47
+ }
48
+ return result;
49
+ }
50
+
51
+ /**
52
+ * Reverse direction of {@link convertMetadataValues} — flatten a typed
53
+ * metadata object into the string-form Record used by the edit form.
54
+ *
55
+ * Missing fields → empty string (so the input renders blank). Lists are
56
+ * joined with ", ". Booleans become "true" / "false" to match the boolean
57
+ * Select options.
58
+ */
59
+ export function metadataToFormValues(
60
+ metadata: Record<string, unknown> | undefined | null,
61
+ fields: MetadataField[],
62
+ ): Record<string, string> {
63
+ const result: Record<string, string> = {};
64
+ for (const field of fields) {
65
+ const v = metadata?.[field.name];
66
+ if (v === undefined || v === null) {
67
+ result[field.name] = "";
68
+ continue;
69
+ }
70
+ switch (field.type) {
71
+ case "boolean":
72
+ result[field.name] = v ? "true" : "false";
73
+ break;
74
+ case "string_list":
75
+ case "long_list":
76
+ case "double_list":
77
+ case "boolean_list":
78
+ case "date_list":
79
+ result[field.name] = Array.isArray(v)
80
+ ? v.map((item) => String(item)).join(", ")
81
+ : "";
82
+ break;
83
+ default:
84
+ result[field.name] = String(v);
85
+ }
86
+ }
87
+ return result;
88
+ }
@@ -27,6 +27,20 @@ export const queryKeys = {
27
27
  maxResults,
28
28
  subspace,
29
29
  ] as const,
30
+ document: (
31
+ scope: string,
32
+ knowledgeBaseName: string,
33
+ docId: string | null | undefined,
34
+ subspace?: string,
35
+ ) =>
36
+ [
37
+ "knowledge-bases",
38
+ scope,
39
+ knowledgeBaseName,
40
+ "document",
41
+ docId,
42
+ subspace,
43
+ ] as const,
30
44
  chunks: (
31
45
  scope: string,
32
46
  knowledgeBaseName: string,
@@ -86,12 +86,21 @@ export function successResponse<T>(data: T, status = 200): NextResponse {
86
86
 
87
87
  /**
88
88
  * Build a standard error envelope response.
89
+ *
90
+ * `details` is forwarded both into the response body and into the server log
91
+ * record (merged under `details.*`). Use it to carry upstream diagnostics
92
+ * (e.g. `upstreamCode`, `upstreamRequestId`) that the UI can prefix to the
93
+ * displayed message and that support agents can grep the JSONL logs for.
89
94
  */
90
95
  export function errorResponse(
91
96
  code: string,
92
97
  message: string,
93
98
  status?: number,
94
- options: { log?: boolean; errorSource?: "local" | "network" | "service" | "browser" } = {},
99
+ options: {
100
+ log?: boolean;
101
+ errorSource?: "local" | "network" | "service" | "browser";
102
+ details?: Record<string, unknown>;
103
+ } = {},
95
104
  ): NextResponse {
96
105
  const responseStatus = status ?? httpStatusFor(code);
97
106
  if (options.log !== false) {
@@ -102,12 +111,14 @@ export function errorResponse(
102
111
  responseStatus,
103
112
  undefined,
104
113
  options.errorSource ?? "local",
114
+ options.details,
105
115
  );
106
116
  }
107
- const response = NextResponse.json(
108
- { code, message, data: null },
109
- { status: responseStatus },
110
- );
117
+ const body: Record<string, unknown> = { code, message, data: null };
118
+ if (options.details && Object.keys(options.details).length > 0) {
119
+ body.details = options.details;
120
+ }
121
+ const response = NextResponse.json(body, { status: responseStatus });
111
122
  attachNoStoreHeader(response);
112
123
  attachTraceHeader(response);
113
124
  return response;
@@ -309,6 +320,7 @@ function logApiResponse(
309
320
  status: number,
310
321
  requestId?: string,
311
322
  errorSource?: "local" | "network" | "service" | "browser",
323
+ extraDetails?: Record<string, unknown>,
312
324
  ): void {
313
325
  const context = apiContext.getStore();
314
326
  if (status < 400 && !shouldLogApiSuccess(context?.path)) return;
@@ -329,6 +341,7 @@ function logApiResponse(
329
341
  status,
330
342
  code,
331
343
  errorSource,
344
+ ...extraDetails,
332
345
  },
333
346
  });
334
347
  }
@@ -8,6 +8,24 @@ import type {
8
8
  ModelListItem,
9
9
  } from "@/types/llm-provider";
10
10
 
11
+ // ---------------------------------------------------------------------------
12
+ // Multimodal content types (OpenAI-compatible)
13
+ // ---------------------------------------------------------------------------
14
+
15
+ /**
16
+ * OpenAI-compatible content part for multimodal messages.
17
+ * Supports text and image_url parts.
18
+ */
19
+ export type ContentPart =
20
+ | { type: "text"; text: string }
21
+ | { type: "image_url"; image_url: { url: string; detail?: "low" | "high" | "auto" } };
22
+
23
+ /**
24
+ * Message content can be either a plain string (text-only) or an array of
25
+ * content parts (multimodal). Supports text and image_url parts.
26
+ */
27
+ export type LLMMessageContent = string | ContentPart[];
28
+
11
29
  // ---------------------------------------------------------------------------
12
30
  // OpenAI-compatible transport
13
31
  // ---------------------------------------------------------------------------
@@ -86,7 +104,7 @@ export async function testConnectivity(
86
104
 
87
105
  export interface ChatCompletionStreamParams {
88
106
  model: string;
89
- messages: Array<{ role: ChatRole; content: string }>;
107
+ messages: Array<{ role: ChatRole; content: LLMMessageContent }>;
90
108
  temperature?: number;
91
109
  signal?: AbortSignal;
92
110
  }
@@ -32,34 +32,63 @@ export function getOssClient(config: AppConfig): OSS | null {
32
32
  });
33
33
  }
34
34
 
35
- /**
36
- * Translate an error from ali-oss (or anywhere else in the OSS path) into
37
- * the dashboard's canonical `{ code, httpStatus, message }` triple. The
38
- * route handlers feed this directly into `forwardResponse`.
39
- */
40
- export function mapOssError(error: unknown): {
35
+ export interface OssErrorDetails {
36
+ upstreamCode?: string;
37
+ upstreamRequestId?: string;
38
+ upstreamHostId?: string;
39
+ upstreamStatus?: number;
40
+ [key: string]: unknown;
41
+ }
42
+
43
+ export interface MappedOssError {
41
44
  code: string;
42
45
  httpStatus: number;
43
46
  message: string;
44
- } {
45
- // ali-oss attaches a string `code` on every operational error; lean on it.
46
- const ossCode =
47
- error && typeof error === "object" && "code" in error
48
- ? String((error as { code: unknown }).code ?? "")
49
- : "";
47
+ details: OssErrorDetails;
48
+ }
49
+
50
+ /**
51
+ * Translate an error from ali-oss (or anywhere else in the OSS path) into
52
+ * the dashboard's canonical `{ code, httpStatus, message, details }` shape.
53
+ * Upstream identifiers (`code`, `requestId`, `hostId`, HTTP status) are
54
+ * preserved on `details` so the UI can prefix `[SignatureDoesNotMatch]` and
55
+ * support agents can match the request against OSS-side logs.
56
+ */
57
+ export function mapOssError(error: unknown): MappedOssError {
58
+ const record =
59
+ error && typeof error === "object"
60
+ ? (error as Record<string, unknown>)
61
+ : {};
62
+ const ossCode = typeof record.code === "string" ? record.code : "";
63
+ const requestId =
64
+ typeof record.requestId === "string" ? record.requestId : undefined;
65
+ const hostId = typeof record.hostId === "string" ? record.hostId : undefined;
66
+ const status =
67
+ typeof record.status === "number"
68
+ ? record.status
69
+ : typeof record.statusCode === "number"
70
+ ? record.statusCode
71
+ : undefined;
50
72
  const message =
51
73
  error instanceof Error ? error.message : String(error ?? "Unknown OSS error");
52
74
 
75
+ const details: OssErrorDetails = {
76
+ upstreamCode: ossCode || undefined,
77
+ upstreamRequestId: requestId,
78
+ upstreamHostId: hostId,
79
+ upstreamStatus: status,
80
+ };
81
+
53
82
  switch (ossCode) {
54
83
  case "AccessDenied":
55
84
  case "InvalidAccessKeyId":
56
85
  case "SignatureDoesNotMatch":
57
- return { code: "OSS_FORBIDDEN", httpStatus: 403, message };
86
+ return { code: "OSS_FORBIDDEN", httpStatus: 403, message, details };
58
87
  case "NoSuchBucket":
59
- return { code: "OSS_BUCKET_NOT_FOUND", httpStatus: 404, message };
88
+ return { code: "OSS_BUCKET_NOT_FOUND", httpStatus: 404, message, details };
60
89
  case "InvalidArgument":
61
- return { code: "BAD_REQUEST", httpStatus: 400, message };
90
+ return { code: "BAD_REQUEST", httpStatus: 400, message, details };
62
91
  default:
63
- return { code: "OSS_UPSTREAM_ERROR", httpStatus: 502, message };
92
+ return { code: "OSS_UPSTREAM_ERROR", httpStatus: 502, message, details };
64
93
  }
65
94
  }
@@ -80,6 +80,12 @@ export const createKBSchema = z.object({
80
80
  metadata: z.array(metadataFieldSchema).max(200).optional(),
81
81
  embeddingConfiguration: embeddingConfigSchema.optional(),
82
82
  retrievalConfiguration: retrievalConfigSchema.optional(),
83
+ multimodal: z.boolean().optional(),
84
+ ingestConfiguration: z
85
+ .object({
86
+ enableTableFormulaCaption: z.boolean().optional(),
87
+ })
88
+ .optional(),
83
89
  });
84
90
 
85
91
  export const updateKBSchema = z.object({
@@ -19,6 +19,25 @@ export const chatRagSchema = z.object({
19
19
  topK: z.number().int().min(1).max(200).optional(),
20
20
  });
21
21
 
22
+ // 写 scope 的四个字段必须为非空、非通配符字符串。
23
+ // 客户端不允许显式发 `*`——通配符仅由服务端在 SearchMemories 调用前注入。
24
+ const nonWildcardId = z.string().min(1).refine((v) => v !== "*", {
25
+ message: "wildcard '*' is not allowed on the wire; the server applies it",
26
+ });
27
+
28
+ export const chatMemorySchema = z.object({
29
+ memoryStoreName: z.string().min(1),
30
+ scope: z.object({
31
+ appId: nonWildcardId,
32
+ tenantId: nonWildcardId,
33
+ agentId: nonWildcardId,
34
+ runId: nonWildcardId,
35
+ }),
36
+ topK: z.number().int().min(1).max(50).optional(),
37
+ autoSave: z.boolean().optional(),
38
+ turnId: z.string().min(1).optional(),
39
+ });
40
+
22
41
  /**
23
42
  * Server-side validation for the chat endpoint payload. The last message must
24
43
  * be from the user; this rule is enforced in the route handler rather than
@@ -32,6 +51,7 @@ export const chatRequestSchema = z.object({
32
51
  systemPrompt: z.string().max(8_000).optional(),
33
52
  temperature: z.number().min(0).max(2).optional(),
34
53
  rag: chatRagSchema.optional(),
54
+ memory: chatMemorySchema.optional(),
35
55
  });
36
56
 
37
57
  export type ChatRequestInput = z.infer<typeof chatRequestSchema>;