优化命令管理,提升系统的易用性和灵活性。
This commit is contained in:
parent
d67261223a
commit
d9d20d478d
@ -1,4 +1,4 @@
|
||||
# Generated by Django 5.1.6 on 2025-02-25 15:33
|
||||
# Generated by Django 5.1.6 on 2025-02-25 15:53
|
||||
|
||||
import django.db.models.deletion
|
||||
import simplepro.components.fields
|
||||
@ -228,7 +228,7 @@ class Migration(migrations.Migration):
|
||||
(
|
||||
"commands",
|
||||
simplepro.components.fields.CheckboxField(
|
||||
default=["/review"], max_length=256, verbose_name="默认命令"
|
||||
default="/review", max_length=256, verbose_name="默认命令"
|
||||
),
|
||||
),
|
||||
(
|
||||
|
||||
@ -85,7 +85,7 @@ class ProjectConfig(BaseModel):
|
||||
)
|
||||
commands = fields.CheckboxField(
|
||||
choices=constant.DEFAULT_COMMANDS,
|
||||
default=["/review"],
|
||||
default="/review",
|
||||
max_length=256,
|
||||
verbose_name="默认命令",
|
||||
)
|
||||
|
||||
@ -56,7 +56,7 @@ class WebHookView(View):
|
||||
git_type = constant.GIT_TYPE[project_config.git_config.git_type][1]
|
||||
access_token = project_config.git_config.access_token
|
||||
project_secret = project_config.project_secret
|
||||
project_commands = project_config.commands
|
||||
project_commands = project_config.commands.split(",")
|
||||
|
||||
config = load_project_config(
|
||||
git_url=git_url,
|
||||
@ -100,7 +100,7 @@ class WebHookView(View):
|
||||
|
||||
threads = []
|
||||
for cmd in project_commands:
|
||||
if cmd not in constant.DEFAULT_COMMANDS:
|
||||
if cmd not in [cmd[1] for cmd in constant.DEFAULT_COMMANDS]:
|
||||
continue
|
||||
t = threading.Thread(target=run_cmd, args=(cmd,))
|
||||
threads.append(t)
|
||||
|
||||
@ -4,8 +4,8 @@ GIT_TYPE = (
|
||||
(2, "gitea")
|
||||
)
|
||||
|
||||
DEFAULT_COMMANDS = [
|
||||
"/review",
|
||||
"/describe",
|
||||
"/improve_code"
|
||||
]
|
||||
DEFAULT_COMMANDS = (
|
||||
("/review", "/review"),
|
||||
("/describe", "/describe"),
|
||||
("/improve_code", "/improve_code"),
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user