AI 請求響應轉換外掛程式,通過LLM對請求/響應的header以及body進行修改。
運行屬性
外掛程式執行階段:認證階段 外掛程式執行優先順序:410
配置說明
名稱 | 資料類型 | 填寫要求 | 預設值 | 描述 |
| bool | 必填 | - | 是否在request階段開啟轉換 |
| string | 必填 | - | request階段轉換使用的prompt |
| string | 必填 | - | 是否在response階段開啟轉換 |
| string | 必填 | - | response階段轉換使用的prompt |
| string | 必填 | - | DNS類型的服務名,目前僅支援千問 |
| string | 必填 | - | LLM服務網域名稱 |
| string | 必填 | - | 阿里雲dashscope服務的API Key |
配置樣本
request:
enable: false
prompt: "如果請求path是以/httpbin開頭的,幫我去掉/httpbin首碼,其他的不要改。"
response:
enable: true
prompt: "幫我修改以下HTTP應答資訊,要求:1. content-type修改為application/json;2. body由xml轉化為json;3. 移除content-length。"
provider:
serviceName: qwen
domain: dashscope.aliyuncs.com
apiKey: xxxxxxxxxxxxx訪問原始的httpbin的/xml介面,結果為:
<?xml version='1.0' encoding='us-ascii'?>
<!-- A SAMPLE set of slides -->
<slideshow
title="Sample Slide Show"
date="Date of publication"
author="Yours Truly"
>
<!-- TITLE SLIDE -->
<slide type="all">
<title>Wake up to WonderWidgets!</title>
</slide>
<!-- OVERVIEW -->
<slide type="all">
<title>Overview</title>
<item>Why <em>WonderWidgets</em> are great</item>
<item/>
<item>Who <em>buys</em> WonderWidgets</item>
</slide>
</slideshow>使用以上配置,通過網關訪問httpbin的/xml介面,結果為:
{
"slideshow": {
"title": "Sample Slide Show",
"date": "Date of publication",
"author": "Yours Truly",
"slides": [
{
"type": "all",
"title": "Wake up to WonderWidgets!"
},
{
"type": "all",
"title": "Overview",
"items": [
"Why <em>WonderWidgets</em> are great",
"",
"Who <em>buys</em> WonderWidgets"
]
}
]
}
}