- 新增 UnitInput 与 kind=tokens:上下文预算、单次 token 上限、自定义模型上下文窗口以 K 输入(允许小数),存储仍为原始 token 数;校验与提示用 K 表述;列表/详情 token 数统一 K/M 简写(formatTokens) - 新增 SecretInput 与 kind=secret:已保存时显示「已设置 ••••••••」(有服务端掩码时带末 4 位),聚焦直接输入替换,留空保持,「清除」确认后保存生效;替换模型服务、TMDB、网页搜索、下载器、媒体服务器、浏览器服务、站点账号、Passkey、本机 Token 各处 - 统一只写凭证服务端语义:省略或空串 = 不变,null = 清除(contracts secretInput);下载器/媒体服务器新增清除;站点凭证同类更新可留空保持密码/Cookie/API Key/TOTP,TOTP 可 null 清除,不再误删 TOTP 与 UA - contextBudget 最小值 4096→4000、contextWindow 1024→1000,便于按 K 填写 - 测试:换算与校验、SecretInput 渲染与状态、各接口留空不变/显式清除 Co-Authored-By: Claude Opus 5.5 <[email protected]>
33 lines
945 B
TypeScript
33 lines
945 B
TypeScript
import type * as React from "react";
|
|
import { Input } from "~/components/ui/input.tsx";
|
|
import { cn } from "~/lib/utils.ts";
|
|
|
|
/**
|
|
* 带固定单位后缀的数字输入(如 token 数以 K 为单位:输入 128 表示 128K)。
|
|
* 值是字符串,允许小数;换算与校验由调用方做(token 见 ~/lib/tokens.ts)。
|
|
*/
|
|
export function UnitInput({
|
|
unit,
|
|
className,
|
|
inputClassName,
|
|
...props
|
|
}: Omit<React.ComponentProps<"input">, "type"> & { unit: string; inputClassName?: string }) {
|
|
return (
|
|
<div className={cn("relative min-w-0", className)}>
|
|
<Input
|
|
type="text"
|
|
inputMode="decimal"
|
|
autoComplete="off"
|
|
{...props}
|
|
className={cn("pr-9 tabular-nums", inputClassName)}
|
|
/>
|
|
<span
|
|
aria-hidden
|
|
className="pointer-events-none absolute inset-y-0 right-3 flex items-center text-caption text-muted-foreground"
|
|
>
|
|
{unit}
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|