lemma-sdk 0.2.8 → 0.2.9

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.
@@ -203,6 +203,10 @@ export function useAssistantSession(options) {
203
203
  const ensureConversation = useCallback(async (overrideConversationId, options) => {
204
204
  const existingId = overrideConversationId ?? conversationId;
205
205
  if (existingId) {
206
+ // Avoid a network roundtrip on every send when we already have this conversation in state.
207
+ if (conversation?.id === existingId) {
208
+ return conversation;
209
+ }
206
210
  const existing = await refreshConversation(existingId);
207
211
  if (existing)
208
212
  return existing;
@@ -215,7 +219,7 @@ export function useAssistantSession(options) {
215
219
  ...(options.createConversation ?? {}),
216
220
  setActive: true,
217
221
  });
218
- }, [conversationId, createConversation, refreshConversation]);
222
+ }, [conversation, conversationId, createConversation, refreshConversation]);
219
223
  const sendMessage = useCallback(async (content, input = {}) => {
220
224
  const resolvedConversation = await ensureConversation(input.conversationId, input);
221
225
  const resolvedConversationId = requireConversationId(resolvedConversation.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemma-sdk",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Official TypeScript SDK for Lemma pod-scoped APIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",