Localize user-facing UI, agent output, and backend messages to Simplified Chinese
ci / go (push) Waiting to run
ci / go-db (agent) (push) Waiting to run
ci / go-db (config) (push) Waiting to run
ci / go-db (db) (push) Waiting to run
ci / go-db (evidence) (push) Waiting to run
ci / go-db (llmrec) (push) Waiting to run
ci / go-db (server) (push) Waiting to run
detections / detections (push) Waiting to run
docs / links (push) Waiting to run
web / web (push) Waiting to run
ci / go (push) Waiting to run
ci / go-db (agent) (push) Waiting to run
ci / go-db (config) (push) Waiting to run
ci / go-db (db) (push) Waiting to run
ci / go-db (evidence) (push) Waiting to run
ci / go-db (llmrec) (push) Waiting to run
ci / go-db (server) (push) Waiting to run
detections / detections (push) Waiting to run
docs / links (push) Waiting to run
web / web (push) Waiting to run
This commit is contained in:
+7
-7
@@ -83,17 +83,17 @@ type webhookItem struct {
|
||||
func (webhookChannel) Validate(cfg map[string]any) error {
|
||||
raw := cfgString(cfg, "url")
|
||||
if raw == "" {
|
||||
return errors.New("대상 URL이 없습니다")
|
||||
return errors.New("缺少目标 URL")
|
||||
}
|
||||
if err := validateHTTPURL(raw); err != nil {
|
||||
return fmt.Errorf("대상 URL이 올바르지 않습니다: %w", err)
|
||||
return fmt.Errorf("目标 URL 无效:%w", err)
|
||||
}
|
||||
if m := strings.ToUpper(cfgString(cfg, "method")); m != "" && m != http.MethodGet && m != http.MethodPost && m != http.MethodPut && m != http.MethodPatch {
|
||||
return fmt.Errorf("지원하지 않는 메서드입니다: %s (GET/POST/PUT/PATCH 중에서 선택하세요)", m)
|
||||
return fmt.Errorf("不支持的方法:%s (请从 GET/POST/PUT/PATCH 中选择)", m)
|
||||
}
|
||||
if tpl := cfgString(cfg, "body_template"); tpl != "" {
|
||||
if _, err := parseWebhookTemplate(tpl); err != nil {
|
||||
return fmt.Errorf("요청 본문 템플릿 문법이 올바르지 않습니다: %w", err)
|
||||
return fmt.Errorf("请求体模板语法无效:%w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -119,7 +119,7 @@ func (c webhookChannel) Send(ctx context.Context, cfg map[string]any, m Message)
|
||||
// 模板渲染出的是字符串形式的 JSON,这里转成 json.RawMessage 原样发出,
|
||||
// 避免二次转义把用户精心构造的结构套进一个 JSON 字符串里。
|
||||
if !json.Valid([]byte(body)) {
|
||||
return 0, Permanent(errors.New("요청 본문 템플릿의 렌더링 결과가 올바른 JSON이 아닙니다"))
|
||||
return 0, Permanent(errors.New("请求体模板的渲染结果不是合法的 JSON"))
|
||||
}
|
||||
payload = json.RawMessage(body)
|
||||
}
|
||||
@@ -147,11 +147,11 @@ func renderWebhookBody(tpl string, m Message) (string, error) {
|
||||
}
|
||||
t, err := parseWebhookTemplate(tpl)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("요청 본문 템플릿 문법이 올바르지 않습니다: %w", err)
|
||||
return "", fmt.Errorf("请求体模板语法无效:%w", err)
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
if err := t.Execute(&buf, newWebhookTemplateData(m)); err != nil {
|
||||
return "", fmt.Errorf("요청 본문 템플릿을 렌더링하지 못했습니다: %w", err)
|
||||
return "", fmt.Errorf("无法渲染请求体模板:%w", err)
|
||||
}
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user