Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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)