修改: app/api/bedrock.ts

修改:     app/components/ui-lib.tsx
This commit is contained in:
glay 2024-11-13 18:37:47 +08:00
parent 6bc1612720
commit 225ad30898
2 changed files with 5 additions and 5 deletions

View File

@ -190,7 +190,6 @@ export async function handle(
} }
// If stream is false, accumulate the response and return as JSON // If stream is false, accumulate the response and return as JSON
console.log("Body.stream==========" + body.stream);
if (body.stream === false) { if (body.stream === false) {
let fullResponse = { let fullResponse = {
content: "", content: "",

View File

@ -272,19 +272,20 @@ export function Input(props: InputProps) {
export function PasswordInput( export function PasswordInput(
props: HTMLProps<HTMLInputElement> & { props: HTMLProps<HTMLInputElement> & {
aria?: string; aria?: string;
maskWhenShow?: boolean; // New prop to control masking behavior maskWhenShow?: boolean;
}, },
) { ) {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [displayValue, setDisplayValue] = useState(props.value as string); const [displayValue, setDisplayValue] = useState(props.value as string);
const { maskWhenShow, ...inputProps } = props;
useEffect(() => { useEffect(() => {
if (props.maskWhenShow && visible && props.value) { if (maskWhenShow && visible && props.value) {
setDisplayValue(maskSensitiveValue(props.value as string)); setDisplayValue(maskSensitiveValue(props.value as string));
} else { } else {
setDisplayValue(props.value as string); setDisplayValue(props.value as string);
} }
}, [visible, props.value, props.maskWhenShow]); }, [visible, props.value, maskWhenShow]);
function changeVisibility() { function changeVisibility() {
setVisible(!visible); setVisible(!visible);
@ -305,7 +306,7 @@ export function PasswordInput(
className={"password-eye"} className={"password-eye"}
/> />
<input <input
{...props} {...inputProps}
value={displayValue} value={displayValue}
onChange={handleChange} onChange={handleChange}
type={visible ? "text" : "password"} type={visible ? "text" : "password"}