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
48 changes: 38 additions & 10 deletions grafi_dev/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -362,17 +362,45 @@
})
);
n.subscribed_expressions.forEach((expr) => {
[expr.topic, expr.left?.topic, expr.right?.topic]
.filter((x) => x)
.forEach((x) => {
elems.push({
data: {
id: `${x.name}->${n.name}`,
source: x.name,
target: n.name,
},
});
// Recursively extract all topics from the expression tree
function extractTopics(expression) {
const topics = [];

if (expression.topic) {
topics.push(expression.topic);
}

if (expression.left) {
if (expression.left.topic) {
topics.push(expression.left.topic);
} else {
// Recursively extract from left expression
topics.push(...extractTopics(expression.left));
}
}

if (expression.right) {
if (expression.right.topic) {
topics.push(expression.right.topic);
} else {
// Recursively extract from right expression
topics.push(...extractTopics(expression.right));
}
}

return topics;
}

const allTopics = extractTopics(expr);
allTopics.forEach((topic) => {
elems.push({
data: {
id: `${topic.name}->${n.name}`,
source: topic.name,
target: n.name,
},
});
});
});
});

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "grafi-dev"
version = "0.0.6"
version = "0.0.7"
description = "Run a grafi Assistant locally with a live workflow graph & trace viewer"
authors = [{ name = "Craig Li", email = "craig@binome.dev" }]
readme = "README.md"
Expand All @@ -30,6 +30,7 @@ grafi_dev = ["frontend/*"]

[dependency-groups]
dev = [
"google-genai>=1.25.0",
"googlesearch-python>=1.3.0",
"pycountry>=24.6.1",
"tavily-python>=0.7.2",
Expand Down
Loading