修改: 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
console.log("Body.stream==========" + body.stream);
if (body.stream === false) {
let fullResponse = {
content: "",

View File

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