@ash-cloud/ash-ui 0.2.1 → 0.2.2

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/index.cjs CHANGED
@@ -3617,6 +3617,7 @@ function useAgentChat(options) {
3617
3617
  const eventCountRef = react.useRef(0);
3618
3618
  const sessionIdRef = react.useRef(sessionId);
3619
3619
  const streamingEntriesRef = react.useRef([]);
3620
+ const lastSequenceRef = react.useRef(0);
3620
3621
  react.useEffect(() => {
3621
3622
  sessionIdRef.current = sessionId;
3622
3623
  }, [sessionId]);
@@ -3641,6 +3642,12 @@ function useAgentChat(options) {
3641
3642
  setStreamingEntries([]);
3642
3643
  }, []);
3643
3644
  const processEvent = react.useCallback((event, streamEntries) => {
3645
+ if (event.id) {
3646
+ const seq = parseInt(event.id, 10);
3647
+ if (!isNaN(seq)) {
3648
+ lastSequenceRef.current = seq;
3649
+ }
3650
+ }
3644
3651
  const newEntries = [...streamEntries];
3645
3652
  switch (event.type) {
3646
3653
  case "session_start":
@@ -3977,7 +3984,8 @@ function useAgentChat(options) {
3977
3984
  send,
3978
3985
  stop,
3979
3986
  clear,
3980
- setEntries
3987
+ setEntries,
3988
+ lastSequence: lastSequenceRef.current
3981
3989
  };
3982
3990
  }
3983
3991
  function generateId() {