Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crazywoola/dify-extensions-worker
A simple dify extension using cloudflare workers.
https://github.com/crazywoola/dify-extensions-worker
api chatgpt cloudflare dify openai
Last synced: 13 days ago
JSON representation
A simple dify extension using cloudflare workers.
- Host: GitHub
- URL: https://github.com/crazywoola/dify-extensions-worker
- Owner: crazywoola
- License: mit
- Created: 2024-01-05T01:30:26.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-23T01:05:13.000Z (10 months ago)
- Last Synced: 2024-10-11T14:57:53.253Z (about 1 month ago)
- Topics: api, chatgpt, cloudflare, dify, openai
- Language: TypeScript
- Homepage:
- Size: 698 KB
- Stars: 24
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dify Extension Workers
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
![img](./assets/simplicity.png)
## Description### What is this repository for?
This is designed to use [API-based Extension](https://docs.dify.ai/advanced/extension/api_based_extension) in [Dify](https://dify.ai/).
It includes the following features to make sure your application is secure and reliable.
- [x] Bearer token authentication
- [x] Schema validation
- [x] Deploy to [Cloudflare Workers](https://workers.cloudflare.com/)### Tools used
- [Hono](https://hono.dev/) - Fast, Lightweight, Web-standards, Runs on any JavaScript runtime.
- [Zod](https://zod.dev/) - TypeScript-first schema validation with static type inference.## Usage
### Development
You can run the following commands to start the development server.
Open this page in browser http://localhost:8787 to see the result. If you would like to have swagger ui to test the API, please follow [this](https://github.com/honojs/middleware/tree/main/packages/swagger-ui) instruction.
```bash
npm install
npm run dev
```### Deployment
You should be able to access the workers.dev domain after deploying to Cloudflare Workers.
```
npm run deploy
```### In Dify Console
### Example
```
name:
api_endpoint: https://.workers.dev/endpoint
api_key:
```#### Example send to Endpoint
This is an example of sending a check request to the endpoint.
```json
{
"point": "ping",
}
```This is an example of sending a query request to the endpoint.
```json
{
"point": "app.external_data_tool.query",
"params": {
"app_id": "61248ab4-1125-45be-ae32-0ce91334d021",
"tool_variable": "breaking_bad_quotes",
"inputs": {
"count": 5
},
"query": "Display the quotes in markdown quote"
}
}
```
## License[MIT](./LICENSE.md)