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