mirror of
https://github.com/run-llama/template-workflow-classify-extract-sec.git
synced 2026-07-01 21:54:02 -04:00
Add copier-update script to help run mass copier updates (#166)
* add updater script * bump versions * fixer * chore(classify-extract-sec): copier update * chore(extract-basic): copier update * chore(extract-reconcile-invoice): copier update * fix format
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
||||
_commit: v0.3.6
|
||||
_commit: v0.4.0
|
||||
_src_path: https://github.com/run-llama/template-workflow-data-extraction
|
||||
|
||||
@@ -351,8 +351,9 @@ EXTRACT_CONFIG = ExtractConfig(
|
||||
extraction_mode=ExtractMode.PREMIUM,
|
||||
system_prompt=None,
|
||||
# advanced. Only compatible with Premium mode.
|
||||
citation_bbox=True,
|
||||
use_reasoning=False,
|
||||
cite_sources=False,
|
||||
cite_sources=True,
|
||||
confidence_scores=False,
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
"@radix-ui/themes": "^3.2.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"llama-cloud-services": "^0.3.4",
|
||||
"llama-cloud-services": "^0.5.2",
|
||||
"lucide-react": "^0.514.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
|
||||
@@ -1,6 +1,43 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import type { Highlight } from "@llamaindex/ui";
|
||||
import type { FieldCitation } from "llama-cloud-services/beta/agent";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function convertBoundingBoxesToHighlights(
|
||||
citations: FieldCitation[] | undefined,
|
||||
): Highlight[] {
|
||||
if (!citations || citations.length === 0) return [];
|
||||
|
||||
const highlights: Highlight[] = [];
|
||||
|
||||
for (const citation of citations) {
|
||||
const page = citation.page ?? 1;
|
||||
const boundingBoxes = citation.bounding_boxes;
|
||||
|
||||
if (boundingBoxes && boundingBoxes.length > 0) {
|
||||
for (const bbox of boundingBoxes) {
|
||||
highlights.push({
|
||||
page,
|
||||
x: bbox.x,
|
||||
y: bbox.y,
|
||||
width: bbox.w,
|
||||
height: bbox.h,
|
||||
});
|
||||
}
|
||||
} else if (citation.page !== undefined) {
|
||||
highlights.push({
|
||||
page,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return highlights;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { modifyJsonSchema } from "@llamaindex/ui/lib";
|
||||
import { APP_TITLE } from "@/lib/config";
|
||||
import { downloadExtractedDataItem } from "@/lib/export";
|
||||
import { useMetadataContext } from "@/lib/MetadataProvider";
|
||||
import { convertBoundingBoxesToHighlights } from "@/lib/utils";
|
||||
|
||||
export default function ItemPage() {
|
||||
const { itemId } = useParams<{ itemId: string }>();
|
||||
@@ -134,7 +135,7 @@ export default function ItemPage() {
|
||||
return (
|
||||
<div className="flex h-full bg-gray-50">
|
||||
{/* Left Side - File Preview */}
|
||||
<div className="w-1/2 border-r border-gray-200 bg-white">
|
||||
<div className="w-1/2 border-r h-full border-gray-200 bg-white">
|
||||
{itemData.data.file_id && (
|
||||
<FilePreview
|
||||
fileId={itemData.data.file_id}
|
||||
@@ -170,15 +171,11 @@ export default function ItemPage() {
|
||||
onChange={(updatedData) => {
|
||||
updateData(updatedData);
|
||||
}}
|
||||
onClickField={(args) => {
|
||||
// TODO: set multiple highlights
|
||||
setHighlight({
|
||||
page: args.metadata?.citation?.[0]?.page ?? 1,
|
||||
x: 100,
|
||||
y: 100,
|
||||
width: 0,
|
||||
height: 0,
|
||||
});
|
||||
onHoverField={(args) => {
|
||||
const highlights = convertBoundingBoxesToHighlights(
|
||||
args?.metadata?.citation,
|
||||
);
|
||||
setHighlight(highlights[0]);
|
||||
}}
|
||||
jsonSchema={appliedSchema}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user