mirror of
https://github.com/alibaba/higress.git
synced 2026-06-26 02:35:02 +08:00
fix: fix some typo errors (#3988)
Co-authored-by: woody <yaodiwu618@gmail.com>
This commit is contained in:
@@ -168,7 +168,7 @@ bool PluginRootContext::parsePluginConfig(const json& configuration,
|
|||||||
LOG_WARN("failed to parse configuration for block_bodys.");
|
LOG_WARN("failed to parse configuration for block_bodys.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// compatiable
|
// compatible
|
||||||
if (!JsonArrayIterate(
|
if (!JsonArrayIterate(
|
||||||
configuration, "block_bodies", [&](const json& item) -> bool {
|
configuration, "block_bodies", [&](const json& item) -> bool {
|
||||||
auto body = JsonValueAs<std::string>(item);
|
auto body = JsonValueAs<std::string>(item);
|
||||||
|
|||||||
@@ -138,11 +138,11 @@ func parseOverrideRuleConfig(json gjson.Result, global config.PluginConfig, plug
|
|||||||
|
|
||||||
pluginConfig.FromJson(json)
|
pluginConfig.FromJson(json)
|
||||||
if err := pluginConfig.Validate(); err != nil {
|
if err := pluginConfig.Validate(); err != nil {
|
||||||
log.Errorf("overriden rule config is invalid: %v", err)
|
log.Errorf("overridden rule config is invalid: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := pluginConfig.Complete(); err != nil {
|
if err := pluginConfig.Complete(); err != nil {
|
||||||
log.Errorf("failed to apply overriden rule config: %v", err)
|
log.Errorf("failed to apply overridden rule config: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -577,7 +577,7 @@ func (c *ProviderConfig) FromJson(json gjson.Result) {
|
|||||||
if compatible := json.Get("qwenEnableCompatible"); compatible.Exists() {
|
if compatible := json.Get("qwenEnableCompatible"); compatible.Exists() {
|
||||||
c.qwenEnableCompatible = compatible.Bool()
|
c.qwenEnableCompatible = compatible.Bool()
|
||||||
} else {
|
} else {
|
||||||
// Default use official compatiable mode
|
// Default use official compatible mode
|
||||||
c.qwenEnableCompatible = true
|
c.qwenEnableCompatible = true
|
||||||
}
|
}
|
||||||
c.qwenDomain = json.Get("qwenDomain").String()
|
c.qwenDomain = json.Get("qwenDomain").String()
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ func parseConfig(json gjson.Result, config *Config) error {
|
|||||||
config.engine = append(config.engine, searchEngine)
|
config.engine = append(config.engine, searchEngine)
|
||||||
internetExists = true
|
internetExists = true
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unkown search engine:%s", e.Get("type").String())
|
return fmt.Errorf("unknown search engine:%s", e.Get("type").String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
searchRewriteJson := json.Get("searchRewrite")
|
searchRewriteJson := json.Get("searchRewrite")
|
||||||
@@ -271,7 +271,7 @@ func parseConfig(json gjson.Result, config *Config) error {
|
|||||||
config.searchRewrite = searchRewrite
|
config.searchRewrite = searchRewrite
|
||||||
}
|
}
|
||||||
if len(config.engine) == 0 {
|
if len(config.engine) == 0 {
|
||||||
return fmt.Errorf("no avaliable search engine found")
|
return fmt.Errorf("no available search engine found")
|
||||||
}
|
}
|
||||||
log.Debugf("ai search enabled, config: %#v", config)
|
log.Debugf("ai search enabled, config: %#v", config)
|
||||||
return nil
|
return nil
|
||||||
@@ -529,7 +529,7 @@ func executeSearch(ctx wrapper.HttpContext, config Config, queryIndex int, body
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("modify request message content failed, err:%v, body:%s", err, body)
|
log.Errorf("modify request message content failed, err:%v, body:%s", err, body)
|
||||||
} else {
|
} else {
|
||||||
log.Debugf("modifeid body:%s", modifiedBody)
|
log.Debugf("modified body:%s", modifiedBody)
|
||||||
proxywasm.ReplaceHttpRequestBody(modifiedBody)
|
proxywasm.ReplaceHttpRequestBody(modifiedBody)
|
||||||
if config.needReference {
|
if config.needReference {
|
||||||
ctx.SetContext("References", strings.Join(formattedReferences, "\n\n"))
|
ctx.SetContext("References", strings.Join(formattedReferences, "\n\n"))
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ description: 阿里云内容安全检测
|
|||||||
## 配置说明
|
## 配置说明
|
||||||
| Name | Type | Requirement | Default | Description |
|
| Name | Type | Requirement | Default | Description |
|
||||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||||
| `serviceName` | string | requried | - | 服务名 |
|
| `serviceName` | string | required | - | 服务名 |
|
||||||
| `servicePort` | string | requried | - | 服务端口 |
|
| `servicePort` | string | required | - | 服务端口 |
|
||||||
| `serviceHost` | string | requried | - | 阿里云内容安全endpoint的域名 |
|
| `serviceHost` | string | required | - | 阿里云内容安全endpoint的域名 |
|
||||||
| `accessKey` | string | requried | - | 阿里云AK |
|
| `accessKey` | string | required | - | 阿里云AK |
|
||||||
| `secretKey` | string | requried | - | 阿里云SK |
|
| `secretKey` | string | required | - | 阿里云SK |
|
||||||
| `action` | string | requried | - | 阿里云ai安全业务接口 |
|
| `action` | string | required | - | 阿里云ai安全业务接口 |
|
||||||
| `securityToken` | string | optional | - | 阿里云安全令牌(用于临时凭证) |
|
| `securityToken` | string | optional | - | 阿里云安全令牌(用于临时凭证) |
|
||||||
| `checkRequest` | bool | optional | false | 检查提问内容是否合规 |
|
| `checkRequest` | bool | optional | false | 检查提问内容是否合规 |
|
||||||
| `checkResponse` | bool | optional | false | 检查大模型的回答内容是否合规,生效时会使流式响应变为非流式 |
|
| `checkResponse` | bool | optional | false | 检查大模型的回答内容是否合规,生效时会使流式响应变为非流式 |
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ Plugin Priority: `300`
|
|||||||
## Configuration
|
## Configuration
|
||||||
| Name | Type | Requirement | Default | Description |
|
| Name | Type | Requirement | Default | Description |
|
||||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||||
| `serviceName` | string | requried | - | service name |
|
| `serviceName` | string | required | - | service name |
|
||||||
| `servicePort` | string | requried | - | service port |
|
| `servicePort` | string | required | - | service port |
|
||||||
| `serviceHost` | string | requried | - | Host of Aliyun content security service endpoint |
|
| `serviceHost` | string | required | - | Host of Aliyun content security service endpoint |
|
||||||
| `accessKey` | string | requried | - | Aliyun accesskey |
|
| `accessKey` | string | required | - | Aliyun accesskey |
|
||||||
| `secretKey` | string | requried | - | Aliyun secretkey |
|
| `secretKey` | string | required | - | Aliyun secretkey |
|
||||||
| `action` | string | requried | - | Aliyun ai guardrails business interface |
|
| `action` | string | required | - | Aliyun ai guardrails business interface |
|
||||||
| `checkRequest` | bool | optional | false | check if the input is legal |
|
| `checkRequest` | bool | optional | false | check if the input is legal |
|
||||||
| `checkResponse` | bool | optional | false | check if the output is legal |
|
| `checkResponse` | bool | optional | false | check if the output is legal |
|
||||||
| `requestCheckService` | string | optional | llm_query_moderation | Aliyun yundun service name for input check |
|
| `requestCheckService` | string | optional | llm_query_moderation | Aliyun yundun service name for input check |
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ AI 请求响应转换插件,通过LLM对请求/响应的header以及body进行
|
|||||||
## 配置说明
|
## 配置说明
|
||||||
| Name | Type | Requirement | Default | Description |
|
| Name | Type | Requirement | Default | Description |
|
||||||
| :- | :- | :- | :- | :- |
|
| :- | :- | :- | :- | :- |
|
||||||
| request.enable | bool | requried | - | 是否在request阶段开启转换 |
|
| request.enable | bool | required | - | 是否在request阶段开启转换 |
|
||||||
| request.prompt | string | requried | - | request阶段转换使用的prompt |
|
| request.prompt | string | required | - | request阶段转换使用的prompt |
|
||||||
| response.enable | string | requried | - | 是否在response阶段开启转换 |
|
| response.enable | string | required | - | 是否在response阶段开启转换 |
|
||||||
| response.prompt | string | requried | - | response阶段转换使用的prompt |
|
| response.prompt | string | required | - | response阶段转换使用的prompt |
|
||||||
| provider.serviceName | string | requried | - | DNS类型的服务名,目前仅支持通义千问 |
|
| provider.serviceName | string | required | - | DNS类型的服务名,目前仅支持通义千问 |
|
||||||
| provider.domain | string | requried | - | LLM服务域名 |
|
| provider.domain | string | required | - | LLM服务域名 |
|
||||||
| provider.apiKey | string | requried | - | 阿里云dashscope服务的API Key |
|
| provider.apiKey | string | required | - | 阿里云dashscope服务的API Key |
|
||||||
|
|
||||||
## 配置示例
|
## 配置示例
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ func awaitConvergence(t *testing.T, threshold int, maxTimeToConsistency time.Dur
|
|||||||
select {
|
select {
|
||||||
// Capture the overall timeout
|
// Capture the overall timeout
|
||||||
case <-to:
|
case <-to:
|
||||||
t.Fatalf("timeout while waiting after %d attempts, %d/%d sucessess", attempts, successes, threshold)
|
t.Fatalf("timeout while waiting after %d attempts, %d/%d successes", attempts, successes, threshold)
|
||||||
// And the per-try delay
|
// And the per-try delay
|
||||||
case <-time.After(delay):
|
case <-time.After(delay):
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ func awaitConvergence(t *testing.T, threshold int, maxTimeToConsistency time.Dur
|
|||||||
select {
|
select {
|
||||||
// Capture the overall timeout
|
// Capture the overall timeout
|
||||||
case <-to:
|
case <-to:
|
||||||
t.Fatalf("timeout while waiting after %d attempts, %d/%d sucessess", attempts, successes, threshold)
|
t.Fatalf("timeout while waiting after %d attempts, %d/%d successes", attempts, successes, threshold)
|
||||||
// And the per-try delay
|
// And the per-try delay
|
||||||
case <-time.After(delay):
|
case <-time.After(delay):
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user