Skip to content

Commit 1ba16cf

Browse files
committed
init(*):Initial commit
0 parents  commit 1ba16cf

File tree

138 files changed

+7807
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+7807
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
nohup.out*
2+
*__pycache__*
3+
*.vscode*
4+
backend/env.yaml
5+
env.yaml
6+
.DS_Store

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# DevOpsGPT: AI-Driven Software Development Automation Solution
2+
3+
<p align="center">
4+
<a href="docs/README_CN.md"><img src="docs/files/%E6%96%87%E6%A1%A3-%E4%B8%AD%E6%96%87%E7%89%88-blue.svg" alt="CN doc"></a>
5+
<a href="README.md"><img src="docs/files/document-English-blue.svg" alt="EN doc"></a>
6+
<a href="http://www.kuafuai.net"><img src="docs/files/%E5%AE%98%E7%BD%91-%E4%BC%81%E4%B8%9A%E7%89%88-purple.svg" alt="EN doc"></a>
7+
<a href="docs/files/WeChat.jpg"><img src="docs/files/WeChat-%E5%BE%AE%E4%BF%A1-green.svg" alt="roadmap"></a>
8+
</p>
9+
10+
### 💡 Get Help - [Q&A](https://github.com/kuafuai/DevOpsGPT/issues)
11+
### 💡 Submit Requests - [Issue](https://github.com/kuafuai/DevOpsGPT/discussions)
12+
### 💡 Technical exchange - service@kuafuai.net
13+
14+
<hr/>
15+
16+
## Introduction
17+
Welcome to the AI Driven Software Development Automation Solution, abbreviated as DevOpsGPT. We combine LLM (Large Language Model) with DevOps tools to convert natural language requirements into functional software. This innovative feature greatly improves development efficiency, shortens development cycles, and reduces communication costs, resulting in higher-quality software delivery.
18+
19+
## Features and Benefits
20+
21+
- Improved development efficiency: No need for tedious requirement document writing and explanations. Users can interact directly with DevOpsGPT to quickly convert requirements into functional software.
22+
- Shortened development cycles: The automated software development process significantly reduces delivery time, accelerating software deployment and iterations.
23+
- Reduced communication costs: By accurately understanding user requirements, DevOpsGPT minimizes the risk of communication errors and misunderstandings, enhancing collaboration efficiency between development and business teams.
24+
- High-quality deliverables: DevOpsGPT generates code and performs validation, ensuring the quality and reliability of the delivered software.
25+
- [Enterprise Edition] Existing project analysis: Through AI, automatic analysis of existing project information, accurate decomposition and development of required tasks on the basis of existing projects.
26+
- [Enterprise Edition] Professional model selection: Support language model services stronger than GPT in the professional field to better complete requirements development tasks, and support private deployment.
27+
- [Enterprise Edition] Support more DevOps platforms: can connect with more DevOps platforms to achieve the development and deployment of the whole process.
28+
29+
## Demo(Click to play video)
30+
31+
[![Demo video](docs/files/demo-adduser-en.jpeg){:height="40%" width="40%"}](https://www.youtube.com/watch?v=IWUPbGrJQOU)
32+
33+
34+
## Workflow
35+
- Clarify requirement documents: Interact with DevOpsGPT to clarify and confirm details in requirement documents.
36+
- Generate interface documentation: DevOpsGPT can generate interface documentation based on the requirements, facilitating interface design and implementation for developers.
37+
- Write pseudocode based on existing projects: Analyze existing projects to generate corresponding pseudocode, providing developers with references and starting points.
38+
- Refine and optimize code functionality: Developers improve and optimize functionality based on the generated code.
39+
- Continuous integration: Utilize DevOps tools for continuous integration to automate code integration and testing.
40+
- Software version release: Deploy software versions to the target environment using DevOpsGPT and DevOps tools.
41+
42+
## Quick Start
43+
44+
1. Clone the latest code or select a released version.
45+
2. Generate the configuration file: Copy `env.yaml.tpl` and rename it to `env.yaml`.
46+
3. Modify the configuration file: Edit `env.yaml` and add the necessary information such as GPT Token (refer to [documentation link](docs/DOCUMENT.md) for detailed instructions).
47+
4. Run the service: Execute `sh run.sh` on Linux or Mac, or double-click `run.bat` on Windows.
48+
5. Access the service: Access the service through a browser (check the startup log for the access address, default is http://127.0.0.1:8080).
49+
6. Complete requirement development: Follow the instructions on the page to complete requirement development, and view the generated code in the `./workspace` directory.
50+
51+
For detailed documentation and configuration parameters, please refer to the [documentation link](docs/DOCUMENT.md).
52+
53+
54+
## Limitations
55+
Although we strive to enhance enterprise-level software development efficiency and reduce barriers with the help of large-scale language models, there are still some limitations in the current version:
56+
57+
- The generation of requirement and interface documentation may not be precise enough and might not meet developer intent in complex scenarios.
58+
- In the current version, automating the understanding of existing project code is not possible. We are exploring a new solution that has shown promising results during validation and will be introduced in a future version.
59+
60+
## Product Roadmap
61+
62+
- Accurate requirement decomposition and development task breakdown based on existing projects.
63+
- New product experiences for rapid import of development requirements and parallel automation of software development and deployment.
64+
- Introduce more software engineering tools and professional tools to quickly complete various software development tasks under AI planning and exectuion.
65+
66+
We invite you to participate in the DevOpsGPT project and contribute to the automation and innovation of software development, creating smarter and more efficient software systems!
67+
68+
## Disclaimer
69+
70+
This project, DevOpsGPT, is an experimental application and is provided "as-is" without any warranty, express or implied. By using this software, you agree to assume all risks associated with its use, including but not limited to data loss, system failure, or any other issues that may arise.
71+
72+
The developers and contributors of this project do not accept any responsibility or liability for any losses, damages, or other consequences that may occur as a result of using this software. You are solely responsible for any decisions and actions taken based on the information provided by DevOpsGPT.
73+
74+
Please note that the use of the GPT language model can be expensive due to its token usage. By utilizing this project, you acknowledge that you are responsible for monitoring and managing your own token usage and the associated costs. It is highly recommended to check your OpenAI API usage regularly and set up any necessary limits or alerts to prevent unexpected charges.
75+
76+
As an autonomous experiment, DevOpsGPT may generate content or take actions that are not in line with real-world business practices or legal requirements. It is your responsibility to ensure that any actions or decisions made based on the output of this software comply with all applicable laws, regulations, and ethical standards. The developers and contributors of this project shall not be held responsible for any consequences arising from the use of this software.
77+
78+
By using DevOpsGPT, you agree to indemnify, defend, and hold harmless the developers, contributors, and any affiliated parties from and against any and all claims, damages, losses, liabilities, costs, and expenses (including reasonable attorneys' fees) arising from your use of this software or your violation of these terms.
79+
80+
## Reference project
81+
- https://github.com/Significant-Gravitas/Auto-GPT
82+
- https://github.com/AntonOsika/gpt-engineer
83+
- https://github.com/hwchase17/langchain
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from .user import bp as user_bp
2+
from .task import bp as task_bp
3+
from .workspace import bp as workspace_bp
4+
from .app import bp as app_bp
5+
from .step_devops import bp as step_devops_bp
6+
from .step_subtask import bp as step_subtask_bp
7+
from .step_code import bp as step_code_bp
8+
from .step_api import bp as step_api_bp
9+
from .step_requirement import bp as step_requirement_bp
10+
11+
def register_controllers(app):
12+
app.register_blueprint(user_bp)
13+
app.register_blueprint(task_bp)
14+
app.register_blueprint(workspace_bp)
15+
app.register_blueprint(app_bp)
16+
app.register_blueprint(step_requirement_bp)
17+
app.register_blueprint(step_api_bp)
18+
app.register_blueprint(step_subtask_bp)
19+
app.register_blueprint(step_code_bp)
20+
app.register_blueprint(step_devops_bp)

backend/app/controllers/app.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from flask import request, session
2+
from app.controllers.common import json_response
3+
from flask import Blueprint
4+
from app.models.app import App
5+
from app.extensions import db
6+
from app.models.app_pro import AppPro
7+
from app.pkgs.tools.i18b import getI18n
8+
from config import GRADE
9+
10+
bp = Blueprint('app', __name__, url_prefix='/app')
11+
12+
13+
@bp.route('/add', methods=['POST'])
14+
@json_response
15+
def add():
16+
_ = getI18n("controllers")
17+
name = request.json.get('name')
18+
intro = request.json.get('intro')
19+
default_source_branch = request.json.get('default_source_branch')
20+
default_target_branch = request.json.get('default_target_branch')
21+
api_doc_url = request.json.get('api_doc_url')
22+
owner = session['username']
23+
24+
app = App(owner=owner, name=name, default_source_branch=default_source_branch,
25+
intro=intro, default_target_branch=default_target_branch, api_doc_url=api_doc_url)
26+
27+
try:
28+
db.session.add(app)
29+
db.session.commit()
30+
return {'success': True}
31+
except Exception as e:
32+
raise Exception(_("Failed to add an application."))
33+
34+
35+
@bp.route('/get', methods=['GET'])
36+
@json_response
37+
def getAll():
38+
_ = getI18n("controllers")
39+
owner = session['username']
40+
41+
try:
42+
if GRADE == "base":
43+
apps = App.getAll(owner)
44+
else:
45+
apps = AppPro.getAll(owner)
46+
47+
return {'apps': apps}
48+
except Exception as e:
49+
raise Exception(_("Failed to get applications."))

backend/app/controllers/common.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from functools import wraps
2+
import traceback
3+
from flask import jsonify
4+
5+
def json_response(func):
6+
@wraps(func) # Preserve the original function's name and docstring
7+
def decorated_function(*args, **kwargs):
8+
try:
9+
result = func(*args, **kwargs)
10+
response = {
11+
'success': True,
12+
'data': result
13+
}
14+
except Exception as e:
15+
response = {
16+
'success': False,
17+
'error': str(e)
18+
}
19+
traceback.print_exc()
20+
return jsonify(response)
21+
22+
return decorated_function
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from flask import request, session
2+
from app.controllers.common import json_response
3+
from flask import Blueprint
4+
from app.pkgs.prompt.api import clarifyAPI
5+
from app.pkgs.prompt.api_pro import clarifyAPIPro
6+
from app.pkgs.tools.i18b import getI18n
7+
from config import GRADE
8+
9+
bp = Blueprint('step_api', __name__, url_prefix='/step_api')
10+
11+
@bp.route('/clarify', methods=['POST'])
12+
@json_response
13+
def gen_interface_doc():
14+
_ = getI18n("controllers")
15+
user_prompt = request.json.get('user_prompt')
16+
username = session["username"]
17+
apiDocUrl = session[username]['memory']['appconfig']['apiDocUrl']
18+
19+
if GRADE == "base":
20+
msg, success = clarifyAPI(user_prompt, apiDocUrl)
21+
else:
22+
msg, success = clarifyAPIPro(user_prompt, apiDocUrl)
23+
24+
session[username]['memory']['originalPrompt'] = user_prompt
25+
session.update()
26+
27+
if success:
28+
return {'message': msg}
29+
else:
30+
raise Exception(_("Failed to clarify API."))
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
from flask import request, session
2+
import json
3+
import re
4+
from app.controllers.common import json_response
5+
from app.pkgs.prompt.code import aiReferenceRepair
6+
from app.pkgs.tools.i18b import getI18n
7+
from config import GRADE
8+
from app.pkgs.prompt.code import aiGenCode, aiMergeCode, aiCheckCode, aiFixError
9+
from app.pkgs.devops.devops import get_file_content
10+
from flask import Blueprint
11+
12+
bp = Blueprint('step_code', __name__, url_prefix='/step_code')
13+
14+
@bp.route('/edit_file_task', methods=['POST'])
15+
@json_response
16+
def edit_file_task():
17+
_ = getI18n("controllers")
18+
newTask = request.json.get('new_task')
19+
newCode = request.json.get('new_code')
20+
fileTask = request.json.get('file_task')
21+
userName = session["username"]
22+
appName = session[userName]['memory']['appconfig']['appName']
23+
24+
re, success = aiGenCode(fileTask, newTask, appName, newCode)
25+
if not success:
26+
raise Exception(_("Failed to edit file with new task."))
27+
28+
return {'success': success, 'code': re["code"], 'reasoning': re["reasoning"]}
29+
30+
@bp.route('/check_file', methods=['POST'])
31+
@json_response
32+
def check_file():
33+
_ = getI18n("controllers")
34+
code = request.json.get('code')
35+
fileTask = request.json.get('fileTask')
36+
37+
re, success = aiCheckCode(fileTask, code)
38+
if not success:
39+
raise Exception(_("Failed to check file."))
40+
41+
return {'success': success, 'code': re["code"], 'reasoning': re["reasoning"]}
42+
43+
@bp.route('/merge_file', methods=['POST'])
44+
@json_response
45+
def merge_file():
46+
_ = getI18n("controllers")
47+
baseCode = request.json.get('base_code')
48+
newCode = request.json.get('new_code')
49+
fileTask = request.json.get('file_task')
50+
userName = session["username"]
51+
appName = session[userName]['memory']['appconfig']['appName']
52+
53+
re, success = aiMergeCode(fileTask, appName, baseCode, newCode)
54+
if not success:
55+
raise Exception(_("Failed to merge old and new code."))
56+
57+
return {'success': success, 'code': re["code"], 'reasoning': re["reasoning"]}
58+
59+
@bp.route('/reference_repair', methods=['POST'])
60+
@json_response
61+
def reference_repair():
62+
_ = getI18n("controllers")
63+
fileTask = request.json.get('file_task')
64+
newCode = request.json.get('new_code')
65+
referenceFile = request.json.get('reference_file')
66+
repo = request.json.get('repo')
67+
userName = session["username"]
68+
appName = session[userName]['memory']['appconfig']['appName']
69+
branch = session[userName]['memory']['appconfig']['sourceBranch']
70+
71+
hasGitCode, referenceCode = get_file_content(referenceFile, branch, repo)
72+
if not hasGitCode:
73+
raise Exception(_("Failed to reference repair no reference file found."))
74+
75+
re, success = aiReferenceRepair(newCode, appName, referenceCode, fileTask)
76+
if not success:
77+
raise Exception(_("Reference repair failed for unknown reasons."))
78+
79+
return {'success': success, 'code': re["code"], 'reasoning': re["reasoning"]}
80+
81+
82+
@bp.route('/fix_compile', methods=['POST'])
83+
@json_response
84+
def fix_compile():
85+
code = request.json.get('code')
86+
solution = request.json.get('solution')
87+
88+
re, success = aiFixError(solution, code)
89+
reCode = re["code"]
90+
reason = re["reasoning"]
91+
92+
return {'success': success, 'code': reCode, 'reasoning': reason}
93+
94+
95+
@bp.route('/fix_lint', methods=['POST'])
96+
@json_response
97+
def fix_lint():
98+
code = request.json.get('code')
99+
solution = request.json.get('solution')
100+
101+
re, success = aiFixError(solution, code)
102+
reCode = re["code"]
103+
reason = re["reasoning"]
104+
105+
return {'success': success, 'code': reCode, 'reasoning': reason}

0 commit comments

Comments
 (0)