Refactor: Update toTitleCase function and CrashErrorComponent (#4940)

* Refactor: Update Data class to handle different types of text inputs

The Data class in the langflow schema has been updated to handle different types of text inputs. Previously, the page_content attribute was expected to be a string, but now it can also accept other types. If the input is already a string, it is used as is. Otherwise, it is converted to a string before being assigned to the page_content attribute of the Document object.

This change improves the flexibility and robustness of the Data class, allowing it to handle a wider range of input types.

* Refactor: Update toTitleCase function to handle ignoreTitleCase option

* Refactor: Update CrashErrorComponent to add ignoreTitleCase option to the Report on GitHub button

* [autofix.ci] apply automated fixes
This commit is contained in:
anovazzi1 2024-12-03 13:01:29 -03:00 committed by GitHub
commit e14c35ceb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -51,7 +51,7 @@ export default function CrashErrorComponent({
target="_blank"
rel="noopener noreferrer"
>
<Button className="ml-3" variant={"outline"}>
<Button className="ml-3" ignoreTitleCase variant={"outline"}>
Report on GitHub
</Button>
</a>

View file

@ -53,6 +53,7 @@ export interface ButtonProps
asChild?: boolean;
loading?: boolean;
unstyled?: boolean;
ignoreTitleCase?: boolean;
}
function toTitleCase(text: string) {
@ -74,6 +75,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
disabled,
asChild = false,
children,
ignoreTitleCase = false,
...props
},
ref,
@ -81,7 +83,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
const Comp = asChild ? Slot : "button";
let newChildren = children;
if (typeof children === "string") {
newChildren = toTitleCase(children);
newChildren = ignoreTitleCase ? children : toTitleCase(children);
}
return (
<>