{s.type}:{detail}
@@ -628,7 +637,11 @@ export default function SettingsChannelAffinity(props) {
const xs = (keySources || []).map(normalizeKeySource).filter((x) => x.type);
if (xs.length === 0) return { ok: false, message: 'Key 来源不能为空' };
for (const x of xs) {
- if (x.type === 'context_int' || x.type === 'context_string') {
+ if (
+ x.type === 'context_int' ||
+ x.type === 'context_string' ||
+ x.type === 'request_header'
+ ) {
if (!x.key) return { ok: false, message: 'Key 不能为空' };
} else if (x.type === 'gjson') {
if (!x.path) return { ok: false, message: 'Path 不能为空' };
@@ -1284,7 +1297,7 @@ export default function SettingsChannelAffinity(props) {
{t(
- 'context_int/context_string 从请求上下文读取;gjson 从入口请求的 JSON body 按 gjson path 读取。',
+ 'context_int/context_string 从请求上下文读取;request_header 从入口请求头读取;gjson 从入口请求的 JSON body 按 gjson path 读取,可选继续用内层 JSON Path 提取子字段。',
)}
@@ -1326,7 +1339,11 @@ export default function SettingsChannelAffinity(props) {
return (
{
+ const src = normalizeKeySource(
+ editingRule?.key_sources?.[idx],
+ );
+ return (
+
+ updateKeySource(idx, { nested_path: value })
+ }
+ />
+ );
+ },
+ },
{
title: t('操作'),
width: 90,