fix(ts-sdk): Fixed Types from Message Interface (#2763)
This commit is contained in:
@@ -288,6 +288,11 @@ mode: "wide"
|
|||||||
|
|
||||||
<Tab title="TypeScript">
|
<Tab title="TypeScript">
|
||||||
|
|
||||||
|
<Update label="2025-05-08" description="v2.1.25">
|
||||||
|
**Improvements:**
|
||||||
|
- **Client:** Removed type `string` from `messages` interface
|
||||||
|
</Update>
|
||||||
|
|
||||||
<Update label="2025-05-08" description="v2.1.25">
|
<Update label="2025-05-08" description="v2.1.25">
|
||||||
**Improvements:**
|
**Improvements:**
|
||||||
- **Client:** Improved error handling in client.
|
- **Client:** Improved error handling in client.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mem0ai",
|
"name": "mem0ai",
|
||||||
"version": "2.1.25",
|
"version": "2.1.26",
|
||||||
"description": "The Memory Layer For Your AI Apps",
|
"description": "The Memory Layer For Your AI Apps",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"module": "./dist/index.mjs",
|
"module": "./dist/index.mjs",
|
||||||
|
|||||||
@@ -160,15 +160,11 @@ export default class MemoryClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_preparePayload(
|
_preparePayload(
|
||||||
messages: string | Array<Message>,
|
messages: Array<Message>,
|
||||||
options: MemoryOptions,
|
options: MemoryOptions,
|
||||||
): object {
|
): object {
|
||||||
const payload: any = {};
|
const payload: any = {};
|
||||||
if (typeof messages === "string") {
|
payload.messages = messages;
|
||||||
payload.messages = [{ role: "user", content: messages }];
|
|
||||||
} else if (Array.isArray(messages)) {
|
|
||||||
payload.messages = messages;
|
|
||||||
}
|
|
||||||
return { ...payload, ...options };
|
return { ...payload, ...options };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +213,7 @@ export default class MemoryClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async add(
|
async add(
|
||||||
messages: string | Array<Message>,
|
messages: Array<Message>,
|
||||||
options: MemoryOptions = {},
|
options: MemoryOptions = {},
|
||||||
): Promise<Array<Memory>> {
|
): Promise<Array<Memory>> {
|
||||||
if (this.telemetryId === "") await this.ping();
|
if (this.telemetryId === "") await this.ping();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export interface MultiModalMessages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Messages {
|
export interface Messages {
|
||||||
role: string;
|
role: "user" | "assistant";
|
||||||
content: string | MultiModalMessages;
|
content: string | MultiModalMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import type { TelemetryClient, TelemetryOptions } from "./telemetry.types";
|
import type { TelemetryClient, TelemetryOptions } from "./telemetry.types";
|
||||||
|
|
||||||
let version = "2.1.16";
|
let version = "2.1.26";
|
||||||
|
|
||||||
// Safely check for process.env in different environments
|
// Safely check for process.env in different environments
|
||||||
let MEM0_TELEMETRY = true;
|
let MEM0_TELEMETRY = true;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type {
|
|||||||
TelemetryEventData,
|
TelemetryEventData,
|
||||||
} from "./telemetry.types";
|
} from "./telemetry.types";
|
||||||
|
|
||||||
let version = "2.1.16";
|
let version = "2.1.26";
|
||||||
|
|
||||||
// Safely check for process.env in different environments
|
// Safely check for process.env in different environments
|
||||||
let MEM0_TELEMETRY = true;
|
let MEM0_TELEMETRY = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user