sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.

Home Page:https://sweep.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sweep: rename user-facing text containing "Discourse" to "community forum"

kevinlu1248 opened this issue Β· comments

Checklist
  • sweep_chat/components/ui/switch.tsx
  • sweep_chat/backend/api.py
Sweeping

25%


Actions (click)

  • ↻ Restart Sweep

❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred due to a planning failure. The error message is 422 {"message": "Invalid tree info", "documentation_url": "https://docs.github.com/rest/git/trees#create-a-tree"}. Feel free to add more details to the issue description so Sweep can better address it. Alternatively, reach out to Kevin or William for help at https://community.sweep.dev/.

For bonus GPT-4 tickets, please report this bug on Discourse (tracking ID: fdb08e6133).


Please look at the generated plan. If something looks wrong, please add more details to your issue.

File Path Proposed Changes
sweep_chat/components/ui/switch.tsx Modify sweep_chat/components/ui/switch.tsx with contents:
Instructions: Search this file for any user-facing text containing "Discourse" and replace it with "community forum".

<original_code>
"use client"

import * as React from "react"
import * as SwitchPrimitives from "@radix-ui/react-switch"

import { cn } from "@/lib/utils"

const Switch = React.forwardRef<
React.ElementRef,
React.ComponentPropsWithoutRef
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
className
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
)}
/>
</SwitchPrimitives.Root>
))
Switch.displayName = SwitchPrimitives.Root.displayName

export { Switch }
</original_code>

<new_code>
"use client"

import * as React from "react"
import * as SwitchPrimitives from "@radix-ui/react-switch"

import { cn } from "@/lib/utils"

const Switch = React.forwardRef<
React.ElementRef,
React.ComponentPropsWithoutRef
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
className
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
)}
/>
</SwitchPrimitives.Root>
))
Switch.displayName = SwitchPrimitives.Root.displayName

export { Switch }
</new_code>
sweep_chat/backend/api.py Modify sweep_chat/backend/api.py with contents:
Instructions: Search this file for any user-facing text containing "Discourse" and replace it with "community forum".

<original_code>
import json
import os
from fastapi import Body, FastAPI
from fastapi.responses import StreamingResponse
import git

from sweepai.agents.modify_utils import validate_and_parse_function_call
from sweepai.agents.search_agent import extract_xml_tag
from sweepai.core.chat import ChatGPT
from sweepai.core.entities import Message, Snippet
from sweepai.utils.convert_openai_anthropic import AnthropicFunctionCall
from sweepai.utils.github_utils import ClonedRepo, MockClonedRepo
from sweepai.utils.ticket_utils import prep_snippets

app = FastAPI()

@app.get("/repo")
def check_repo_exists(repo_name: str):
org_name, repo = repo_name.split("/")
if os.path.exists(f"/tmp/{repo}"):
return {"success": True}
try:
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
return {"success": True}
except Exception as e:
return {"success": False, "error": str(e)}

def search_codebase(
repo_name: str,
query: str
):
org_name, repo = repo_name.split("/")
if not os.path.exists(f"/tmp/{repo}"):
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
cloned_repo = MockClonedRepo(f"/tmp/{repo}", repo_name)
repo_context_manager = prep_snippets(cloned_repo, query, use_multi_query=False, NUM_SNIPPETS_TO_KEEP=0)
return repo_context_manager.current_top_snippets

@app.get("/search")
def search_codebase_endpoint(
repo_name: str,
query: str
):
return [snippet.model_dump() for snippet in search_codebase(repo_name, query)]

example_tool_calls = """Here is an illustrative example of how to use the tools:

To ask questions about the codebase:
<function_call>

<tool_name>search_codebase</tool_name>


How do we the user-provided password hash against the stored hash from the database in the user-authentication service?



</function_call>

Notice that the query parameter is a single, extremely detailed, specific natural language search question.

Here are other examples of good questions to ask:

How are GraphQL mutations constructed for updating a user's profile information, and what specific fields are being updated?
How do the current React components render the product carousel on the homepage, and what library is being used for the carousel functionality?
How do we currently implement the endpoint handler for processing incoming webhook events from Stripe in the backend API, and how are the events being validated and parsed?
What is the structure of the Post model in the blog module?

The above are just illustrative examples. Make sure to provide detailed, specific questions to search for relevant snippets in the codebase and only make one function call."""

</original_code>

<new_code>
import json
import os
from fastapi import Body, FastAPI
from fastapi.responses import StreamingResponse
import git

from sweepai.agents.modify_utils import validate_and_parse_function_call
from sweepai.agents.search_agent import extract_xml_tag
from sweepai.core.chat import ChatGPT
from sweepai.core.entities import Message, Snippet
from sweepai.utils.convert_openai_anthropic import AnthropicFunctionCall
from sweepai.utils.github_utils import ClonedRepo, MockClonedRepo
from sweepai.utils.ticket_utils import prep_snippets

app = FastAPI()

@app.get("/repo")
def check_repo_exists(repo_name: str):
org_name, repo = repo_name.split("/")
if os.path.exists(f"/tmp/{repo}"):
return {"success": True}
try:
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
return {"success": True}
except Exception as e:
return {"success": False, "error": str(e)}

def search_codebase(
repo_name: str,
query: str
):
org_name, repo = repo_name.split("/")
if not os.path.exists(f"/tmp/{repo}"):
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
cloned_repo = MockClonedRepo(f"/tmp/{repo}", repo_name)
repo_context_manager = prep_snippets(cloned_repo, query, use_multi_query=False, NUM_SNIPPETS_TO_KEEP=0)
return repo_context_manager.current_top_snippets

@app.get("/search")
def search_codebase_endpoint(
repo_name: str,
query: str
):
return [snippet.model_dump() for snippet in search_codebase(repo_name, query)]

example_tool_calls = """Here is an illustrative example of how to use the tools:

To ask questions about the codebase:
<function_call>

<tool_name>search_codebase</tool_name>


How do we the user-provided password hash against the stored hash from the database in the user-authentication service?



</function_call>

Notice that the query parameter is a single, extremely detailed, specific natural language search question.

Here are other examples of good questions to ask:

How are GraphQL mutations constructed for updating a user's profile information, and what specific fields are being updated?
How do the current React components render the product carousel on the homepage, and what library is being used for the carousel functionality?
How do we currently implement the endpoint handler for processing incoming webhook events from Stripe in the backend API, and how are the events being validated and parsed?
What is the structure of the Post model in the blog module?

The above are just illustrative examples. Make sure to provide detailed, specific questions to search for relevant snippets in the codebase and only make one function call."""

</new_code>

πŸŽ‰ Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

πŸ’‘ To recreate the pull request edit the issue title or description.

This is an automated message generated by Sweep AI.

Sweeping

25%


Actions (click)

  • ↻ Restart Sweep

❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred due to a planning failure. The error message is 422 {"message": "Invalid tree info", "documentation_url": "https://docs.github.com/rest/git/trees#create-a-tree"}. Feel free to add more details to the issue description so Sweep can better address it. Alternatively, reach out to Kevin or William for help at https://community.sweep.dev/.

For bonus GPT-4 tickets, please report this bug on Discourse (tracking ID: 2b819aa413).


Please look at the generated plan. If something looks wrong, please add more details to your issue.

File Path Proposed Changes
sweep_chat/components/ui/switch.tsx Modify sweep_chat/components/ui/switch.tsx with contents:
Instructions: Search this file for any user-facing text containing "Discourse" and replace it with "community forum".

<original_code>
"use client"

import * as React from "react"
import * as SwitchPrimitives from "@radix-ui/react-switch"

import { cn } from "@/lib/utils"

const Switch = React.forwardRef<
React.ElementRef,
React.ComponentPropsWithoutRef
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
className
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
)}
/>
</SwitchPrimitives.Root>
))
Switch.displayName = SwitchPrimitives.Root.displayName

export { Switch }
</original_code>

<new_code>
"use client"

import * as React from "react"
import * as SwitchPrimitives from "@radix-ui/react-switch"

import { cn } from "@/lib/utils"

const Switch = React.forwardRef<
React.ElementRef,
React.ComponentPropsWithoutRef
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
className
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
)}
/>
</SwitchPrimitives.Root>
))
Switch.displayName = SwitchPrimitives.Root.displayName

export { Switch }
</new_code>
sweep_chat/backend/api.py Modify sweep_chat/backend/api.py with contents:
Instructions: Search this file for any user-facing text containing "Discourse" and replace it with "community forum".

<original_code>
import json
import os
from fastapi import Body, FastAPI
from fastapi.responses import StreamingResponse
import git

from sweepai.agents.modify_utils import validate_and_parse_function_call
from sweepai.agents.search_agent import extract_xml_tag
from sweepai.core.chat import ChatGPT
from sweepai.core.entities import Message, Snippet
from sweepai.utils.convert_openai_anthropic import AnthropicFunctionCall
from sweepai.utils.github_utils import ClonedRepo, MockClonedRepo
from sweepai.utils.ticket_utils import prep_snippets

app = FastAPI()

@app.get("/repo")
def check_repo_exists(repo_name: str):
org_name, repo = repo_name.split("/")
if os.path.exists(f"/tmp/{repo}"):
return {"success": True}
try:
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
return {"success": True}
except Exception as e:
return {"success": False, "error": str(e)}

def search_codebase(
repo_name: str,
query: str
):
org_name, repo = repo_name.split("/")
if not os.path.exists(f"/tmp/{repo}"):
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
cloned_repo = MockClonedRepo(f"/tmp/{repo}", repo_name)
repo_context_manager = prep_snippets(cloned_repo, query, use_multi_query=False, NUM_SNIPPETS_TO_KEEP=0)
return repo_context_manager.current_top_snippets

@app.get("/search")
def search_codebase_endpoint(
repo_name: str,
query: str
):
return [snippet.model_dump() for snippet in search_codebase(repo_name, query)]

example_tool_calls = """Here is an illustrative example of how to use the tools:

To ask questions about the codebase:
<function_call>

<tool_name>search_codebase</tool_name>


How do we the user-provided password hash against the stored hash from the database in the user-authentication service?



</function_call>

Notice that the query parameter is a single, extremely detailed, specific natural language search question.

Here are other examples of good questions to ask:

How are GraphQL mutations constructed for updating a user's profile information, and what specific fields are being updated?
How do the current React components render the product carousel on the homepage, and what library is being used for the carousel functionality?
How do we currently implement the endpoint handler for processing incoming webhook events from Stripe in the backend API, and how are the events being validated and parsed?
What is the structure of the Post model in the blog module?

The above are just illustrative examples. Make sure to provide detailed, specific questions to search for relevant snippets in the codebase and only make one function call."""

</original_code>

<new_code>
import json
import os
from fastapi import Body, FastAPI
from fastapi.responses import StreamingResponse
import git

from sweepai.agents.modify_utils import validate_and_parse_function_call
from sweepai.agents.search_agent import extract_xml_tag
from sweepai.core.chat import ChatGPT
from sweepai.core.entities import Message, Snippet
from sweepai.utils.convert_openai_anthropic import AnthropicFunctionCall
from sweepai.utils.github_utils import ClonedRepo, MockClonedRepo
from sweepai.utils.ticket_utils import prep_snippets

app = FastAPI()

@app.get("/repo")
def check_repo_exists(repo_name: str):
org_name, repo = repo_name.split("/")
if os.path.exists(f"/tmp/{repo}"):
return {"success": True}
try:
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
return {"success": True}
except Exception as e:
return {"success": False, "error": str(e)}

def search_codebase(
repo_name: str,
query: str
):
org_name, repo = repo_name.split("/")
if not os.path.exists(f"/tmp/{repo}"):
git.clone(f"https://github.com/{repo_name}", f"/tmp/{repo}")
cloned_repo = MockClonedRepo(f"/tmp/{repo}", repo_name)
repo_context_manager = prep_snippets(cloned_repo, query, use_multi_query=False, NUM_SNIPPETS_TO_KEEP=0)
return repo_context_manager.current_top_snippets

@app.get("/search")
def search_codebase_endpoint(
repo_name: str,
query: str
):
return [snippet.model_dump() for snippet in search_codebase(repo_name, query)]

example_tool_calls = """Here is an illustrative example of how to use the tools:

To ask questions about the codebase:
<function_call>

<tool_name>search_codebase</tool_name>


How do we the user-provided password hash against the stored hash from the database in the user-authentication service?



</function_call>

Notice that the query parameter is a single, extremely detailed, specific natural language search question.

Here are other examples of good questions to ask:

How are GraphQL mutations constructed for updating a user's profile information, and what specific fields are being updated?
How do the current React components render the product carousel on the homepage, and what library is being used for the carousel functionality?
How do we currently implement the endpoint handler for processing incoming webhook events from Stripe in the backend API, and how are the events being validated and parsed?
What is the structure of the Post model in the blog module?

The above are just illustrative examples. Make sure to provide detailed, specific questions to search for relevant snippets in the codebase and only make one function call."""

</new_code>

πŸŽ‰ Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

πŸ’‘ To recreate the pull request edit the issue title or description.

This is an automated message generated by Sweep AI.