Fix data schema issue with pdf parser (#1605)
This commit is contained in:
@@ -91,6 +91,11 @@ export const helpTooltips = {
|
||||
waitInSeconds:
|
||||
"Specify a number for how many seconds to wait. Value must be between 0 and 300 seconds.",
|
||||
},
|
||||
pdfParser: {
|
||||
...baseHelpTooltipContent,
|
||||
fileUrl: "The URL from which the file will be downloaded",
|
||||
jsonSchema: "Specify a format for the extracted information from the file",
|
||||
},
|
||||
};
|
||||
|
||||
export const placeholders = {
|
||||
@@ -125,4 +130,5 @@ export const placeholders = {
|
||||
codeBlock: basePlaceholderContent,
|
||||
fileUrl: basePlaceholderContent,
|
||||
wait: basePlaceholderContent,
|
||||
pdfParser: basePlaceholderContent,
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ function PDFParserNode({ id, data }: NodeProps<PDFParserNode>) {
|
||||
const deleteNodeCallback = useDeleteNodeCallback();
|
||||
const [inputs, setInputs] = useState({
|
||||
fileUrl: data.fileUrl,
|
||||
dataSchema: data.jsonSchema,
|
||||
jsonSchema: data.jsonSchema,
|
||||
});
|
||||
const [label, setLabel] = useNodeLabelChangeHandler({
|
||||
id,
|
||||
@@ -79,7 +79,7 @@ function PDFParserNode({ id, data }: NodeProps<PDFParserNode>) {
|
||||
<div className="space-y-2">
|
||||
<div className="flex gap-2">
|
||||
<Label className="text-xs text-slate-300">File URL</Label>
|
||||
<HelpTooltip content={helpTooltips["fileParser"]["fileUrl"]} />
|
||||
<HelpTooltip content={helpTooltips["pdfParser"]["fileUrl"]} />
|
||||
</div>
|
||||
<Input
|
||||
value={inputs.fileUrl}
|
||||
@@ -97,13 +97,15 @@ function PDFParserNode({ id, data }: NodeProps<PDFParserNode>) {
|
||||
<div className="flex gap-4">
|
||||
<div className="flex gap-2">
|
||||
<Label className="text-xs text-slate-300">Data Schema</Label>
|
||||
<HelpTooltip content={helpTooltips["task"]["dataSchema"]} />
|
||||
<HelpTooltip
|
||||
content={helpTooltips["pdfParser"]["jsonSchema"]}
|
||||
/>
|
||||
</div>
|
||||
<Checkbox
|
||||
checked={inputs.dataSchema !== "null"}
|
||||
checked={inputs.jsonSchema !== "null"}
|
||||
onCheckedChange={(checked) => {
|
||||
handleChange(
|
||||
"dataSchema",
|
||||
"jsonSchema",
|
||||
checked
|
||||
? JSON.stringify(
|
||||
dataSchemaExampleForFileExtraction,
|
||||
@@ -115,13 +117,13 @@ function PDFParserNode({ id, data }: NodeProps<PDFParserNode>) {
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{inputs.dataSchema !== "null" && (
|
||||
{inputs.jsonSchema !== "null" && (
|
||||
<div>
|
||||
<CodeEditor
|
||||
language="json"
|
||||
value={inputs.dataSchema}
|
||||
value={inputs.jsonSchema}
|
||||
onChange={(value) => {
|
||||
handleChange("dataSchema", value);
|
||||
handleChange("jsonSchema", value);
|
||||
}}
|
||||
className="nowheel nopan"
|
||||
fontSize={8}
|
||||
|
||||
Reference in New Issue
Block a user