AI prompts
base on 支持Gemini Pro / Cloudflare Workers AI / ChatGPT的融合Web平台 # cloudflare-ai-web
## AI 启动!
### 一键部署(推荐)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FJazee6%2Fcloudflare-ai-web&env=CF_TOKEN,CF_GATEWAY&envDescription=%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E4%BF%A1%E6%81%AF%E8%AF%B7%E6%9F%A5%E7%9C%8B&envLink=https%3A%2F%2Fgithub.com%2FJazee6%2Fcloudflare-ai-web)
示例:https://ai.jaze.top
### Deno Deploy
https://dash.deno.com
- Fork 本仓库
- Build Step改为`NITRO_PRESET=deno-deploy npm run build_node`
- Deploy Project
- 设置环境变量
### Docker
```bash
docker run -d --name cloudflare-ai-web \
-e CF_TOKEN=YOUR_CF_TOKEN \
-e CF_GATEWAY=YOUR_CF_GATEWAY \
-p 3000:3000 \
--restart=always \
jazee6/cloudflare-ai-web
```
## 特性
- 利用 Cloudflare Workers AI 快速搭建多模态AI平台
- 支持 Serverless 部署,无需服务器
- 支持开启访问密码,聊天记录本地存储
- 轻量化(~646 kB gzip)
- 支持`ChatGPT` `Gemini Pro` `Stable Diffusion` `llama-3` `通义千问`等
### 模型支持
https://developers.cloudflare.com/workers-ai/models/
你可以在`./utils/db.ts`中增删模型
## 部署说明
### 环境变量列表
| 名称 | 描述 |
|----------------|------------------------------------|
| CF_TOKEN | Cloudflare Workers AI Token |
| CF_GATEWAY | Cloudflare AI Gateway URL |
| OPENAI_API_KEY | OpenAI API Key (需要ChatGPT时填写) |
| OPENAI_API_URL | 自定义OpenAI API请求地址 |
| G_API_KEY | Google AI API Key (需要GeminiPro时填写) |
| G_API_URL | Google AI 反代 (不支持地区填写,或参考以下配置) |
| PASSWORD | 访问密码 (可选) |
示例: 查看`.env.example`文件
#### CF_TOKEN
https://dash.cloudflare.com/profile/api-tokens
- 单击创建令牌
- 使用Workers AI (Beta)模板
- 单击继续以显示摘要
- 单击创建令牌
- 复制您的令牌,设置环境变量
#### CF_GATEWAY
https://dash.cloudflare.com/
- Cloudflare 侧栏 AI - AI Gateway
- 添加新 AI Gateway
- 填写名称和URL slug创建
- 单击右上角API Endpoints
- 复制您的Universal Endpoint(去掉末尾`/`),设置环境变量
#### G_API_KEY
https://ai.google.dev/tutorials/rest_quickstart#set_up_your_api_key
#### G_API_URL
参考 https://github.com/Jazee6/gemini-proxy 搭建反代,末尾无需`/`
或者在`nuxt.config.ts`中添加以下配置
```
nitro: {
vercel: {
regions: ["sin1", "syd1", "sfo1", "iad1", "pdx1", "cle1"]
}
}
```
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=Jazee6/cloudflare-ai-web&type=Date)](https://star-history.com/#Jazee6/cloudflare-ai-web&Date)
", Assign "at most 3 tags" to the expected json: {"id":"9109","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"