Skip to content

Commit

Permalink
feat: Add plugins to higress console (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
cr7258 authored Jun 28, 2024
1 parent f363805 commit 1316d36
Show file tree
Hide file tree
Showing 30 changed files with 373 additions and 109 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ npm run build
#### 第二步、编译 & 镜像

```bash
sh bulid.sh
cd backend && sh bulid.sh
# 脚本中涉及docker命令,本地调试可注释
```

Expand Down
10 changes: 5 additions & 5 deletions backend/sdk/src/main/resources/plugins/ai-cache/spec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-cache
title: AI缓存
title: AI Cache
x-title-i18n:
zh-CN: AI缓存
description: 大模型结果缓存
zh-CN: AI 缓存
description: Cache the response of large language models, significantly reduce the response latency of similar problems and save costs.
x-description-i18n:
zh-CN: 大模型结果缓存
zh-CN: 缓存大语言模型的响应结果,显著降低相似问题的响应时延并节省成本。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-prompt-decorator
title: AI提示词修饰器
title: AI Prompt Decorator
x-title-i18n:
zh-CN: AI提示词修饰器
description: 对LLM提示词进行修改
zh-CN: AI 提示词修饰
description: Add additional prompts before and after the user's input to simplify the interaction between the user and the large language model.
x-description-i18n:
zh-CN: 对LLM提示词进行修改
zh-CN: 在用户输入的提示词前后添加额外的修饰,简化用户与大语言模型的交互。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand All @@ -30,4 +30,3 @@ spec:
append:
- role: user
content: "在介绍杭州时,避开杭州的饮食"

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-prompt-template
title: AI提示词模板
title: AI Prompt Template
x-title-i18n:
zh-CN: AI提示词模板
description: 基于模板构建LLM提示词
zh-CN: AI 提示词模板
description: Quickly construct fixed-format prompts based on templates.
x-description-i18n:
zh-CN: 基于模板构建LLM提示词
zh-CN: 基于模板快速构建固定格式的提示词。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand All @@ -28,4 +28,3 @@ spec:
content: '你是一个 {{program}} 专家,编程语言为 {{language}}'
- role: user
content: '帮我写一个 {{program}} 程序'

10 changes: 5 additions & 5 deletions backend/sdk/src/main/resources/plugins/ai-proxy/spec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-proxy
title: AI代理
title: AI Proxy
x-title-i18n:
zh-CN: AI代理
description: 通过AI助手提供智能对话服务
zh-CN: AI 代理
description: Provide unified OpenAI API compatible interface to call different AI service providers.
x-description-i18n:
zh-CN: 通过AI助手提供智能对话服务
zh-CN: 实现了基于 OpenAI API 规范的代理功能,通过统一的接口调用不同的 AI 服务提供商。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down
10 changes: 5 additions & 5 deletions backend/sdk/src/main/resources/plugins/ai-rag/spec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-rag
title: AI检索增强生成
title: AI RAG
x-title-i18n:
zh-CN: AI检索增强生成
description: 通过RAG技术优化大模型生成内容
zh-CN: AI 检索增强生成
description: Simplify the development of RAG applications by integrating with Alibaba Cloud Vector Retrieval Service (DashVector) and optimize the generated content of large models.
x-description-i18n:
zh-CN: 通过RAG技术优化大模型生成内容
zh-CN: 通过对接阿里云向量检索服务(DashVector)简化 RAG 应用的开发,优化大模型的生成内容。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-security-guard
title: AI内容安全
title: AI Security Guard
x-title-i18n:
zh-CN: AI内容安全
description: 基于阿里云内容安全对大模型的输入输出进行安全检测
zh-CN: AI 内容安全
description: Securely check the input and output of large models based on Alibaba Cloud Content Moderation Service.
x-description-i18n:
zh-CN: 基于阿里云内容安全对大模型的输入输出进行安全检测
zh-CN: 基于阿里云内容安全服务对大模型的输入输出进行安全检测。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down
11 changes: 5 additions & 6 deletions backend/sdk/src/main/resources/plugins/ai-statistics/spec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-statistics
title: AI可观测
title: AI Statistics
x-title-i18n:
zh-CN: AI可观测
description: 生成AI可观测数据
zh-CN: AI 统计
description: Provides statistics of token usage, including logs, monitoring, and alerts.
x-description-i18n:
zh-CN: 生成AI可观测数据
zh-CN: 提供了对 token 用量的统计信息,包括日志、监控以及告警。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand All @@ -20,4 +20,3 @@ spec:
type: object
example:
enable: true

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-token-ratelimit
title: AI Token 限流
title: AI Token Rate Limit
x-title-i18n:
zh-CN: AI Token 限流
description: 对大模型服务进行 Token 限流
description: Implement token rate limiting based on specific keys, where the key source can be URL parameters, HTTP request headers, client IP addresses, etc.
x-description-i18n:
zh-CN: 对大模型服务进行 Token 限流
zh-CN: 基于特定键值实现 token 限流,键值来源可以是 URL 参数、HTTP 请求头、客户端 IP 地址等。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down
11 changes: 5 additions & 6 deletions backend/sdk/src/main/resources/plugins/ai-transformer/spec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: 1.0.0
info:
category: custom
category: ai
name: ai-transformer
title: AI请求/响应转换
title: AI Transformer
x-title-i18n:
zh-CN: AI请求/响应转换
description: 基于LLM对请求/响应进行智能转换
zh-CN: AI 请求/响应转换
description: Modify the requests/responses of the gateway in a natural language way without writing code.
x-description-i18n:
zh-CN: 基于LLM对请求/响应进行智能转换
zh-CN: 无须编写代码,使用自然语言的方式对网关的请求/响应进行修改。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
version: 1.0.0
contact:
Expand All @@ -29,4 +29,3 @@ spec:
serviceName: qwen
domain: dashscope.aliyuncs.com
sk: sk-xxxxxxxxxxxxxxxxxxx

7 changes: 4 additions & 3 deletions backend/sdk/src/main/resources/plugins/basic-auth/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ info:
category: auth
name: basic-auth/v1
title: Basic Auth
description: 本插件实现了基于 HTTP Basic Auth 标准进行认证鉴权的功能。
x-title-i18n:
zh-CN: Basic 认证
description: implement authentication feature based on HTTP Basic Auth standard.
x-description-i18n:
en-US: This plugin implements an authentication function based on HTTP Basic Auth standard.
zh-CN: 实现基于 HTTP Basic Auth 标准进行认证鉴权的功能。
iconUrl: https://img.alicdn.com/imgextra/i4/O1CN01BPFGlT1pGZ2VDLgaH_!!6000000005333-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down Expand Up @@ -82,7 +84,6 @@ spec:
example:
global_auth: false
consumers:
# 注意!该凭证仅做示例使用,请勿用于具体业务,造成安全风险
- name: consumer1
credential: admin:123456
- name: consumer2
Expand Down
6 changes: 4 additions & 2 deletions backend/sdk/src/main/resources/plugins/bot-detect/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ info:
category: security
name: bot-detect/v1
title: Bot Detect
description: 用于识别并阻止互联网爬虫对站点资源的爬取
x-title-i18n:
zh-CN: 机器人拦截
description: Identify and block resource crawling from bots on the Internet.
x-description-i18n:
en-US: Identify and block resource crawling from bots on the Internet
zh-CN: 用于识别并阻止互联网爬虫对站点资源的爬取。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN01jKT9vC1O059vNaq5u_!!6000000001642-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down
25 changes: 25 additions & 0 deletions backend/sdk/src/main/resources/plugins/cache-control/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: 1.0.0
info:
category: transformation
name: cache-control
title: Cache Control
x-title-i18n:
zh-CN: 缓存控制
description: Add Expires and Cache-Control headers to the response headers to facilitate browser caching of specific file types, such as jpg, png, and other image files.
x-description-i18n:
zh-CN: 为响应头部添加 Expires 和 Cache-Control 头部,从而方便浏览器对特定后缀的文件进行缓存,例如 jpg、png 等图片文件。
iconUrl: https://img.alicdn.com/imgextra/i3/O1CN01bAFa9k1t1gdQcVTH0_!!6000000005842-2-tps-42-42.png
version: 1.0.0
contact:
name: Higress Team
url: http://higress.io/
email: admin@higress.io
spec:
phase: AUTHN
priority: 420
configSchema:
openAPIV3Schema:
type: object
example:
suffix: jpg|png|jpeg
expires: 3600
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: 1.0.0
info:
category: traffic
name: cluster-key-rate-limit
title: Key Cluster Rate Limit
x-title-i18n:
zh-CN: 基于 Key 集群限流
description: Implement cluster-level rate limiting based on specific key values, which can be derived from URL parameters, HTTP request headers, client IP addresses, etc.
x-description-i18n:
zh-CN: 根据特定键值实现集群层面的限流,键值来源可以是 URL 参数、HTTP 请求头、客户端 IP 地址等。
iconUrl: https://img.alicdn.com/imgextra/i3/O1CN01bAFa9k1t1gdQcVTH0_!!6000000005842-2-tps-42-42.png
version: 1.0.0
contact:
name: Higress Team
url: http://higress.io/
email: admin@higress.io
spec:
phase: UNSPECIFIED_PHASE
priority: 20
configSchema:
openAPIV3Schema:
type: object
example:
rule_name: default_rule
rule_items:
- limit_by_param: apikey
limit_keys:
- key: 9a342114-ba8a-11ec-b1bf-00163e1250b5
query_per_minute: 10
- key: a6a6d7f2-ba8a-11ec-bec2-00163e1250b5
query_per_hour: 100
- limit_by_per_param: apikey
limit_keys:
- key: "regexp:^a.*"
query_per_second: 10
- key: "regexp:^b.*"
query_per_minute: 100
- key: "*"
query_per_hour: 1000
redis:
service_name: redis.static
show_limit_quota_header: true
34 changes: 34 additions & 0 deletions backend/sdk/src/main/resources/plugins/cors/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: 1.0.0
info:
category: security
name: cors
title: CORS
x-title-i18n:
zh-CN: CORS
description: Enables CORS (Cross-Origin Resource Sharing) HTTP response headers for the server.
x-description-i18n:
zh-CN: 为服务端启用 CORS(Cross-Origin Resource Sharing,跨域资源共享)的返回 HTTP 响应头。
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN01jKT9vC1O059vNaq5u_!!6000000001642-2-tps-42-42.png
version: 1.0.0
contact:
name: Higress Team
url: http://higress.io/
email: admin@higress.io
spec:
phase: AUTHZ
priority: 340
configSchema:
openAPIV3Schema:
type: object
example:
allow_origins:
- '*'
allow_methods:
- '*'
allow_headers:
- '*'
expose_headers:
- '*'
allow_credentials: false
max_age: 7200

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
apiVersion: 1.0.0
info:
category: traffic
category: transformation
name: custom-response/v1
title: Custom Response
description: 支持配置自定义的响应,包括自定义 HTTP 应答状态码、HTTP 应答头,以及 HTTP 应答 Body
x-title-i18n:
zh-CN: 自定义应答
description: Support configuring custom responses, including HTTP response status code, header and body.
x-description-i18n:
en-US: Support configuring custom responses, including HTTP response status code, header and body
zh-CN: 支持配置自定义的响应,包括自定义 HTTP 应答状态码、HTTP 应答头,以及 HTTP 应答 Body。
iconUrl: https://img.alicdn.com/imgextra/i3/O1CN01bAFa9k1t1gdQcVTH0_!!6000000005842-2-tps-42-42.png
version: 1.0.0
contact:
Expand Down
34 changes: 34 additions & 0 deletions backend/sdk/src/main/resources/plugins/de-graphql/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: 1.0.0
info:
category: transformation
name: de-graphql
title: DeGraphQL
x-title-i18n:
zh-CN: DeGraphQL
description: Convert a RESTful API to a GraphQL request.
x-description-i18n:
zh-CN: 将 Restful API 转换为 GraphQL 请求。
iconUrl: https://img.alicdn.com/imgextra/i3/O1CN01bAFa9k1t1gdQcVTH0_!!6000000005842-2-tps-42-42.png
version: 1.0.0
contact:
name: Higress Team
url: http://higress.io/
email: admin@higress.io
spec:
phase: AUTHN
priority: 430
configSchema:
openAPIV3Schema:
type: object
example:
timeout: 5000
endpoint: /graphql
domain: api.github.com
gql: |
query ($owner:String! $name:String!){
repository(owner:$owner, name:$name) {
name
forkCount
description
}
}
Loading

0 comments on commit 1316d36

Please sign in to comment.