sync: 同步 monkey-ai@weiyuan(ddc5b9443) 的 web/ 到 ui-optimization
- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等, semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi - 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复 - 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志 - 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求 - 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新 - 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
This commit is contained in:
@@ -390,7 +390,7 @@ export const getChannelsColumns = ({
|
||||
size='small'
|
||||
type='primary'
|
||||
theme='outline'
|
||||
onClick={(e) => {
|
||||
onClick={async (e) => {
|
||||
e.stopPropagation();
|
||||
writeClipboardText(record.remark)
|
||||
.then(() => {
|
||||
|
||||
@@ -180,6 +180,7 @@ const originInputs = {
|
||||
chat_image_to_images_enabled: false,
|
||||
system_prompt: '',
|
||||
system_prompt_override: false,
|
||||
responses_system_prompt_mode: 'native',
|
||||
client_only: false, // 只接受 Claude Code 客户端请求
|
||||
bound_user_ids: '', // 绑定用户ID列表
|
||||
os_restriction: [], // 操作系统白名单,仅 Claude 原生渠道(type=14)生效,空数组=无限制
|
||||
@@ -190,6 +191,7 @@ const originInputs = {
|
||||
sticky_user_id_mode: 'native', // 注入形态:native(仿 Claude Code 原生)/ opaque
|
||||
cache_breakpoint_fill: false, // 给完全没有 cache_control 的大上下文请求补一个缓存断点
|
||||
cache_breakpoint_min_tokens: 0, // 注入门限(估算 prompt token),0=用后端默认 10000
|
||||
cache_creation_default_ttl: '', // 未分档缓存创建按哪档计费,''=跟随全局,可选 5m/1h
|
||||
settings: '',
|
||||
// 仅 Vertex: 密钥格式(存入 settings.vertex_key_type)
|
||||
vertex_key_type: 'json',
|
||||
@@ -423,6 +425,8 @@ const EditChannelModal = (props) => {
|
||||
pass_through_body_enabled: false,
|
||||
chat_image_to_images_enabled: false,
|
||||
system_prompt: '',
|
||||
system_prompt_override: false,
|
||||
responses_system_prompt_mode: 'native',
|
||||
client_only: false,
|
||||
bound_user_ids: '',
|
||||
os_restriction: [],
|
||||
@@ -433,6 +437,7 @@ const EditChannelModal = (props) => {
|
||||
sticky_user_id_mode: 'native',
|
||||
cache_breakpoint_fill: false,
|
||||
cache_breakpoint_min_tokens: 0,
|
||||
cache_creation_default_ttl: '',
|
||||
});
|
||||
const showApiConfigCard = true; // 控制是否显示 API 配置卡片
|
||||
const getInitValues = () => ({
|
||||
@@ -626,6 +631,10 @@ const EditChannelModal = (props) => {
|
||||
data.system_prompt = parsedSettings.system_prompt || '';
|
||||
data.system_prompt_override =
|
||||
parsedSettings.system_prompt_override || false;
|
||||
data.responses_system_prompt_mode =
|
||||
parsedSettings.responses_system_prompt_mode === 'input_user_message'
|
||||
? 'input_user_message'
|
||||
: 'native';
|
||||
data.client_only = parsedSettings.client_only || false;
|
||||
data.bound_user_ids = parsedSettings.bound_user_ids || '';
|
||||
data.os_restriction = Array.isArray(parsedSettings.os_restriction)
|
||||
@@ -646,6 +655,11 @@ const EditChannelModal = (props) => {
|
||||
parsedSettings.cache_breakpoint_fill || false;
|
||||
data.cache_breakpoint_min_tokens =
|
||||
parsedSettings.cache_breakpoint_min_tokens || 0;
|
||||
data.cache_creation_default_ttl = ['5m', '1h'].includes(
|
||||
parsedSettings.cache_creation_default_ttl,
|
||||
)
|
||||
? parsedSettings.cache_creation_default_ttl
|
||||
: '';
|
||||
} catch (error) {
|
||||
console.error('解析渠道设置失败:', error);
|
||||
data.force_format = false;
|
||||
@@ -656,6 +670,7 @@ const EditChannelModal = (props) => {
|
||||
data.chat_image_to_images_enabled = false;
|
||||
data.system_prompt = '';
|
||||
data.system_prompt_override = false;
|
||||
data.responses_system_prompt_mode = 'native';
|
||||
data.client_only = false;
|
||||
data.bound_user_ids = '';
|
||||
data.os_restriction = [];
|
||||
@@ -666,6 +681,7 @@ const EditChannelModal = (props) => {
|
||||
data.sticky_user_id_mode = 'native';
|
||||
data.cache_breakpoint_fill = false;
|
||||
data.cache_breakpoint_min_tokens = 0;
|
||||
data.cache_creation_default_ttl = '';
|
||||
}
|
||||
} else {
|
||||
data.force_format = false;
|
||||
@@ -676,6 +692,7 @@ const EditChannelModal = (props) => {
|
||||
data.chat_image_to_images_enabled = false;
|
||||
data.system_prompt = '';
|
||||
data.system_prompt_override = false;
|
||||
data.responses_system_prompt_mode = 'native';
|
||||
data.client_only = false;
|
||||
data.bound_user_ids = '';
|
||||
data.os_restriction = [];
|
||||
@@ -686,6 +703,7 @@ const EditChannelModal = (props) => {
|
||||
data.sticky_user_id_mode = 'native';
|
||||
data.cache_breakpoint_fill = false;
|
||||
data.cache_breakpoint_min_tokens = 0;
|
||||
data.cache_creation_default_ttl = '';
|
||||
}
|
||||
|
||||
if (data.settings) {
|
||||
@@ -792,6 +810,8 @@ const EditChannelModal = (props) => {
|
||||
data.chat_image_to_images_enabled || false,
|
||||
system_prompt: data.system_prompt,
|
||||
system_prompt_override: data.system_prompt_override || false,
|
||||
responses_system_prompt_mode:
|
||||
data.responses_system_prompt_mode || 'native',
|
||||
client_only: data.client_only || false,
|
||||
bound_user_ids: data.bound_user_ids || '',
|
||||
os_restriction: Array.isArray(data.os_restriction)
|
||||
@@ -806,6 +826,7 @@ const EditChannelModal = (props) => {
|
||||
sticky_user_id_mode: data.sticky_user_id_mode || 'native',
|
||||
cache_breakpoint_fill: data.cache_breakpoint_fill || false,
|
||||
cache_breakpoint_min_tokens: data.cache_breakpoint_min_tokens || 0,
|
||||
cache_creation_default_ttl: data.cache_creation_default_ttl || '',
|
||||
});
|
||||
initialModelsRef.current = (data.models || [])
|
||||
.map((model) => (model || '').trim())
|
||||
@@ -1075,6 +1096,7 @@ const EditChannelModal = (props) => {
|
||||
chat_image_to_images_enabled: false,
|
||||
system_prompt: '',
|
||||
system_prompt_override: false,
|
||||
responses_system_prompt_mode: 'native',
|
||||
client_only: false,
|
||||
bound_user_ids: '',
|
||||
os_restriction: [],
|
||||
@@ -1085,6 +1107,7 @@ const EditChannelModal = (props) => {
|
||||
sticky_user_id_mode: 'native',
|
||||
cache_breakpoint_fill: false,
|
||||
cache_breakpoint_min_tokens: 0,
|
||||
cache_creation_default_ttl: '',
|
||||
});
|
||||
// 重置密钥模式状态
|
||||
setKeyMode('append');
|
||||
@@ -1403,6 +1426,11 @@ const EditChannelModal = (props) => {
|
||||
localInputs.chat_image_to_images_enabled || false,
|
||||
system_prompt: localInputs.system_prompt || '',
|
||||
system_prompt_override: localInputs.system_prompt_override || false,
|
||||
responses_system_prompt_mode: ['native', 'input_user_message'].includes(
|
||||
localInputs.responses_system_prompt_mode,
|
||||
)
|
||||
? localInputs.responses_system_prompt_mode
|
||||
: 'native',
|
||||
client_only: localInputs.client_only || false,
|
||||
bound_user_ids: localInputs.bound_user_ids || '',
|
||||
os_restriction: Array.isArray(localInputs.os_restriction)
|
||||
@@ -1432,6 +1460,13 @@ const EditChannelModal = (props) => {
|
||||
0,
|
||||
parseInt(localInputs.cache_breakpoint_min_tokens, 10) || 0,
|
||||
),
|
||||
// '' = 跟随全局「Claude设置」里的未分档缓存创建默认档位。
|
||||
// 枚举外的值一律落回 '',后端 ValidateSettings 也会拒绝脏值。
|
||||
cache_creation_default_ttl: ['5m', '1h'].includes(
|
||||
localInputs.cache_creation_default_ttl,
|
||||
)
|
||||
? localInputs.cache_creation_default_ttl
|
||||
: '',
|
||||
};
|
||||
try {
|
||||
localInputs.setting = mergeChannelSettings(
|
||||
@@ -1502,8 +1537,10 @@ const EditChannelModal = (props) => {
|
||||
delete localInputs.sticky_user_id_mode;
|
||||
delete localInputs.cache_breakpoint_fill;
|
||||
delete localInputs.cache_breakpoint_min_tokens;
|
||||
delete localInputs.cache_creation_default_ttl;
|
||||
delete localInputs.system_prompt;
|
||||
delete localInputs.system_prompt_override;
|
||||
delete localInputs.responses_system_prompt_mode;
|
||||
delete localInputs.is_enterprise_account;
|
||||
// 顶层的 vertex_key_type 不应发送给后端
|
||||
delete localInputs.vertex_key_type;
|
||||
@@ -2753,12 +2790,10 @@ const EditChannelModal = (props) => {
|
||||
showInfo(t('没有模型可以复制'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!(await copy(inputs.models.join(',')))) {
|
||||
throw new Error('Clipboard copy failed');
|
||||
}
|
||||
// copy 失败返回 false 而不抛错,以返回值为准
|
||||
if (await copy(inputs.models.join(','))) {
|
||||
showSuccess(t('模型列表已复制到剪贴板'));
|
||||
} catch (error) {
|
||||
} else {
|
||||
showError(t('复制失败'));
|
||||
}
|
||||
}}
|
||||
@@ -3756,6 +3791,26 @@ const EditChannelModal = (props) => {
|
||||
)}
|
||||
/>
|
||||
|
||||
<Form.Select
|
||||
field='cache_creation_default_ttl'
|
||||
label={t('未分档缓存创建默认档位')}
|
||||
style={{ width: '100%' }}
|
||||
optionList={[
|
||||
{ label: t('跟随全局'), value: '' },
|
||||
{ label: t('按 5 分钟档计费'), value: '5m' },
|
||||
{ label: t('按 1 小时档计费'), value: '1h' },
|
||||
]}
|
||||
onChange={(value) =>
|
||||
handleChannelSettingsChange(
|
||||
'cache_creation_default_ttl',
|
||||
value,
|
||||
)
|
||||
}
|
||||
extraText={t(
|
||||
'本渠道上游只返回缓存创建总量、未给出 5m/1h 拆分时,这部分按哪一档倍率计费,优先级高于「模型设置 → Claude设置」里的全局默认档位。上游已明确分档的 token 永远按实际返回结算,与此项无关。号池确定「不带 ttl 参数即落 5 分钟」的渠道才需要改成 5m。',
|
||||
)}
|
||||
/>
|
||||
|
||||
<Form.Input
|
||||
field='proxy'
|
||||
label={t('代理地址')}
|
||||
@@ -3797,6 +3852,29 @@ const EditChannelModal = (props) => {
|
||||
'如果用户请求中包含系统提示词,则使用此设置拼接到用户的系统提示词前面',
|
||||
)}
|
||||
/>
|
||||
<Form.Select
|
||||
field='responses_system_prompt_mode'
|
||||
label={t('Responses 系统提示词兼容模式')}
|
||||
optionList={[
|
||||
{
|
||||
label: t('原生模式(默认)'),
|
||||
value: 'native',
|
||||
},
|
||||
{
|
||||
label: t('号池兼容:放入 input 用户消息'),
|
||||
value: 'input_user_message',
|
||||
},
|
||||
]}
|
||||
onChange={(value) =>
|
||||
handleChannelSettingsChange(
|
||||
'responses_system_prompt_mode',
|
||||
value,
|
||||
)
|
||||
}
|
||||
extraText={t(
|
||||
'仅对命中 ForceResponsesModels 的 Chat→Responses 桥接请求生效;直接 Responses 请求和图片接口不转换。',
|
||||
)}
|
||||
/>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user