mirror of
https://github.com/jdiaz97/pdfx.git
synced 2026-06-19 20:06:35 +02:00
changed name of old function, plus, removed GUI libraries since it's not a priority
This commit is contained in:
Generated
+8
-2843
File diff suppressed because it is too large
Load Diff
@@ -10,12 +10,4 @@ reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
pdf-extract = "0.7"
|
||||
clap = "4.5.39"
|
||||
egui = "0.31.1"
|
||||
eframe = { version = "0.31.1", default-features = false, features = [
|
||||
"accesskit", # Make egui compatible with screen readers. NOTE: adds a lot of dependencies.
|
||||
"default_fonts", # Embed the default egui fonts.
|
||||
"glow", # Use the glow rendering backend. Alternative: "wgpu".
|
||||
"persistence", # Enable restoring app state when restarting the app.
|
||||
"wayland", # To support Linux (and CI)
|
||||
] }
|
||||
winapi = { version = "0.3", features = ["winuser", "wincon"] }
|
||||
|
||||
+2
-3
@@ -1,7 +1,7 @@
|
||||
use clap::{Arg, Command};
|
||||
use std::process;
|
||||
use std::env;
|
||||
use crate::extractor::extract_contact_info;
|
||||
use crate::extractor::retrieve;
|
||||
|
||||
pub async fn run_cli() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let matches = Command::new("pdfy")
|
||||
@@ -41,8 +41,7 @@ pub async fn run_cli() -> Result<(), Box<dyn std::error::Error>> {
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
// Call the extraction function
|
||||
match extract_contact_info(api_key, pdf_file, prompt).await {
|
||||
match retrieve(api_key, pdf_file, prompt).await {
|
||||
Ok(result) => {
|
||||
println!("{}", result);
|
||||
}
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ impl PdfExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn extract_contact_info(api_key: String, pdf_file: &str, prompt: &str) -> Result<String> {
|
||||
pub async fn retrieve(api_key: String, pdf_file: &str, prompt: &str) -> Result<String> {
|
||||
let extractor = PdfExtractor::new(api_key);
|
||||
let result: Value = extractor.extract_pdf_to_json(pdf_file, prompt).await?;
|
||||
let formatted = serde_json::to_string_pretty(&result)?;
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
pub mod gui;
|
||||
pub mod cli;
|
||||
pub mod extractor;
|
||||
+8
-8
@@ -1,14 +1,14 @@
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let _ = pdfy::cli::run_cli().await;
|
||||
hide_window();
|
||||
// hide_window();
|
||||
// boquilahub::gui::run_gui();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn hide_window() {
|
||||
use winapi::um::wincon::FreeConsole;
|
||||
unsafe {
|
||||
FreeConsole(); // Detaches and closes the console window
|
||||
}
|
||||
}
|
||||
// #[cfg(target_os = "windows")]
|
||||
// fn hide_window() {
|
||||
// use winapi::um::wincon::FreeConsole;
|
||||
// unsafe {
|
||||
// FreeConsole(); // Detaches and closes the console window
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user