@ax-llm/ax 12.0.15 → 12.0.16

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/index.d.cts CHANGED
@@ -2134,6 +2134,7 @@ declare class AxAIGrok extends AxAIOpenAIBase<AxAIGrokModel, AxAIGrokEmbedModels
2134
2134
  type AxMemoryData = {
2135
2135
  tags?: string[];
2136
2136
  role: AxChatRequest['chatPrompt'][number]['role'];
2137
+ updatable?: boolean;
2137
2138
  chat: {
2138
2139
  index: number;
2139
2140
  value: Omit<AxChatRequest['chatPrompt'][number], 'role'>;
@@ -2319,6 +2320,7 @@ declare class AxMemory implements AxAIMemory {
2319
2320
  getLast(sessionId?: string): {
2320
2321
  tags?: string[];
2321
2322
  role: AxChatRequest["chatPrompt"][number]["role"];
2323
+ updatable?: boolean;
2322
2324
  chat: {
2323
2325
  index: number;
2324
2326
  value: Omit<AxChatRequest["chatPrompt"][number], "role">;
package/index.d.ts CHANGED
@@ -2134,6 +2134,7 @@ declare class AxAIGrok extends AxAIOpenAIBase<AxAIGrokModel, AxAIGrokEmbedModels
2134
2134
  type AxMemoryData = {
2135
2135
  tags?: string[];
2136
2136
  role: AxChatRequest['chatPrompt'][number]['role'];
2137
+ updatable?: boolean;
2137
2138
  chat: {
2138
2139
  index: number;
2139
2140
  value: Omit<AxChatRequest['chatPrompt'][number], 'role'>;
@@ -2319,6 +2320,7 @@ declare class AxMemory implements AxAIMemory {
2319
2320
  getLast(sessionId?: string): {
2320
2321
  tags?: string[];
2321
2322
  role: AxChatRequest["chatPrompt"][number]["role"];
2323
+ updatable?: boolean;
2322
2324
  chat: {
2323
2325
  index: number;
2324
2326
  value: Omit<AxChatRequest["chatPrompt"][number], "role">;
package/index.js CHANGED
@@ -6124,9 +6124,10 @@ var MemoryImpl = class {
6124
6124
  }
6125
6125
  }
6126
6126
  };
6127
- if (!lastItem || lastItem.role !== "assistant") {
6127
+ if (!lastItem || lastItem.role !== "assistant" || lastItem.role === "assistant" && !lastItem.updatable) {
6128
6128
  this.data.push({
6129
6129
  role: "assistant",
6130
+ updatable: true,
6130
6131
  chat: [
6131
6132
  { index, value: structuredClone({ content, name, functionCalls }) }
6132
6133
  ]
@@ -6143,13 +6144,16 @@ var MemoryImpl = class {
6143
6144
  log();
6144
6145
  return;
6145
6146
  }
6146
- if ("content" in chat.value && typeof content === "string" && content.trim() !== "") {
6147
+ if (typeof content === "string" && content.trim() !== "") {
6148
+ ;
6147
6149
  chat.value.content = content;
6148
6150
  }
6149
- if ("name" in chat.value && name && name.trim() !== "") {
6151
+ if (typeof name === "string" && name.trim() !== "") {
6152
+ ;
6150
6153
  chat.value.name = name;
6151
6154
  }
6152
- if ("functionCalls" in chat.value && functionCalls && functionCalls.length > 0) {
6155
+ if (Array.isArray(functionCalls) && functionCalls.length > 0) {
6156
+ ;
6153
6157
  chat.value.functionCalls = functionCalls;
6154
6158
  }
6155
6159
  log();