Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pdl-live-react/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pdl-live-react/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ base64ct = { version = "1.7.1", features = ["alloc"] }
dirs = "6.0.0"
serde_norway = "0.9.42"
minijinja = { version = "2.9.0", features = ["custom_syntax"] }
ollama-rs = { version = "0.3.0", features = ["stream"] }
#ollama-rs = { version = "0.3.0", features = ["stream"] }
ollama-rs = { git = "https://github.com/starpit/ollama-rs.git", branch = "tools-pub-7", features = ["stream"] }
owo-colors = "4.2.0"
rustpython-vm = "0.4.0"
async-recursion = "1.1.1"
tokio-stream = "0.1.17"
tokio = { version = "1.44.1", features = ["io-std"] }
indexmap = { version = "2.9.0", features = ["serde"] }
rustpython-stdlib = { version = "0.4.0", features = ["zlib"] }
schemars = "0.8.22"

[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-cli = "2"
Expand Down
7 changes: 6 additions & 1 deletion pdl-live-react/src-tauri/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn setup(app: &mut tauri::App) -> Result<bool, Box<dyn ::std::error::Error>>
let args = compile_subcommand_matches.matches.args;

match compile_subcommand_matches.name.as_str() {
"beeai" => compile::beeai::compile(
"beeai" => compile::beeai::compile_to_file(
args.get("source")
.and_then(|a| a.value.as_str())
.expect("valid positional source arg"),
Expand All @@ -60,6 +60,11 @@ pub fn setup(app: &mut tauri::App) -> Result<bool, Box<dyn ::std::error::Error>>
.and_then(|a| a.value.as_bool())
.or(Some(false))
== Some(true),
subcommand_args
.get("no-stream")
.and_then(|a| a.value.as_bool())
.or(Some(false))
== Some(false),
)
.and_then(|_trace| Ok(true)),
"run" => run_pdl_program(
Expand Down
24 changes: 15 additions & 9 deletions pdl-live-react/src-tauri/src/compile/beeai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,7 @@ fn python_source_to_json(source_file_path: &str, debug: bool) -> Result<PathBuf,
Ok(dry_run_file)
}

pub fn compile(
source_file_path: &str,
output_path: &str,
debug: bool,
) -> Result<(), Box<dyn Error>> {
if debug {
eprintln!("Compiling beeai {} to {}", source_file_path, output_path);
}

pub fn compile(source_file_path: &str, debug: bool) -> Result<PdlBlock, Box<dyn Error>> {
let file = match Path::new(source_file_path)
.extension()
.and_then(OsStr::to_str)
Expand Down Expand Up @@ -559,6 +551,20 @@ asyncio.run(invoke())
text: body,
});

Ok(pdl)
}

pub fn compile_to_file(
source_file_path: &str,
output_path: &str,
debug: bool,
) -> Result<(), Box<dyn Error>> {
if debug {
eprintln!("Compiling beeai {} to {}", source_file_path, output_path);
}

let pdl = compile(source_file_path, debug)?;

match output_path {
"-" => println!("{}", to_string(&pdl)?),
_ => {
Expand Down
Loading