diff --git a/.gitignore b/.gitignore index e705b29c..ad08e406 100644 --- a/.gitignore +++ b/.gitignore @@ -150,6 +150,5 @@ out /config.json /wrangler.toml /wrangler-test.toml -/plugins/interpolate.js /dist/index.cjs /dist/index.d.ts diff --git a/dist/buildinfo.json b/dist/buildinfo.json index 0ecf6f03..0822b3d6 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha":"ef4e54b","timestamp":1724829578} \ No newline at end of file +{"sha":"8ea7c0f","timestamp":1724911785} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index cbdcb083..7c64e0e3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -212,8 +212,8 @@ const ENV_KEY_MAPPER = { WORKERS_AI_MODEL: "WORKERS_CHAT_MODEL" }; class Environment extends EnvironmentConfig { - BUILD_TIMESTAMP = 1724829578 ; - BUILD_VERSION = "ef4e54b" ; + BUILD_TIMESTAMP = 1724911785 ; + BUILD_VERSION = "8ea7c0f" ; I18N = loadI18n(); PLUGINS_ENV = {}; USER_CONFIG = createAgentUserConfig(); @@ -1427,7 +1427,7 @@ class APIClientBase { formData.append(key, JSON.stringify(value)); } } - return fetch(`${this.baseURL}bot${this.token}/${method}`, { + return fetch(`${this.baseURL}/bot${this.token}/${method}`, { method: "POST", body: formData }); diff --git a/dist/timestamp b/dist/timestamp index 2d3f5c29..a4606dea 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1724829578 \ No newline at end of file +1724911785 \ No newline at end of file diff --git a/doc/cn/PLATFORM.md b/doc/cn/PLATFORM.md index bc2cfce4..036fde53 100644 --- a/doc/cn/PLATFORM.md +++ b/doc/cn/PLATFORM.md @@ -7,7 +7,7 @@ ### 2. [Vercel](https://vercel.com/) -详情看[Vercel](VERCEL)。免费,无需域名,无需服务器。需要配置本地开发环境部署,不能通过复制粘贴部署。无存储服务,需要自己配置数据库。可以使用[Redis Cloud](https://redis.com)的免费redis。可以连接github自动部署,但是需要了解vercel的配置。 +详情看[Vercel](VERCEL.md)。免费,无需域名,无需服务器。需要配置本地开发环境部署,不能通过复制粘贴部署。无存储服务,需要自己配置数据库。可以使用[Redis Cloud](https://redis.com)的免费redis。可以连接github自动部署,但是需要了解vercel的配置。 ### 3. Local diff --git a/doc/cn/VERCEL.md b/doc/cn/VERCEL.md index 1b7f385c..a5d2c4ee 100644 --- a/doc/cn/VERCEL.md +++ b/doc/cn/VERCEL.md @@ -2,6 +2,13 @@ `/src/adapter/vercel`中提供了示例代码,可以完成Vercel部署,和基础的功能测试。但是无法保证所有功能都能正常工作。 +### 自动部署 + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FTBXark%2FChatGPT-Telegram-Workers&env=UPSTASH_REDIS_REST_URL,UPSTASH_REDIS_REST_TOKEN,VERCEL_DOMAIN,TELEGRAM_AVAILABLE_TOKENS&project-name=chatgpt-telegram-workers&repository-name=ChatGPT-Telegram-Workers&demo-title=ChatGPT-Telegram-Workers&demo-description=Deploy%20your%20own%20Telegram%20ChatGPT%20bot%20on%20Cloudflare%20Workers%20with%20ease.&demo-url=https%3A%2F%2Fchatgpt-telegram-workers.vercel.app) + + +### 手动部署 + ```shell yarn global add vercel # 安装vercel命令行工具 yarn # 安装依赖 @@ -11,4 +18,5 @@ yarn run deploy:vercel # 部署到vercel ``` ### 已知问题 + 1. redis 连接关闭有问题会导致客户端连接数过多导致无法连接建议使用upstash的redis服务 \ No newline at end of file diff --git a/doc/en/PLATFORM.md b/doc/en/PLATFORM.md index a6141294..621dbeec 100644 --- a/doc/en/PLATFORM.md +++ b/doc/en/PLATFORM.md @@ -8,7 +8,7 @@ The easiest way, the deployment method supported by this project by default, see ### 2. [Vercel](https://vercel.com/) -See details at [Vercel](../cn/VERCEL). It is free, does not require a domain name or server. Deployment requires configuring the local development environment and cannot be done by copying and pasting. There is no storage service, so you need to configure your own database. You can use the free Redis from [Redis Cloud](https://redis.com). It can connect to GitHub for automatic deployment, but you need to understand Vercel's configuration. +See details at [Vercel](VERCEL.md). It is free, does not require a domain name or server. Deployment requires configuring the local development environment and cannot be done by copying and pasting. There is no storage service, so you need to configure your own database. You can use the free Redis from [Redis Cloud](https://redis.com). It can connect to GitHub for automatic deployment, but you need to understand Vercel's configuration. ### 3. Local diff --git a/doc/en/VERCEL.md b/doc/en/VERCEL.md index ef37ace6..cf4fda4c 100644 --- a/doc/en/VERCEL.md +++ b/doc/en/VERCEL.md @@ -2,6 +2,14 @@ The `/src/adapter/vercel` provides sample code that can complete Vercel deployment and basic functional testing. However, it cannot guarantee that all functions will work properly. + +### Automatic deployment + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FTBXark%2FChatGPT-Telegram-Workers&env=UPSTASH_REDIS_REST_URL,UPSTASH_REDIS_REST_TOKEN,VERCEL_DOMAIN,TELEGRAM_AVAILABLE_TOKENS&project-name=chatgpt-telegram-workers&repository-name=ChatGPT-Telegram-Workers&demo-title=ChatGPT-Telegram-Workers&demo-description=Deploy%20your%20own%20Telegram%20ChatGPT%20bot%20on%20Cloudflare%20Workers%20with%20ease.&demo-url=https%3A%2F%2Fchatgpt-telegram-workers.vercel.app) + + +### Manual deployment + ```shell yarn global add vercel # Install the Vercel command-line tool. yarn # Install dependencies. @@ -11,4 +19,5 @@ yarn run deploy:vercel # Deploy to Vercel. ``` ### Known issue. + 1. There is a problem with closing Redis connections, which can cause too many client connections and make it impossible to connect. It is recommended to use Upstash's Redis service. \ No newline at end of file diff --git a/package.json b/package.json index a8904c74..87148e50 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "chatgpt-telegram-workers", "type": "module", - "version": "1.9.2", + "version": "1.9.3", "description": "The easiest and quickest way to deploy your own ChatGPT Telegram bot is to use a single file and simply copy and paste it. There is no need for any dependencies, local development environment configuration, domain names, or servers.", "author": "TBXark", "license": "MIT", @@ -28,6 +28,7 @@ "deploy:dist": "wrangler deploy", "deploy:build": "npm run build && wrangler deploy", "deploy:vercel": "vercel deploy --prod", + "deploy:plugin": "BUILD_MODE=plugins-page vite build && wrangler pages deploy plugins --project-name=interpolate-test --branch=main", "start:dist": "node dist/index.js", "start:local": "CONFIG_PATH=./config.json TOML_PATH=./wrangler.toml tsx src/adapter/local/index.ts", "start:debug": "wrangler dev --local", @@ -46,7 +47,7 @@ "eslint-plugin-format": "^0.1.2", "rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-node-externals": "^7.1.3", - "telegram-bot-api-types": "^7.9.10", + "telegram-bot-api-types": "^7.9.12", "tsx": "^4.19.0", "typescript": "^5.5.4", "vite": "^5.4.2", diff --git a/plugins/.gitignore b/plugins/.gitignore new file mode 100644 index 00000000..3e221292 --- /dev/null +++ b/plugins/.gitignore @@ -0,0 +1 @@ +/dist \ No newline at end of file diff --git a/plugins/README.md b/plugins/README.md index e798e2a5..a7aec275 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -80,7 +80,7 @@ For example, define the following variables in the environment variables: ```toml PLUGIN_COMMAND_dns = "https://raw.githubusercontent.com/TBXark/ChatGPT-Telegram-Workers/dev/plugins/dns.json" -PLUGIN_COMMAND_DESCRIPTION_dns = "DNS query /dns " +PLUGIN_DESCRIPTION_dns = "DNS query /dns " ``` Then enter `/dns A www.baidu.com` in the command line to call the plugin. diff --git a/plugins/README_CN.md b/plugins/README_CN.md index 32bd36ec..08185f9b 100644 --- a/plugins/README_CN.md +++ b/plugins/README_CN.md @@ -78,7 +78,7 @@ export interface RequestTemplate { ```toml PLUGIN_COMMAND_dns = "https://raw.githubusercontent.com/TBXark/ChatGPT-Telegram-Workers/dev/plugins/dns.json" -PLUGIN_COMMAND_DESCRIPTION_dns = "DNS查询 /dns <类型> <域名>" +PLUGIN_DESCRIPTION_dns = "DNS查询 /dns <类型> <域名>" ``` 然后在命令行中输入`/dns A www.baidu.com`即可调用插件 diff --git a/plugins/index.html b/plugins/index.html index d152cfba..5a982058 100644 --- a/plugins/index.html +++ b/plugins/index.html @@ -5,7 +5,7 @@ ChatGPT-Telegram-Workers - +