From 954d0166586475e8131e9f6a5a86ceb73a73db60 Mon Sep 17 00:00:00 2001 From: adolphzhang Date: Tue, 12 Nov 2024 01:50:41 +0800 Subject: [PATCH] fix: add judgment for message_thread_id --- dist/buildinfo.json | 2 +- dist/index.js | 11 +++++------ dist/timestamp | 2 +- src/extra/log/logDecortor.ts | 2 +- src/telegram/utils/md2tgmd.ts | 2 +- src/telegram/utils/send.ts | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index d4552e519..cb5fe6935 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha":"a2cb7b4","timestamp":1731341135} \ No newline at end of file +{"sha":"1c5aefa","timestamp":1731347437} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 77fbcfa0a..c9dcf44f2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -407,8 +407,8 @@ const ENV_KEY_MAPPER = { WORKERS_AI_MODEL: "WORKERS_CHAT_MODEL" }; class Environment extends EnvironmentConfig { - BUILD_TIMESTAMP = 1731341135; - BUILD_VERSION = "a2cb7b4"; + BUILD_TIMESTAMP = 1731347437; + BUILD_VERSION = "1c5aefa"; I18N = loadI18n(); PLUGINS_ENV = {}; USER_CONFIG = createAgentUserConfig(); @@ -11609,8 +11609,7 @@ function getLog(context, returnModel = false) { } const formattedEntries = logList.filter(Boolean).map((entry) => `>\`${entry}\``).join("\n"); return `LOGSTART -${formattedEntries} -LOGEND +${formattedEntries}LOGEND `; } function clearLog(context) { @@ -11847,7 +11846,7 @@ function escape(text) { \`\`\``; result2.push(handleEscape(last, "code")); } - const regexp = /^\s*LOGSTART\n(.*?)\s*LOGEND/s; + const regexp = /^LOGSTART(.*?)LOGEND/s; return result2.join("\n").replace(regexp, "**$1||").replace(new RegExp(Object.values(escapedChars).join("|"), "g"), (match) => escapedCharsReverseMap.get(match) ?? match); } function handleEscape(text, type2 = "text") { @@ -11888,7 +11887,7 @@ class MessageContext { this.reply_to_message_id = message.message_id; } this.allow_sending_without_reply = true; - if (message.message_thread_id) { + if (message.message_thread_id && message.is_topic_message) { this.message_thread_id = message.message_thread_id; } } else { diff --git a/dist/timestamp b/dist/timestamp index 7e4cf473d..ed2e7abfa 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1731341135 \ No newline at end of file +1731347437 \ No newline at end of file diff --git a/src/extra/log/logDecortor.ts b/src/extra/log/logDecortor.ts index 4ffaf544d..8d1a211ad 100644 --- a/src/extra/log/logDecortor.ts +++ b/src/extra/log/logDecortor.ts @@ -169,7 +169,7 @@ export function getLog(context: AgentUserConfig, returnModel: boolean = false): } const formattedEntries = logList.filter(Boolean).map(entry => `>\`${entry}\``).join('\n'); - return `LOGSTART\n${formattedEntries}\nLOGEND\n`; + return `LOGSTART\n${formattedEntries}LOGEND\n`; } export function clearLog(context: AgentUserConfig) { diff --git a/src/telegram/utils/md2tgmd.ts b/src/telegram/utils/md2tgmd.ts index 3acd20039..2af0fa4dc 100644 --- a/src/telegram/utils/md2tgmd.ts +++ b/src/telegram/utils/md2tgmd.ts @@ -63,7 +63,7 @@ export function escape(text: string): string { const last = `${lines.slice(stack[0]).join('\n')}\n\`\`\``; result.push(handleEscape(last, 'code')); } - const regexp = /^\s*LOGSTART\n(.*?)\s*LOGEND/s; + const regexp = /^LOGSTART(.*?)LOGEND/s; return result.join('\n') .replace(regexp, '**$1||') .replace(new RegExp(Object.values(escapedChars).join('|'), 'g'), match => escapedCharsReverseMap.get(match) ?? match); diff --git a/src/telegram/utils/send.ts b/src/telegram/utils/send.ts index e8f5dca98..b4deda748 100644 --- a/src/telegram/utils/send.ts +++ b/src/telegram/utils/send.ts @@ -35,7 +35,7 @@ class MessageContext implements Record { } this.allow_sending_without_reply = true; - if (message.message_thread_id) { + if (message.message_thread_id && message.is_topic_message) { this.message_thread_id = message.message_thread_id; } } else {