Skip to content
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

Feat/subtask #115

Merged
merged 46 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c56dd20
feat(subtask): support java subtask
booboosui Sep 12, 2023
5a86739
feat(subtask): support java subtask
booboosui Sep 12, 2023
20d880d
fix(task): recover task bug
booboosui Sep 12, 2023
5d0384e
chore(*): optimize
booboosui Sep 13, 2023
41d6fd3
feat(index): add index
booboosui Sep 14, 2023
6bd98f4
fix(*)
booboosui Sep 15, 2023
26197c2
fix(*): 恢复数据\cd\自我检测
booboosui Sep 15, 2023
e02c291
fix(bill): fix task url bug
booboosui Sep 15, 2023
a3f4b74
chore(*): update gitignore
booboosui Sep 15, 2023
19938df
feat(coder): The task starts to display more basic application inform…
booboosui Sep 15, 2023
d78b47e
refact(prd)
booboosui Sep 17, 2023
491fb98
feat(prd): prd review
booboosui Sep 18, 2023
ca3cfe9
feat(pay)
booboosui Sep 19, 2023
25c0e05
refact(*): remove session storage data
booboosui Sep 20, 2023
984d530
fix(auth)
booboosui Sep 21, 2023
ed1068f
fix(auth)
booboosui Sep 21, 2023
3e36044
feat(doc): add help center link
booboosui Sep 21, 2023
37c140f
feat(task): gen rand branch name
booboosui Sep 22, 2023
482e259
feat(code): update python empty file
yakeJiang Sep 22, 2023
546dc7c
fix(subtask): fix subtask get app info bug && fix git bug
charging-kuafuai Sep 22, 2023
fba836a
Merge branch 'feat/subtask' of https://github.com/kuafuai/DevOpsGPT i…
charging-kuafuai Sep 22, 2023
305b15d
fix(req): fixbug
charging-kuafuai Sep 22, 2023
d8af531
fix(*):优化需求修改意见不准确问题;优化需求评审不靠谱问题;解决Java开发没有入库问题;修复修复问题不准确问题;增加对有step的…
charging-kuafuai Sep 24, 2023
c7dc6ff
fix(ws): 解决克隆目录已存在问题
charging-kuafuai Sep 24, 2023
8b94630
chore(front): 调整文案 && 自动检测改为手动触发
charging-kuafuai Sep 26, 2023
035d44e
feat(subtask): 将开发任务拆分部分从黑河改为支持前端展示和调整
charging-kuafuai Sep 26, 2023
839b6e8
chore(*): 调整文案
charging-kuafuai Sep 27, 2023
9481bb3
chore(subtask): 优化恢复任务的显示
charging-kuafuai Sep 27, 2023
f46fed1
chore(task): 增加引导任务
charging-kuafuai Sep 27, 2023
58c8dd5
fix(task): fix js bug
charging-kuafuai Sep 27, 2023
2369634
chore(prompt): 优化Prompt
charging-kuafuai Sep 29, 2023
80905b0
fix(code): fix review code bug
charging-kuafuai Oct 4, 2023
d8173d6
chore(*): 优化Prompt & 增加一个review按钮 & review的按钮有bug,多次review看到的都一样
charging-kuafuai Oct 5, 2023
51477bb
feat(git): push set remote
booboosui Oct 10, 2023
d7a2280
fix(ci\cd): fix bug
charging-kuafuai Oct 10, 2023
f989c6c
Merge branch 'feat/subtask' of https://github.com/kuafuai/DevOpsGPT i…
charging-kuafuai Oct 10, 2023
7b1f744
fix(*): 首页文案\AI角色头像\GitHub代理
charging-kuafuai Oct 11, 2023
f2fe54f
feat(html): 首页增加产品介绍
charging-kuafuai Oct 11, 2023
ab47702
fix(*): 修复PayPal支付问题\首页视频中英文问题\试一把改成免费试用
charging-kuafuai Oct 12, 2023
be3a35f
fix(setting): update save token * bug
yakeJiang Oct 13, 2023
2c081e6
Merge branch 'feat/subtask' of https://github.com/kuafuai/DevOpsGPT i…
yakeJiang Oct 13, 2023
e732df6
feat(*): 修复没有www跨域问题\改为短信验证码\触发CI前自动推送代码\触发CD的时候判断是否有镜像
charging-kuafuai Oct 13, 2023
a47f3b0
Merge branch 'feat/subtask' of https://github.com/kuafuai/DevOpsGPT i…
charging-kuafuai Oct 13, 2023
632b6d3
chore(*): 更新视频地址
charging-kuafuai Oct 13, 2023
edc0e29
feat(front): 注册手机号错误提示;页面标点符号修改;增加百度统计代码
charging-kuafuai Oct 14, 2023
88dfd65
chore(*): merge to master
booboosui Oct 16, 2023
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ db/versions/*
db/env.py
db/README.md
db/database_pro.db
alembic.ini
alembic.ini*
.idea
44 changes: 35 additions & 9 deletions backend/app/controllers/app.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from flask import request, session
from flask import request

from app.controllers.common import json_response
from flask import Blueprint
from app.pkgs.tools.i18b import getI18n
from app.pkgs.knowledge.app_info import analyzeService
from app.models.application import Application
from app.models.application_service import ApplicationService
from app.models.application_service_lib import ApplicationServiceLib
from app.models.tenant_pro import Tenant
from app.pkgs.tools import storage
from config import GRADE

bp = Blueprint('app', __name__, url_prefix='/app')

Expand All @@ -15,7 +19,7 @@
def add():
_ = getI18n("controllers")
name = request.json.get('app_name')
tenant_id = session['tenant_id']
tenant_id = storage.get("tenant_id")
app_id = request.json.get('app_id')
default_source_branch = request.json.get('app_default_source_branch')
default_target_branch = request.json.get('app_default_target_branch')
Expand All @@ -24,11 +28,11 @@ def add():
cd_config = request.json.get('app_cd_config')
ci_config = request.json.get('app_ci_config')
git_config = request.json.get('app_git_config')
creater = session['username']
creater = storage.get("username")

try:
if app_id:
app = Application.update_application(app_id, name=name, description=description, default_source_branch=default_source_branch, default_target_branch=default_target_branch, cd_config=cd_config, ci_config=ci_config, git_config=git_config)
app = Application.update_application(app_id, tenant_id=tenant_id, name=name, description=description, default_source_branch=default_source_branch, default_target_branch=default_target_branch, cd_config=cd_config, ci_config=ci_config, git_config=git_config)
ApplicationService.delete_service_by_app_id(app_id)
appID = app_id
else:
Expand All @@ -37,7 +41,7 @@ def add():

for service in services:
if "service_name" in service:
newService = ApplicationService.create_service(appID, service["service_name"], service["service_git_path"], service["service_workflow"], service["service_role"], service["service_language"], service["service_framework"], service["service_database"], service["service_api_type"], service["service_api_location"], service["service_container_name"], service["service_container_group"], service["service_region"], service["service_public_ip"], service["service_security_group"], service["service_cd_subnet"], service["service_struct_cache"])
newService = ApplicationService.create_service(appID, service["service_name"], service["service_git_path"], service["service_workflow"], service["service_role"], service["service_language"], service["service_framework"], service["service_database"], service["service_api_type"], service["service_api_location"], service["service_container_name"], service["service_container_group"], service["service_region"], '', service["service_security_group"], service["service_cd_subnet"], service["service_struct_cache"], '', service["service_service_type"])

ApplicationServiceLib.create_libs(newService.service_id, service["service_libs_name"])

Expand All @@ -50,7 +54,21 @@ def add():
@json_response
def getAll():
_ = getI18n("controllers")
tenantID = session['tenant_id']
tenantID = storage.get("tenant_id")
appID = request.args.get('app_id')

try:
apps = Application.get_all_application(tenantID, appID)

return {'apps': apps}
except Exception as e:
raise Exception(_("Failed to get applications."))

@bp.route('/get_tpl', methods=['GET'])
@json_response
def get_tpl():
_ = getI18n("controllers")
tenantID = 0
appID = request.args.get('app_id')

try:
Expand All @@ -64,11 +82,19 @@ def getAll():
@json_response
def analyze_service():
_ = getI18n("controllers")
tenantID = session['tenant_id']
tenantID = storage.get("tenant_id")
gitPath = request.json.get('service_git_path')

if len(gitPath) < 1:
raise Exception(_("Failed to analysis applications."))

if GRADE != "base":
passed, msg = Tenant.check_quota(tenantID, checkPlus=False, checkTask=False, checkCodePower=True)
if not passed:
raise Exception(msg)

info, success = analyzeService(tenantID, gitPath)
if not success:
raise Exception(_("Failed to analysis applications."))
raise Exception(_("Failed to analysis applications.")+"目前只支持Java和python语言 Currently, only Java and python languages are supported")

return info
return info
71 changes: 35 additions & 36 deletions backend/app/controllers/requirement.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
from flask import Blueprint, request, session, json
from flask import Blueprint, request
from app.controllers.common import json_response
from app.models.task import getEmptyTaskInfo
from app.pkgs.tools.i18b import getI18n
from app.models.requirement import Requirement
from app.models.requirement_memory_pro import RequirementMemory
from app.models.tenant_pro import Tenant
from app.models.tenant_bill_pro import TenantBill
from app.pkgs.tools import storage
from config import REQUIREMENT_STATUS_NotStarted, GRADE

bp = Blueprint('requirement', __name__, url_prefix='/requirement')


@bp.route('/clear_up', methods=['GET'])
@json_response
def clear_up():
try:
session.pop(session["username"])
except Exception as e:
print("clear_up failed:"+str(e))

session[session["username"]] = getEmptyTaskInfo()
tenant_name = "-"
code_power = '0'
def clear_up():
if GRADE != "base":
tenant = Tenant.get_tenant_baseinfo_by_id(session["tenant_id"])
tenant = Tenant.get_tenant_baseinfo_by_id(storage.get("tenant_id"))
if tenant:
tenant_name = tenant["name"]
code_power = TenantBill.get_total_codepower(session["tenant_id"])
billing_type_name = tenant["billing_type_name"]
code_power = TenantBill.get_total_codepower(storage.get("tenant_id"))
else:
tenant_name = "DevOpsGPT"
code_power = '0'
billing_type_name = "FREE"

return {"username": session["username"], "tenant_name": tenant_name, "tenant_id": session["tenant_id"], "info": session[session["username"]], "code_power": code_power}
return {"username": storage.get("username"), "billing_type_name": billing_type_name, "tenant_name": tenant_name, "tenant_id": storage.get("tenant_id"), "code_power": code_power}


@bp.route('/setup_app', methods=['POST'])
Expand All @@ -38,49 +36,47 @@ def setup_app():
appID = data['app_id']
sourceBranch = data['source_branch']
featureBranch = data['feature_branch']
username = session['username']
tenantID = session['tenant_id']
username = storage.get("username")
tenantID = storage.get("tenant_id")

if GRADE != "base":
passed, msg = Tenant.check_quota(tenantID)
if not passed:
raise Exception(msg)

requirement = Requirement.create_requirement(tenantID, "New requirement", "New", appID, username, sourceBranch, featureBranch, REQUIREMENT_STATUS_NotStarted, 0, 0)

session[username]['memory']['task_info'] = {
"app_id": appID,
"task_id": requirement.requirement_id,
"source_branch": sourceBranch,
"feature_branch": featureBranch
}
session.update()
requirement = Requirement.create_requirement(
tenantID, "New requirement", "New", appID, username, sourceBranch, featureBranch, REQUIREMENT_STATUS_NotStarted, 0, 0)

if requirement.requirement_id:
return Requirement.get_requirement_by_id(requirement.requirement_id)
return Requirement.get_requirement_by_id(requirement.requirement_id, tenantID)
else:
raise Exception(_("Failed to set up app."))


@bp.route('/get', methods=['GET'])
@json_response
def get_all():
_ = getI18n("controllers")
tenantID = session['tenant_id']
tenantID = storage.get("tenant_id")

requirements = Requirement.get_all_requirements(tenantID, 1, 100)

return {'requirements': requirements["requirements"]}

requirements = Requirement.get_all_requirements(tenantID)

return {'requirements': requirements}

@bp.route('/get_one', methods=['GET'])
@json_response
def get_one():
_ = getI18n("controllers")
requirementID = request.args.get('requirement_id')
tenantID = storage.get("tenant_id")

requirement = Requirement.get_requirement_by_id(requirementID)
requirement = Requirement.get_requirement_by_id(requirementID, tenantID)
if not requirement:
raise Exception(_("The task does not exist."))

memory = {
"task_info" : {
"task_info": {
"app_id": requirement["app_id"],
"task_id": requirement["requirement_id"],
"source_branch": requirement["default_source_branch"],
Expand All @@ -90,21 +86,24 @@ def get_one():
requirement["old_memory"] = memory

if GRADE != "base":
requirement["memory"] = RequirementMemory.get_all_requirement_memories(requirementID, 1)
requirement["memory"] = RequirementMemory.get_all_requirement_memories(
requirementID, 1)

return requirement


@bp.route('/update', methods=['POST'])
@json_response
def update():
_ = getI18n("controllers")
data = request.json
requirement_id = data['requirement_id']
update_data = data['data']
tenantID = storage.get("tenant_id")

requirement = Requirement.update_requirement(requirement_id, **update_data)
requirement = Requirement.update_requirement(requirement_id, tenantID, **update_data)

if requirement.requirement_id:
return Requirement.get_requirement_by_id(requirement.requirement_id)
return Requirement.get_requirement_by_id(requirement.requirement_id, tenantID)
else:
raise Exception(_("Failed to set up app."))
raise Exception(_("Failed to set up app."))
53 changes: 39 additions & 14 deletions backend/app/controllers/setting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask import request, session
from flask import request
from app.pkgs.tools import storage
from app.controllers.common import json_response
from flask import Blueprint
from app.pkgs.tools.i18b import getI18n
Expand All @@ -17,7 +18,7 @@ def get_git_config_list():

gitList, success = getGitConfigList(tenantID, 0)
if not success:
raise Exception(_("Failed to get git config list."))
raise Exception(_("Failed to get git config list."))

return gitList

Expand All @@ -29,7 +30,7 @@ def get_ci_config_list():

gitList, success = getCIConfigList(tenantID, 0)
if not success:
raise Exception(_("Failed to get git config list."))
raise Exception(_("Failed to get git config list."))

return gitList

Expand All @@ -41,20 +42,20 @@ def get_cd_config_list():

gitList, success = getCDConfigList(tenantID, 0)
if not success:
raise Exception(_("Failed to get git config list."))
raise Exception(_("Failed to get git config list."))

return gitList

@bp.route('/get_llm_config_list', methods=['GET'])
@json_response
def get_llm_config_list():
_ = getI18n("controllers")
raise Exception(_("Failed to get git config list."))
raise Exception(_("Failed to get git config list."))
tenantID = request.args.get('tenant_id')

gitList, success = getLLMConfigList(tenantID, 0)
if not success:
raise Exception(_("Failed to get git config list."))
raise Exception(_("Failed to get git config list."))

return gitList

Expand All @@ -69,12 +70,21 @@ def edit_git():
git_username = request.json.get('git_username')
git_config_id = request.json.get('git_config_id')
name = request.json.get('git_name')
creater = session['username']
creater = storage.get("username")
tenant_id = request.json.get('tenant_id')

try:
if git_config_id:
TenantGitConfig.update_config(git_config_id, name=name, git_email=git_email, git_provider=git_provider, git_token=git_token, git_url=git_url, git_username=git_username)
generate_kwargs = dict(
name=name,
git_email=git_email,
git_provider=git_provider,
git_url=git_url,
git_username=git_username
)
if git_token.find("*") == -1:
generate_kwargs.update(dict(git_token=git_token))
TenantGitConfig.update_config(git_config_id, tenant_id, **generate_kwargs)
id = git_config_id
else:
data = TenantGitConfig.create_config(tenant_id, creater, name, git_url, git_token, git_provider, git_username, git_email)
Expand All @@ -83,7 +93,7 @@ def edit_git():
return {'success': id}
except Exception as e:
raise Exception(_("Failed to edit setting."))

@bp.route('/edit_ci', methods=['POST'])
@json_response
def edit_ci():
Expand All @@ -93,12 +103,19 @@ def edit_ci():
ci_provider = request.json.get('ci_provider')
ci_config_id = request.json.get('ci_config_id')
name = request.json.get('ci_name')
creater = session['username']
creater = storage.get("username")
tenant_id = request.json.get('tenant_id')

try:
if ci_config_id:
TenantCIConfig.update_config(ci_config_id, name=name, ci_api_url=ci_api_url, ci_token=ci_token, ci_provider=ci_provider)
generate_kwargs = dict(
name=name,
ci_api_url=ci_api_url,
ci_provider=ci_provider
)
if ci_token.find("*") == -1:
generate_kwargs.update(dict(ci_token=ci_token))
TenantCIConfig.update_config(ci_config_id, tenant_id, **generate_kwargs)
id = ci_config_id
else:
data = TenantCIConfig.create_config(tenant_id, creater, name, ci_api_url, ci_token, ci_provider)
Expand All @@ -107,7 +124,7 @@ def edit_ci():
return {'success': id}
except Exception as e:
raise Exception(_("Failed to edit setting."))

@bp.route('/edit_cd', methods=['POST'])
@json_response
def edit_cd():
Expand All @@ -117,12 +134,20 @@ def edit_cd():
secret_key = request.json.get('SECRET_KEY')
cd_provider = request.json.get('cd_provider')
name = request.json.get('cd_name')
creater = session['username']
creater = storage.get("username")
tenant_id = request.json.get('tenant_id')

try:
if cd_config_id:
TenantCDConfig.update_config(cd_config_id, name=name, access_key=access_key, secret_key=secret_key, cd_provider=cd_provider)
generate_kwargs = dict(
name=name, cd_provider=cd_provider
)
if access_key.find("*") == -1:
generate_kwargs.update(dict(access_key=access_key))
if secret_key.find("*") == -1:
generate_kwargs.update(dict(secret_key=secret_key))

TenantCDConfig.update_config(cd_config_id, tenant_id, **generate_kwargs)
id = cd_config_id
else:
data = TenantCDConfig.create_config(tenant_id, creater, name, access_key, secret_key, cd_provider)
Expand Down
Loading
Loading