Fix for now

This commit is contained in:
vasilije 2025-01-16 21:36:25 +01:00
parent bbd51e8c27
commit cb7b2d311e
4 changed files with 12 additions and 6 deletions

View file

@ -200,9 +200,7 @@ async def handle_call_tool(
with open(os.devnull, "w") as fnull:
with redirect_stdout(fnull), redirect_stderr(fnull):
try:
result = await cognee.visualize_graph()
results = retrieved_edges_to_string(result)
results = await cognee.visualize_graph()
return [
types.TextContent(
type="text",

6
cognee-mcp/uv.lock generated
View file

@ -597,6 +597,7 @@ dependencies = [
{ name = "matplotlib" },
{ name = "nest-asyncio" },
{ name = "networkx" },
{ name = "nltk" },
{ name = "numpy" },
{ name = "openai" },
{ name = "pandas" },
@ -646,11 +647,12 @@ requires-dist = [
{ name = "langfuse", specifier = ">=2.32.0,<3.0.0" },
{ name = "langsmith", marker = "extra == 'langchain'", specifier = "==0.2.3" },
{ name = "litellm", specifier = "==1.57.2" },
{ name = "llama-index-core", marker = "extra == 'llama-index'", specifier = ">=0.12.10.post1,<0.13.0" },
{ name = "llama-index-core", marker = "extra == 'llama-index'", specifier = ">=0.12.11,<0.13.0" },
{ name = "matplotlib", specifier = ">=3.8.3,<4.0.0" },
{ name = "neo4j", marker = "extra == 'neo4j'", specifier = ">=5.20.0,<6.0.0" },
{ name = "nest-asyncio", specifier = "==1.6.0" },
{ name = "networkx", specifier = ">=3.2.1,<4.0.0" },
{ name = "nltk", specifier = "==3.9.1" },
{ name = "numpy", specifier = "==1.26.4" },
{ name = "openai", specifier = "==1.59.4" },
{ name = "pandas", specifier = "==2.2.3" },
@ -672,7 +674,7 @@ requires-dist = [
{ name = "tiktoken", specifier = "==0.7.0" },
{ name = "transformers", specifier = ">=4.46.3,<5.0.0" },
{ name = "typing-extensions", specifier = "==4.12.2" },
{ name = "unstructured", extras = ["csv", "doc", "docx", "epub", "md", "odt", "org", "ppt", "pptx", "rst", "rtf", "tsv", "xlsx"], marker = "extra == 'docs'", specifier = ">=0.16.10,<0.17.0" },
{ name = "unstructured", extras = ["csv", "doc", "docx", "epub", "md", "odt", "org", "ppt", "pptx", "rst", "rtf", "tsv", "xlsx"], marker = "extra == 'docs'", specifier = ">=0.16.13,<0.17.0" },
{ name = "uvicorn", specifier = "==0.22.0" },
{ name = "weaviate-client", marker = "extra == 'weaviate'", specifier = "==4.9.6" },
]

View file

@ -10,5 +10,6 @@ async def visualize_graph(label: str = "name"):
logging.info(graph_data)
graph = await create_cognee_style_network_with_logo(graph_data, label=label)
logging.info("The HTML file has been stored on your home directory! Navigate there with cd ~")
return graph

View file

@ -444,7 +444,12 @@ async def create_cognee_style_network_with_logo(
logging.info(f"Saving visualization to {output_filename}...")
html_content = file_html(p, CDN, title)
with open(output_filename, "w") as f:
home_dir = os.path.expanduser('~')
# Construct the final output file path
output_filepath = os.path.join(home_dir, output_filename)
with open(output_filepath, "w") as f:
f.write(html_content)
return html_content