RainEggplant / chatgpt-telegram-bot

A ChatGPT bot for Telegram based on Node.js. Support both browserless and browser-base APIs.
MIT License
323 stars 97 forks source link

[Bug]: tables returned from chatGPT are not support #56

Open yanCode opened 1 year ago

yanCode commented 1 year ago

Not a duplicate issue

Verify ChatGPT service is operational

Bot version

2.5.0

API type

official

Environment details

Node.js v19.2.0 m1 mac osx , run in local env.

Describe the Bug

When i request a table in the question, like asking show me a table of difference between shanghai and nanjing or 用表格显示南京和上海的区别

when the response includes |, it prints the error: 5/20/2023, 3:38:41 PM ⛔️ Edit message error: ETELEGRAM: 400 Bad Request: can't parse entities: Character '|' is reserved and must be escaped with the preceding '\'

To Reproduce

ask any questions that can return a table, like show me a table of difference between shanghai and nanjing or 用表格显示南京和上海的区别

Logs

5/20/2023, 3:38:39 PM ⛔️ Edit message error: ETELEGRAM: 400 Bad Request: can't parse entities: Character ' ' is reserved and must be escaped with the preceding '\' utils.js:885/20/2023, 3:38:39 PM ⛔️ Message text: Criteria Shanghai Nanjing
Location East coast of China, on the Yangtze River Delta Along the Yangtze River, south of Shanghai
Population Approximately 24 million Approximately 8.5 million
GDP $544.4 billion (2019) $327.4 billion (2019)
Culture Known for its modernity, international flair, and vibrant nightlife Has a rich history and is considered a cultural center of the Jiangsu province
Tourist Attractions The Bund, Yu Garden, Oriental Pearl Tower, Shanghai Disneyland Confucius Temple, Nanjing City Wall, Qinhuai River, Sun Yat-sen Mausoleum
Transportation Well-developed public transportation, including subway, bus, and taxi services Public transportation options include subway, bus, and taxi services

Additional context

No response

yanCode commented 1 year ago

it seems this bug is from node-telegram-bot-api

Error: ETELEGRAM: 400 Bad Request: can't parse entities: Character '|' is reserved and must be escaped with the preceding '\' at /Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/node-telegram-bot-api@0.60.0/node_modules/node-telegram-bot-api/src/telegram.js:284:15 at tryCatcher (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/async.js:102:5) at Async.drainQueues [as _onImmediate] (/Users/y/youtube/chatgpt-telegram-bot/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/async.js:15:14) at process.processImmediate (node:internal/timers:471:21) at process.callbackTrampoline (node:internal/async_hooks:132:17) {code: "ETELEGRAM", response: IncomingMessage, stack: "Error: ETELEGRAM: 400 Bad Request: can't parse ent…backTrampoline (node:internal/async_hooks:132:17)", message: "ETELEGRAM: 400 Bad Request: can't parse entities: …served and must be escaped with the preceding '\'"}