Skip to content

Commit dd44598

Browse files
authored
Merge branch 'develop' into tcm-imageVisionModelProvider
2 parents 264ce5e + 7d6951a commit dd44598

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

packages/client-telegram/src/messageManager.ts

+7-13
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,9 @@ export class MessageManager {
195195

196196
// Check if we should post
197197
if (
198-
timeSinceLastMessage >
199-
this.autoPostConfig.inactivityThreshold ||
200-
(randomThreshold &&
201-
timeSinceLastAutoPost >
202-
(this.autoPostConfig.minTimeBetweenPosts || 0))
198+
timeSinceLastMessage > randomThreshold &&
199+
timeSinceLastAutoPost >
200+
(this.autoPostConfig.minTimeBetweenPosts || 0)
203201
) {
204202
try {
205203
const roomId = stringToUuid(
@@ -258,7 +256,7 @@ export class MessageManager {
258256
// Create and store memories
259257
const memories = messages.map((m) => ({
260258
id: stringToUuid(
261-
m.message_id.toString() + "-" + this.runtime.agentId
259+
roomId + "-" + m.message_id.toString()
262260
),
263261
userId: this.runtime.agentId,
264262
agentId: this.runtime.agentId,
@@ -384,9 +382,7 @@ export class MessageManager {
384382
);
385383

386384
const memories = messages.map((m) => ({
387-
id: stringToUuid(
388-
m.message_id.toString() + "-" + this.runtime.agentId
389-
),
385+
id: stringToUuid(roomId + "-" + m.message_id.toString()),
390386
userId: this.runtime.agentId,
391387
agentId: this.runtime.agentId,
392388
content: {
@@ -1264,7 +1260,7 @@ export class MessageManager {
12641260

12651261
// Get message ID
12661262
const messageId = stringToUuid(
1267-
message.message_id.toString() + "-" + this.runtime.agentId
1263+
roomId + "-" + message.message_id.toString()
12681264
) as UUID;
12691265

12701266
// Handle images
@@ -1339,9 +1335,7 @@ export class MessageManager {
13391335

13401336
const memory: Memory = {
13411337
id: stringToUuid(
1342-
sentMessage.message_id.toString() +
1343-
"-" +
1344-
this.runtime.agentId
1338+
roomId + "-" + sentMessage.message_id.toString()
13451339
),
13461340
agentId,
13471341
userId: agentId,

packages/core/src/parsing.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ export function extractAttributes(
222222
* - Wraps unquoted values in double quotes.
223223
* - Converts single-quoted values to double-quoted.
224224
* - Ensures consistency in key-value formatting.
225-
* - Collapses multiple double quotes into a single one.
226225
* - Normalizes mixed adjacent quote pairs.
227226
*
228227
* This is useful for cleaning up improperly formatted JSON strings
@@ -251,11 +250,8 @@ export const normalizeJsonString = (str: string) => {
251250
// "key": someWord → "key": "someWord"
252251
str = str.replace(/("[\w\d_-]+")\s*:\s*([A-Za-z_]+)(?!["\w])/g, '$1: "$2"');
253252

254-
// Collapse multiple double quotes ("") into one
255-
str = str.replace(/"+/g, '"');
256-
257253
// Replace adjacent quote pairs with a single double quote
258-
str = str.replace(/(["'])(['"])/g, '"');
254+
str = str.replace(/(?:"')|(?:'")/g, '"');
259255
return str;
260256
};
261257

0 commit comments

Comments
 (0)