Compare commits
8 Commits
main
...
sweep/back
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5bfaa0806 | ||
|
|
671efdeacf | ||
|
|
2339fa5af5 | ||
|
|
47267aefb1 | ||
|
|
2a6fc2874f | ||
|
|
746ccc29a0 | ||
|
|
9bac4a0cd8 | ||
|
|
8a17e5077c |
@ -17,6 +17,8 @@ from prompts import assemble_prompt
|
||||
from routes import screenshot
|
||||
from access_token import validate_access_token
|
||||
|
||||
from server_status import status_router
|
||||
|
||||
app = FastAPI(openapi_url=None, docs_url=None, redoc_url=None)
|
||||
|
||||
# Configure CORS
|
||||
@ -38,6 +40,7 @@ SHOULD_MOCK_AI_RESPONSE = bool(os.environ.get("MOCK", False))
|
||||
|
||||
|
||||
app.include_router(screenshot.router)
|
||||
app.include_router(status_router, prefix='/status')
|
||||
|
||||
|
||||
def write_logs(prompt_messages, completion):
|
||||
|
||||
7
backend/server.js
Normal file
7
backend/server.js
Normal file
@ -0,0 +1,7 @@
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.get('/', (req, res) => res.send('Your backend server is running correctly'));
|
||||
|
||||
app.listen(5000, () => console.log('Server is running on port 5000'));
|
||||
9
backend/server_status.py
Normal file
9
backend/server_status.py
Normal file
@ -0,0 +1,9 @@
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/status")
|
||||
async def get_status():
|
||||
message = "Your backend server is running correctly"
|
||||
return JSONResponse(content={"message": message})
|
||||
@ -1,4 +1,4 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
import ImageUpload from "./components/ImageUpload";
|
||||
import CodePreview from "./components/CodePreview";
|
||||
import Preview from "./components/Preview";
|
||||
@ -77,6 +77,14 @@ function App() {
|
||||
const png = canvas.toDataURL("image/png");
|
||||
return png;
|
||||
};
|
||||
const [message, setMessage] = useState('');
|
||||
const [error, setError] = useState(null);
|
||||
useEffect(() => {
|
||||
fetch('http://localhost:5000/status')
|
||||
.then(response => response.json())
|
||||
.then(data => setMessage(data.message))
|
||||
.catch(error => setError(error.toString()));
|
||||
}, []);
|
||||
|
||||
const downloadCode = () => {
|
||||
// Create a blob from the generated code
|
||||
@ -115,7 +123,6 @@ function App() {
|
||||
|
||||
// Merge settings with params
|
||||
const updatedParams = { ...params, ...settings, outputSettings };
|
||||
|
||||
generateCode(
|
||||
wsRef,
|
||||
updatedParams,
|
||||
@ -201,6 +208,12 @@ function App() {
|
||||
)}
|
||||
|
||||
{(appState === AppState.CODING ||
|
||||
<div className="flex items-center justify-between mt-10 mb-2">
|
||||
<h1 className="text-2xl ">Screenshot to Code</h1>
|
||||
{message && <p>{message}</p>}
|
||||
{error && <p>Error: {error}</p>}
|
||||
<SettingsDialog settings={settings} setSettings={setSettings} />
|
||||
</div>
|
||||
appState === AppState.CODE_READY) && (
|
||||
<>
|
||||
{/* Show code preview only when coding */}
|
||||
@ -221,7 +234,6 @@ function App() {
|
||||
<CodePreview code={generatedCode} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{appState === AppState.CODE_READY && (
|
||||
<div>
|
||||
<div className="grid w-full gap-2">
|
||||
|
||||
42
sweep.yaml
42
sweep.yaml
@ -1,42 +0,0 @@
|
||||
# Sweep AI turns bugs & feature requests into code changes (https://sweep.dev)
|
||||
# For details on our config file, check out our docs at https://docs.sweep.dev/usage/config
|
||||
|
||||
# This setting contains a list of rules that Sweep will check for. If any of these rules are broken in a new commit, Sweep will create an pull request to fix the broken rule.
|
||||
rules:
|
||||
- "All docstrings and comments should be up to date."
|
||||
['All new business logic should have corresponding unit tests.', 'Refactor large functions to be more modular.', 'Add docstrings to all functions and file headers.']
|
||||
|
||||
# This is the branch that Sweep will develop from and make pull requests to. Most people use 'main' or 'master' but some users also use 'dev' or 'staging'.
|
||||
branch: 'main'
|
||||
|
||||
# By default Sweep will read the logs and outputs from your existing Github Actions. To disable this, set this to false.
|
||||
gha_enabled: True
|
||||
|
||||
# This is the description of your project. It will be used by sweep when creating PRs. You can tell Sweep what's unique about your project, what frameworks you use, or anything else you want.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# description: sweepai/sweep is a python project. The main api endpoints are in sweepai/api.py. Write code that adheres to PEP8.
|
||||
description: ''
|
||||
|
||||
# This sets whether to create pull requests as drafts. If this is set to True, then all pull requests will be created as drafts and GitHub Actions will not be triggered.
|
||||
draft: False
|
||||
|
||||
# This is a list of directories that Sweep will not be able to edit.
|
||||
blocked_dirs: []
|
||||
|
||||
# This is a list of documentation links that Sweep will use to help it understand your code. You can add links to documentation for any packages you use here.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# docs:
|
||||
# - PyGitHub: ["https://pygithub.readthedocs.io/en/latest/", "We use pygithub to interact with the GitHub API"]
|
||||
docs: []
|
||||
|
||||
# Sandbox executes commands in a sandboxed environment to validate code changes after every edit to guarantee pristine code. For more details, see the [Sandbox](./sandbox) page.
|
||||
sandbox:
|
||||
install:
|
||||
- trunk init
|
||||
check:
|
||||
- trunk fmt {file_path} || return 0
|
||||
- trunk check --fix --print-failures {file_path}
|
||||
Loading…
Reference in New Issue
Block a user