Skip to content

Commit

Permalink
Feat: compilation working
Browse files Browse the repository at this point in the history
  • Loading branch information
yas789 committed Jul 4, 2024
1 parent e7dea3c commit 81d9156
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autogpts/SoloAgent/forge/actions/code_gen/code_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re
import subprocess
import json
import test_code

LOG = ForgeLogger(__name__)
CodeType = Dict[str, str]
Expand Down Expand Up @@ -77,6 +78,7 @@ async def test_code(agent: Agent, task_id: str, project_path: str) -> str:
)
async def generate_solana_code(agent: Agent, task_id: str, specification: str) -> str:
global ERROR_INFO
test_code.cargo_test_agbenchmark_config()


prompt_engine = PromptEngine("gpt-4o")
Expand Down Expand Up @@ -126,11 +128,11 @@ async def generate_solana_code(agent: Agent, task_id: str, specification: str) -
LOG.info(f"Parts: {response_content}")

file_actions = [
('src/lib.rs', parts['anchor-lib.rs']),
('src/instructions.rs', parts['anchor-instructions.rs']),
('src/errors.rs', parts['errors.rs']),
('Cargo.toml', ARGO_TOML_CONTENT),
('Anchor.toml', parts['Anchor.toml']),
('src/errors.rs', parts['errors.rs']),
('src/instructions.rs', parts['anchor-instructions.rs']),
('src/lib.rs', parts['anchor-lib.rs']),
]

for file_path, file_content in file_actions:
Expand Down
12 changes: 12 additions & 0 deletions autogpts/SoloAgent/forge/actions/code_gen/test_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import subprocess

def cargo_test_agbenchmark_config(project_path: str):
try:
print (project_path)
subprocess.run(["cargo", "test"], cwd=project_path, check=True)
except FileNotFoundError:
print("Cargo not found. Make sure it is installed.")
except Exception as e:
print(f"An error occurred: {e}")
project_path = "/Users/yassirmaknaoui/git/Soloagent/SoloAgent/autogpts/SoloAgent/agbenchmark_config/workspace/90606f1a-2b20-44e4-ad7e-0f6273d7aaab"
cargo_test_agbenchmark_config(project_path)

0 comments on commit 81d9156

Please sign in to comment.