import { FC } from 'hono/jsx'; import { TopbarNav } from '../components/TopbarNav.js'; interface PrivacySettings { enabled: boolean; stripUserField: boolean; sanitizeFilePaths: boolean; pathPlaceholder: string; whitelistFilter: boolean; } interface Props { settings: PrivacySettings; detailLogEnabled?: boolean; cliDebug?: boolean; error?: string; success?: string; } const DEFAULT_PLACEHOLDER = '__USER__'; export const PrivacySettingsPage: FC = (props) => { const s = props.settings; const menuItems = [ { href: '/admin/models', label: '模型' }, { href: '/admin/users', label: '用户' }, { href: '/admin/api-keys', label: 'API Keys' }, { href: '/admin/model-groups', label: '模型组' }, { href: '/admin/stats', label: '统计' }, { href: '/admin/password', label: '密码设置' }, { href: '/admin/privacy', label: '隐私保护' }, ]; return ( 隐私保护 - LLM Gateway

隐私保护设置

{props.error &&
{props.error}
} {props.success &&
{props.success}
}
{/* 保留日志开关当前值,避免隐私表单提交时覆盖 */}
启用隐私保护
总开关,关闭时所有子功能不生效
抹掉 user 字段
删除请求中的 OpenAI user 字段(端点用户追踪)
文件路径用户名替换
将 /home/xxx/、/Users/xxx/ 等路径中的用户名替换为占位符
白名单字段过滤
只转发已知安全字段,过滤掉 user、metadata、extra_body 等
安全字段: messages, stream, temperature, max_tokens, top_p, presence_penalty, frequency_penalty, stop, response_format, tools, tool_choice, seed, stream_options

日志记录

{/* 保留隐私设置当前值,避免第二块表单提交时覆盖 */}
记录完整请求/响应日志
开启后记录完整请求/响应内容到文件({`{requestId}_{stage}.log`}),即时生效、无需重启 {props.cliDebug && ';当前以 --debug 启动,强制记录中'}
); };