Skip to content
Merged

Dev #31

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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ simple-ai-backend = { path = "packages/backend" }
simple-ai-frontend = { path = "packages/frontend" }
simple-ai-macros = { path = "packages/macros" }

uuid = { version = "1.19", features = [ "v5" ]}
dioxus = { version = "0.7.1" }

[profile]
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "bundled_node"
description = "A bundled node"
author = "Author"
date = "2025-03-10T12:33:26.326778746Z"
date = "2025-12-04T12:05:46.983020666Z"

[[versions]]
version = "0.0.1"
Expand Down
1 change: 1 addition & 0 deletions packages/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ bincode = { version = "1.1.3" }
tokio = { version = "1.43.0", features = ["sync"] }
fuzzy-matcher = "0.3.7"
walkdir = "2.5.0"
onnx-ir = "0.19.1"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
25 changes: 0 additions & 25 deletions packages/backend/nodes/complex_bundled_node/meta.toml

This file was deleted.

Binary file not shown.
Binary file not shown.
10 changes: 0 additions & 10 deletions packages/backend/nodes/test_code_node/meta.toml

This file was deleted.

5 changes: 0 additions & 5 deletions packages/backend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
pub mod modules;

pub mod prelude {
pub use super::modules::nms::*;
pub use super::modules::utils::prelude::*;
}
4 changes: 2 additions & 2 deletions packages/backend/src/modules.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod compiler;
pub mod nms;
pub mod nodes;
pub mod projects;
pub mod utils;
1 change: 0 additions & 1 deletion packages/backend/src/modules/compiler.rs

This file was deleted.

52 changes: 0 additions & 52 deletions packages/backend/src/modules/nms/create.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
pub mod create;
pub mod delete;
pub mod modify;
pub mod query;
pub mod save;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::path::Path;

use crate::modules::utils::prelude::*;

pub fn delete_node(name: String, version: Option<String>) -> Result<(), String> {
let node_path = Path::new("nodes/").join(&name);
pub fn delete_node(author: String, name: String, version: Option<String>) -> Result<(), String> {
let node_path = Path::new("nodes/").join(&author).join(&name);
let meta_path = node_path.join("meta.toml");

if !node_path.exists() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ pub fn get_all_nodes() -> Result<NodeContainer, String> {
let save_node: SaveNode = bincode::deserialize(&data)
.map_err(|e| format!("Failed to deserialize {}: {}", path.display(), e))?;

let node = Node::from(save_node);
let node = Node::from_save_node(save_node, None);
nc.push_context(StrongNode::from(node));
}

Ok(nc)
}

/// This function searches through all available Nodes and returns a NodeContainer containing all Nodes available for the inferred environment.
pub fn query_nodes(query_filter: Vec<QueryFilter>) -> NodeContainer {
pub fn query_nodes(query_filters: Vec<NodeQueryFilter>) -> NodeContainer {
let all_nodes = get_all_nodes().expect("Error walking directory!");

all_nodes
.iter()
.filter(|node| {
query_filter.iter().all(|filter| {
query_filters.iter().all(|filter| {
filter
.clone()
.is_ok(node.context.try_lock().unwrap().to_owned())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::modules::nms::check_name;
use crate::modules::nodes::check_name;
use crate::modules::utils::prelude::*;
use anyhow::Result;
use std::fs::{self, create_dir, create_dir_all, File};
Expand All @@ -9,6 +9,7 @@ use toml;
// #[cfg(feature = "desktop")]
pub fn save_node(node: Node) -> Result<(), String> {
let name = node.name.clone();
let author = node.author.clone();

if !check_name(name.clone()) {
return Err(format!(
Expand All @@ -17,7 +18,7 @@ pub fn save_node(node: Node) -> Result<(), String> {
));
}

let node_path = Path::new("nodes/").join(&name);
let node_path = Path::new("nodes/").join(&author).join(&name);
if !node_path.exists() {
create_dir_all(&node_path).map_err(|e| e.to_string())?;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/modules/projects.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod create;
pub mod delete;
pub mod query;
pub mod settings;
45 changes: 45 additions & 0 deletions packages/backend/src/modules/projects/query.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use std::path::Path;

use crate::modules::utils::prelude::*;
use walkdir::WalkDir;

pub fn get_all_projects() -> Result<Vec<Project>, String> {
let projects_dir = Path::new("projects");
if !projects_dir.exists() {
return Ok(Vec::default());
}

let mut projects = Vec::default();

for entry in WalkDir::new(projects_dir)
.into_iter()
.filter_map(Result::ok)
.filter(|e| e.path().extension().is_some_and(|ext| ext == "json"))
{
let path = entry.path();
let data = std::fs::read_to_string(path)
.map_err(|e| format!("Failed to read {}: {}", path.display(), e))?;

let project: Project = serde_json::from_str(&data)
.map_err(|e| format!("Failed to deserialize {}: {}", path.display(), e))?;

projects.push(project);
}

Ok(projects)
}

/// This function searches through all available Projects
pub fn query_projects(query_filters: Vec<ProjectQueryFilter>) -> Vec<Project> {
let all_projects = get_all_projects().expect("Error walking directory!");

all_projects
.iter()
.filter(|project| {
query_filters
.iter()
.all(|filter| filter.clone().is_ok(project))
})
.cloned()
.collect()
}
Empty file.
4 changes: 4 additions & 0 deletions packages/backend/src/modules/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ pub mod dtype;
pub mod environment;
pub mod metadata;
pub mod node;
pub mod node_type;
pub mod param;
pub mod project;
pub mod query_filter;
pub mod save_node;
pub mod save_param;
Expand All @@ -18,7 +20,9 @@ pub mod prelude {
pub use super::environment::*;
pub use super::metadata::*;
pub use super::node::*;
pub use super::node_type::*;
pub use super::param::*;
pub use super::project::*;
pub use super::query_filter::*;
pub use super::save_node::*;
pub use super::save_param::*;
Expand Down
Loading
Loading