@voltagent/core 0.1.67 → 0.1.68
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.d.ts +5 -0
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -884,6 +884,11 @@ type MessageFilterOptions = {
|
|
|
884
884
|
* Only retrieve messages with this role
|
|
885
885
|
*/
|
|
886
886
|
role?: BaseMessage["role"];
|
|
887
|
+
/**
|
|
888
|
+
* Only retrieve messages with these types
|
|
889
|
+
* If not specified, all message types are returned
|
|
890
|
+
*/
|
|
891
|
+
types?: Array<"text" | "tool-call" | "tool-result">;
|
|
887
892
|
};
|
|
888
893
|
/**
|
|
889
894
|
* Conversation type
|
package/dist/index.js
CHANGED
|
@@ -5026,7 +5026,15 @@ var LibSQLStorage = class {
|
|
|
5026
5026
|
async getMessages(options = {}) {
|
|
5027
5027
|
await this.initialized;
|
|
5028
5028
|
await debugDelay();
|
|
5029
|
-
const {
|
|
5029
|
+
const {
|
|
5030
|
+
userId = "default",
|
|
5031
|
+
conversationId = "default",
|
|
5032
|
+
limit,
|
|
5033
|
+
before,
|
|
5034
|
+
after,
|
|
5035
|
+
role,
|
|
5036
|
+
types
|
|
5037
|
+
} = options;
|
|
5030
5038
|
const messagesTableName = `${this.options.tablePrefix}_messages`;
|
|
5031
5039
|
const conversationsTableName = `${this.options.tablePrefix}_conversations`;
|
|
5032
5040
|
try {
|
|
@@ -5057,6 +5065,11 @@ var LibSQLStorage = class {
|
|
|
5057
5065
|
conditions.push("m.role = ?");
|
|
5058
5066
|
args.push(role);
|
|
5059
5067
|
}
|
|
5068
|
+
if (types) {
|
|
5069
|
+
const placeholders = types.map(() => "?").join(", ");
|
|
5070
|
+
conditions.push(`m.type IN (${placeholders})`);
|
|
5071
|
+
args.push(...types);
|
|
5072
|
+
}
|
|
5060
5073
|
if (conditions.length > 0) {
|
|
5061
5074
|
sql += ` WHERE ${conditions.join(" AND ")}`;
|
|
5062
5075
|
}
|
|
@@ -7960,7 +7973,8 @@ var InMemoryStorage = class {
|
|
|
7960
7973
|
limit = this.options.storageLimit,
|
|
7961
7974
|
before,
|
|
7962
7975
|
after,
|
|
7963
|
-
role
|
|
7976
|
+
role,
|
|
7977
|
+
types
|
|
7964
7978
|
} = options;
|
|
7965
7979
|
this.debug(
|
|
7966
7980
|
`Getting messages for user ${userId} and conversation ${conversationId} with options`,
|
|
@@ -7972,6 +7986,9 @@ var InMemoryStorage = class {
|
|
|
7972
7986
|
if (role) {
|
|
7973
7987
|
filteredMessages = filteredMessages.filter((m) => m.role === role);
|
|
7974
7988
|
}
|
|
7989
|
+
if (types) {
|
|
7990
|
+
filteredMessages = filteredMessages.filter((m) => types.includes(m.type));
|
|
7991
|
+
}
|
|
7975
7992
|
if (before) {
|
|
7976
7993
|
filteredMessages = filteredMessages.filter(
|
|
7977
7994
|
(m) => new Date(m.createdAt).getTime() < new Date(before).getTime()
|
|
@@ -8894,7 +8911,9 @@ var MemoryManager = class {
|
|
|
8894
8911
|
const memoryMessages = await this.conversationMemory.getMessages({
|
|
8895
8912
|
userId,
|
|
8896
8913
|
conversationId,
|
|
8897
|
-
limit: contextLimit
|
|
8914
|
+
limit: contextLimit,
|
|
8915
|
+
types: ["text"]
|
|
8916
|
+
// Only retrieve text messages for conversation context
|
|
8898
8917
|
});
|
|
8899
8918
|
messages = memoryMessages.map((m) => ({
|
|
8900
8919
|
role: m.role,
|