Skip to content

Commit

Permalink
Merge branch 'feature/diagram-gen'
Browse files Browse the repository at this point in the history
  • Loading branch information
botirk38 committed Jun 24, 2024
2 parents 5320c04 + e698c4e commit 3213b34
Show file tree
Hide file tree
Showing 197 changed files with 67 additions and 22,067 deletions.
59 changes: 59 additions & 0 deletions autogpts/SoloAgent/forge/actions/diagram_gen/diagram_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from __future__ import annotations
from ..registry import action
from forge.sdk import ForgeLogger, PromptEngine
import requests
import os

LOG = ForgeLogger(__name__)
API_KEY = os.getenv("ERASERIO_API_KEY")

@action(
name="gen-diagram-eraserio",
description="Generate a code diagram using eraser.io",
parameters=[
{
"name": "specification",
"description": "Code specification",
"type": "string",
"required": True,
},
{
"name": "code",
"description": "Code generated from the specification",
"type": "string",
"required": False
}
],
output_type="str"
)
async def generate_diagram(agent, task_id: str, specification: str, code: str) -> str:
prompt_engine = PromptEngine("gpt-3.5-turbo")
diagram_prompt = prompt_engine.load_prompt("diagram-prompt", specification=specification, code=code)

url = "https://app.eraser.io/api/render/prompt"

payload = {
"text": diagram_prompt,
"diagramType": "sequence-diagram",
"background": True,
"theme": "light",
"scale": "1",
"returnFile": True
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"Authorization": f"Bearer {API_KEY}"
}

response = requests.post(url, json=payload, headers=headers)

if response.status_code == 200:
result = response.json()
LOG.info(f"Diagram generated successfully: {result['fileUrl']}")
return result['fileUrl']
else:
LOG.error(f"Error generating diagram: {response.text}")
return "Failed to generate diagram."


Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Solana Account Diagram
# Specification:
{{ specification }}

# Code:
{{ code }}

# Based on the specification and the code craft a perfect prompt to feed into the eraser.io API LLM to generate the diagram
16 changes: 0 additions & 16 deletions docs/_javascript/mathjax.js

This file was deleted.

6 changes: 0 additions & 6 deletions docs/_javascript/tablesort.js

This file was deleted.

63 changes: 0 additions & 63 deletions docs/content/AutoGPT/configuration/imagegen 2.md

This file was deleted.

34 changes: 0 additions & 34 deletions docs/content/AutoGPT/configuration/options.md

This file was deleted.

37 changes: 0 additions & 37 deletions docs/content/AutoGPT/configuration/search.md

This file was deleted.

37 changes: 0 additions & 37 deletions docs/content/AutoGPT/configuration/voice.md

This file was deleted.

29 changes: 0 additions & 29 deletions docs/content/AutoGPT/index.md

This file was deleted.

20 changes: 0 additions & 20 deletions docs/content/AutoGPT/plugins 2.md

This file was deleted.

Loading

0 comments on commit 3213b34

Please sign in to comment.