Skip to content

Codegen frontend fix #1023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 104 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
a0d2f02
agentgen
Zeeeepa Apr 4, 2025
796da0c
pr_review
Zeeeepa Apr 4, 2025
5c9aa68
Create README.md
Zeeeepa Apr 4, 2025
f40d51c
Update README.md
Zeeeepa Apr 4, 2025
e1545fb
Update agentgen to use current langchain libraries
codegen-sh[bot] Apr 4, 2025
7989cd0
Update PR review bot to use latest langchain libraries and implement …
codegen-sh[bot] Apr 4, 2025
2f2ed68
Delete agentgen/extensions/events/modal directory
Zeeeepa Apr 4, 2025
4dd6821
Delete agentgen/extensions/events/linear.py
Zeeeepa Apr 4, 2025
10c94b4
Update tools.py
Zeeeepa Apr 4, 2025
003285e
Create .windsurfrules
Zeeeepa Apr 4, 2025
4e3577a
Update PR review bot to use latest langchain libraries and remove Mod…
codegen-sh[bot] Apr 4, 2025
bf71ef1
Add files via upload
Zeeeepa Apr 4, 2025
48b6c9c
Add files via upload
Zeeeepa Apr 4, 2025
10affcb
Update PR review bot with enhanced functionality and remove Modal/Lin…
codegen-sh[bot] Apr 4, 2025
acea6bf
Add launch script, update README, and remove Modal/Linear dependencies
codegen-sh[bot] Apr 4, 2025
3c6de35
Update agentgen to use latest langchain libraries and fix PR review bot
codegen-sh[bot] Apr 4, 2025
1810a82
Update agentgen to use latest langchain libraries and fix PR review bot
codegen-sh[bot] Apr 4, 2025
5f66567
Fix PR review bot to work without package installation
codegen-sh[bot] Apr 4, 2025
24abc2b
Fix PR review bot to work without package installation
codegen-sh[bot] Apr 4, 2025
3fb92ce
Fix PR review bot import issues and improve setup process
codegen-sh[bot] Apr 4, 2025
5698ebf
Fix PR review bot setup issues and improve documentation
codegen-sh[bot] Apr 4, 2025
83a50b7
Fix PR review bot imports and dependencies
codegen-sh[bot] Apr 4, 2025
8d968c2
Fix PR Review Bot dotenv import and run.py arguments
codegen-sh[bot] Apr 4, 2025
10d7401
Fix webhook_manager.py to include required 'name' parameter in hook.e…
codegen-sh[bot] Apr 4, 2025
a1cbcf6
Fix IP change monitoring and add get_public_url method to NgrokManager
codegen-sh[bot] Apr 4, 2025
abedca5
Update PR review bot to check all PRs and add merge functionality
codegen-sh[bot] Apr 4, 2025
f6d004c
Fix PR review bot to check all PRs and handle merging with user confi…
codegen-sh[bot] Apr 4, 2025
6ff9f09
Fix webhook validation issues and update PR review bot
codegen-sh[bot] Apr 4, 2025
94bbc30
Add files via upload
Zeeeepa Apr 4, 2025
73b34a1
Reorganize agentgen folder structure and update import paths
codegen-sh[bot] Apr 4, 2025
f67e3e2
Merge pull request #1 from Zeeeepa/codegen-reorganize-agentgen-folder
Zeeeepa Apr 4, 2025
bce8012
agentic
Zeeeepa Apr 4, 2025
14505fa
rv
Zeeeepa Apr 4, 2025
773723a
Reorganize Codegen Applications and Add Requirements Tracker
codegen-sh[bot] Apr 4, 2025
4567758
Remove duplicated folders from agentgen root
codegen-sh[bot] Apr 4, 2025
27e572f
Delete agentgen/applications/pr_review_bot directory
Zeeeepa Apr 4, 2025
fb9c46a
Delete agentgen/applications/slack_chatbot directory
Zeeeepa Apr 4, 2025
7cba4fd
Delete agentgen/applications/visualize_codebases directory
Zeeeepa Apr 4, 2025
2e118cb
Delete agentgen/applications/snapshot_event_handler directory
Zeeeepa Apr 4, 2025
e391941
Delete agentgen/applications/deep_code_research directory
Zeeeepa Apr 4, 2025
5107561
Delete agentgen/applications/swebench_agent_run directory
Zeeeepa Apr 4, 2025
c008f20
Delete agentgen/applications/repo_analytics directory
Zeeeepa Apr 4, 2025
fff5a75
Implement Phase 1: Integrated PR Agent
codegen-sh[bot] Apr 4, 2025
bf6e737
Merge pull request #2 from Zeeeepa/codegen-integrated-pr-agent
Zeeeepa Apr 4, 2025
c2d42ca
Implement Phase 2: Web UI for Integrated Agent
codegen-sh[bot] Apr 4, 2025
bf2dd5f
Merge pull request #3 from Zeeeepa/gen/26ac44d3-2a51-4b5a-8629-8a0305…
Zeeeepa Apr 4, 2025
55ce187
Implement Phase 3: Slack Integration for Integrated Agent
codegen-sh[bot] Apr 4, 2025
07f26cb
Merge pull request #4 from Zeeeepa/codegen-phase3-slack-integration
Zeeeepa Apr 4, 2025
6ac326d
Implement Phase 4: AI Planning Features
codegen-sh[bot] Apr 4, 2025
62f8456
Merge pull request #5 from Zeeeepa/codegen-ai-planning-features
Zeeeepa Apr 4, 2025
dd34a87
Delete agentgen/applications/langchain_agent directory
Zeeeepa Apr 4, 2025
cbd552d
Delete agentgen/applications/ticket-to-pr directory
Zeeeepa Apr 4, 2025
c3a0878
Delete agentgen/applications/linear_webhooks/webhooks.py
Zeeeepa Apr 4, 2025
7d58bde
Delete agentgen/applications/linear_webhooks directory
Zeeeepa Apr 4, 2025
84e4815
Delete agentgen/applications/codegen_app directory
Zeeeepa Apr 4, 2025
56794ef
Implement Unified Agent Application
codegen-sh[bot] Apr 4, 2025
a70588d
Merge pull request #6 from Zeeeepa/codegen-unified-agent-implementation
Zeeeepa Apr 4, 2025
8e9388b
Add UI for Unified Agent with Workflow Visualization
codegen-sh[bot] Apr 4, 2025
687409c
Merge pull request #7 from Zeeeepa/gen/60741089-30f4-42da-a4a8-60e2aa…
Zeeeepa Apr 4, 2025
f1e11a9
Add PR Code Review Agent with Slack Integration
codegen-sh[bot] Apr 5, 2025
7168310
Merge pull request #8 from Zeeeepa/gen/fa3cab0c-6f38-4b57-8090-c14329…
Zeeeepa Apr 5, 2025
6751437
Implement PR Code Review Agent with Planning and Research Features
codegen-sh[bot] Apr 5, 2025
3775c4d
Merge pull request #9 from Zeeeepa/gen/e17715ff-7ec4-4035-8653-413be4…
Zeeeepa Apr 5, 2025
faf542b
Implement Enhanced PR Code Review Agent with Planning and Research Ca…
codegen-sh[bot] Apr 5, 2025
6060de6
Merge pull request #10 from Zeeeepa/pr-review-agent-enhancement
Zeeeepa Apr 5, 2025
9dd7c3f
Add project_plan_manager from master branch
PixePerfa Apr 5, 2025
5b7e833
Delete agentgen/applications/requirements_tracker directory
Zeeeepa Apr 5, 2025
aa252d9
Delete agentgen/applications/unified_agent directory
Zeeeepa Apr 5, 2025
a7457f8
Delete agentgen/applications/integrated_pr_agent directory
Zeeeepa Apr 5, 2025
ccd7f91
Delete agentgen/applications/integrated_agent directory
Zeeeepa Apr 5, 2025
f1c8a71
Rename agentgen/backend folder to agentgen
PixePerfa Apr 5, 2025
1363ee4
Merge branch 'develop' of https://github.com/Zeeeepa/codegen into dev…
PixePerfa Apr 5, 2025
37d00d5
Resolve merge conflicts
PixePerfa Apr 5, 2025
1606719
Your commit message
PixePerfa Apr 5, 2025
cb52a67
Implement PR Code Review Agent with Planning and Research Features
codegen-sh[bot] Apr 5, 2025
7269206
Merge pull request #11 from Zeeeepa/codegen-pr-review-agent-enhancement
Zeeeepa Apr 5, 2025
9bf5cb6
Add PR Review Bot with Ngrok Support
codegen-sh[bot] Apr 5, 2025
b6133bd
Merge pull request #12 from Zeeeepa/codegen-pr-review-bot-ngrok
Zeeeepa Apr 5, 2025
107d831
Implement PR Code Review Agent with Reflection Capabilities
codegen-sh[bot] Apr 5, 2025
b0be68a
Merge branch 'develop' of https://github.com/Zeeeepa/codegen into cod…
codegen-sh[bot] Apr 5, 2025
e0ca49a
Merge pull request #13 from Zeeeepa/codegen-pr-review-reflection-agent
Zeeeepa Apr 5, 2025
9b564dd
Fix PR Review Bot import error for CodeAgent
codegen-sh[bot] Apr 5, 2025
5607635
Fix PR Review Bot import error for CodeAgent
codegen-sh[bot] Apr 5, 2025
1646a71
Merge pull request #14 from Zeeeepa/codegen-fix-pr-review-bot-import
Zeeeepa Apr 5, 2025
a77d1b5
Merge branch 'develop' of https://github.com/Zeeeepa/codegen into cod…
codegen-sh[bot] Apr 5, 2025
4955411
Update imports from codegen to agentgen
codegen-sh[bot] Apr 5, 2025
ea53333
Merge pull request #15 from Zeeeepa/codegen-fix-pr-review-bot-import-2
Zeeeepa Apr 5, 2025
19218e5
Merge pull request #16 from Zeeeepa/gen/c88d112a-f1bc-40a2-a44f-d4e0c…
Zeeeepa Apr 5, 2025
a5f0a30
Update README.md
Zeeeepa Apr 5, 2025
107be18
Update README.md
Zeeeepa Apr 5, 2025
aba9282
Integrate Enhanced PR Review Agent into Project Plan Manager
codegen-sh[bot] Apr 5, 2025
652cc7e
Merge branch 'develop' of https://github.com/Zeeeepa/codegen into cod…
codegen-sh[bot] Apr 5, 2025
6bba0eb
Merge pull request #17 from Zeeeepa/codegen-pr-review-agent-integrati…
Zeeeepa Apr 5, 2025
d8b0ec1
Update README.md
Zeeeepa Apr 5, 2025
2e63ed0
Add extensive logging to PR review agent for webhook debugging
codegen-sh[bot] Apr 5, 2025
b793680
Merge pull request #18 from Zeeeepa/codegen-enhance-pr-review-agent-l…
Zeeeepa Apr 5, 2025
5f951a1
Update README.md
Zeeeepa Apr 5, 2025
5444a61
Update Project Plan Manager README with completed tasks and implement…
codegen-sh[bot] Apr 5, 2025
7947af5
Merge PR Reviewers into Project Plan Manager
codegen-sh[bot] Apr 5, 2025
6b91293
Merge pull request #19 from Zeeeepa/codegen-readme-update-20250405
Zeeeepa Apr 5, 2025
b8b3d01
Merge pull request #20 from Zeeeepa/gen/e30b30ce-5b82-40ba-9a88-0b989…
Zeeeepa Apr 5, 2025
695327e
Add Codegen Integration to Project Plan Manager
codegen-sh[bot] Apr 5, 2025
bdb86b6
Merge pull request #21 from Zeeeepa/codegen-integration-feature
Zeeeepa Apr 5, 2025
5b584d9
Add missing public directory and files for React frontend
codegen-sh[bot] Apr 5, 2025
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
6 changes: 6 additions & 0 deletions .windsurfrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
You should also use the `scratchpad.md` file as a scratchpad to organize your thoughts. Especially when you receive a new task, you should first review the content of the scratchpad, clear old different task if necessary, first explain the task, and plan the steps you need to take to complete the task. You can use todo markers to indicate the progress, e.g.
[X] Task 1
[ ] Task 2
Also update the progress of the task in the Scratchpad when you finish a subtask.
Especially when you finished a milestone, it will help to improve your depth of task accomplishment to use the scratchpad to reflect and plan.
The goal is to help you maintain a big picture as well as the progress of the task. Always refer to the Scratchpad when you plan the next step.
74 changes: 74 additions & 0 deletions agentgen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Codegen Deep Research

A code research tool that enables users to understand codebases through agentic AI analysis. The project combines a Modal-based FastAPI backend with a Next.js frontend to provide intelligent code exploration capabilities.

Users submit a GitHub repository and research query through the frontend. The Modal API processes the request using an AI agent equipped with specialized code analysis tools. The agent explores the codebase using various tools (search, symbol analysis, etc.) and results are returned to the frontend for display.

## How it Works

### Backend (Modal API)

The backend is built using [Modal](https://modal.com/) and [FastAPI](https://fastapi.tiangolo.com/), providing a serverless API endpoint for code research.

There is a main API endpoint that handles code research requests. It uses the `codegen` library for codebase analysis.

The agent investigates the codebase through various research tools:
- `ViewFileTool`: Read file contents
- `ListDirectoryTool`: Explore directory structures
- `SearchTool`: Text-based code search
- `SemanticSearchTool`: AI-powered semantic code search
- `RevealSymbolTool`: Analyze code symbols and relationships

```python
tools = [
ViewFileTool(codebase),
ListDirectoryTool(codebase),
SearchTool(codebase),
SemanticSearchTool(codebase),
RevealSymbolTool(codebase)
]

# Initialize agent with research tools
agent = create_agent_with_tools(
codebase=codebase,
tools=tools,
chat_history=[SystemMessage(content=RESEARCH_AGENT_PROMPT)],
verbose=True
)
```

### Frontend (Next.js)

The frontend provides an interface for users to submit a GitHub repository and research query. The components come from the [shadcn/ui](https://ui.shadcn.com/) library. This triggers the Modal API to perform the code research and returns the results to the frontend.

## Getting Started

1. Set up environment variables in an `.env` file:
```
OPENAI_API_KEY=your_key_here
```

2. Deploy or serve the Modal API:
```bash
modal serve backend/api.py
```
`modal serve` runs the API locally for development, creating a temporary endpoint that's active only while the command is running.
```bash
modal deploy backend/api.py
```
`modal deploy` creates a persistent Modal app and deploys the FastAPI app to it, generating a permanent API endpoint.

After deployment, you'll need to update the API endpoint in the frontend configuration to point to your deployed Modal app URL.

3. Run the Next.js frontend:
```bash
cd frontend
npm install
npm run dev
```

## Learn More

More information about the `codegen` library can be found [here](https://codegen.com/).

For details on the agent implementation, check out [Deep Code Research with AI](https://docs.codegen.com/tutorials/deep-code-research) from the Codegen docs. This tutorial provides an in-depth guide on how the research agent is created.
7 changes: 7 additions & 0 deletions agentgen/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
AgentGen - Agent framework for building AI-powered applications.
"""

from agentgen.agents.chat_agent import ChatAgent as CodeAgent

__version__ = "0.1.0"
7 changes: 7 additions & 0 deletions agentgen/agentgen/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
Agentgen package initialization.
"""

from agentgen.agents.code_agent import CodeAgent

__all__ = ["CodeAgent"]
Empty file.
95 changes: 95 additions & 0 deletions agentgen/agentgen/agents/chat_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"""Chat agent implementation."""

from typing import Any, Dict, List, Optional, Union

from langchain_core.messages import AIMessage, BaseMessage, HumanMessage, SystemMessage

from agentgen.backend.extensions.langchain.agent import create_chat_agent

if TYPE_CHECKING:
from codegen import Codebase


class ChatAgent:
"""Agent for interacting with a codebase."""

def __init__(self, codebase: "Codebase", model_provider: str = "anthropic", model_name: str = "claude-3-5-sonnet-latest", memory: bool = True, tools: Optional[list[BaseTool]] = None, **kwargs):
"""Initialize a CodeAgent.

Args:
codebase: The codebase to operate on
model_provider: The model provider to use ("anthropic" or "openai")
model_name: Name of the model to use
memory: Whether to let LLM keep track of the conversation history
tools: Additional tools to use
**kwargs: Additional LLM configuration options. Supported options:
- temperature: Temperature parameter (0-1)
- top_p: Top-p sampling parameter (0-1)
- top_k: Top-k sampling parameter (>= 1)
- max_tokens: Maximum number of tokens to generate
"""
self.codebase = codebase
self.agent = create_chat_agent(self.codebase, model_provider=model_provider, model_name=model_name, memory=memory, additional_tools=tools, **kwargs)

def run(self, prompt: str, thread_id: Optional[str] = None) -> str:
"""Run the agent with a prompt.

Args:
prompt: The prompt to run
thread_id: Optional thread ID for message history. If None, a new thread is created.

Returns:
The agent's response
"""
if thread_id is None:
thread_id = str(uuid4())

input = {"query": prompt}
stream = self.agent.stream(input, config={"configurable": {"thread_id": thread_id}}, stream_mode="values")

for s in stream:
message = s["messages"][-1]
if isinstance(message, tuple):
print(message)
else:
if isinstance(message, AIMessage) and isinstance(message.content, list) and "text" in message.content[0]:
AIMessage(message.content[0]["text"]).pretty_print()
else:
message.pretty_print()

return s["final_answer"]

def chat(self, prompt: str, thread_id: Optional[str] = None) -> tuple[str, str]:
"""Chat with the agent, maintaining conversation history.

Args:
prompt: The user message
thread_id: Optional thread ID for message history. If None, a new thread is created.

Returns:
A tuple of (response_content, thread_id) to allow continued conversation
"""
if thread_id is None:
thread_id = str(uuid4())
print(f"Starting new chat thread: {thread_id}")
else:
print(f"Continuing chat thread: {thread_id}")

response = self.run(prompt, thread_id=thread_id)
return response, thread_id

def get_chat_history(self, thread_id: str) -> list:
"""Retrieve the chat history for a specific thread.

Args:
thread_id: The thread ID to retrieve history for

Returns:
List of messages in the conversation history
"""
# Access the agent's memory to get conversation history
if hasattr(self.agent, "get_state"):
state = self.agent.get_state({"configurable": {"thread_id": thread_id}})
if state and "messages" in state:
return state["messages"]
return []
Loading
Loading