Skip to content

Commit

Permalink
fix: add judgment for message_thread_id
Browse files Browse the repository at this point in the history
  • Loading branch information
adolphnov committed Nov 11, 2024
1 parent 1c5aefa commit 954d016
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/buildinfo.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/timestamp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/extra/log/logDecortor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/telegram/utils/md2tgmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/telegram/utils/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MessageContext implements Record<string, any> {
}

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 {
Expand Down

0 comments on commit 954d016

Please sign in to comment.