feat: stream challenge submissions and tidy challenge imports
This commit is contained in:
parent
8fd3c4bb64
commit
cb4cde0ed2
13 changed files with 309 additions and 93 deletions
|
|
@ -44,6 +44,10 @@ from . import (
|
|||
version,
|
||||
)
|
||||
|
||||
# Import custom challenge controllers
|
||||
from . import challenges as challenges
|
||||
from . import red_blue_challenges as red_blue_challenges
|
||||
|
||||
# Import app controllers
|
||||
from .app import (
|
||||
advanced_prompt_template,
|
||||
|
|
@ -129,10 +133,6 @@ from .workspace import (
|
|||
workspace,
|
||||
)
|
||||
|
||||
# Import custom challenge controllers
|
||||
from . import challenges as challenges
|
||||
from . import red_blue_challenges as red_blue_challenges
|
||||
|
||||
api.add_namespace(console_ns)
|
||||
|
||||
__all__ = [
|
||||
|
|
@ -149,6 +149,7 @@ __all__ = [
|
|||
"audio",
|
||||
"billing",
|
||||
"bp",
|
||||
"challenges",
|
||||
"completion",
|
||||
"compliance",
|
||||
"console_ns",
|
||||
|
|
@ -193,6 +194,7 @@ __all__ = [
|
|||
"rag_pipeline_import",
|
||||
"rag_pipeline_workflow",
|
||||
"recommended_app",
|
||||
"red_blue_challenges",
|
||||
"saved_message",
|
||||
"setup",
|
||||
"site",
|
||||
|
|
@ -208,6 +210,4 @@ __all__ = [
|
|||
"workflow_run",
|
||||
"workflow_statistic",
|
||||
"workspace",
|
||||
"challenges",
|
||||
"red_blue_challenges",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@ from controllers.console.wraps import (
|
|||
account_initialization_required,
|
||||
setup_required,
|
||||
)
|
||||
from libs.login import login_required
|
||||
from extensions.ext_database import db
|
||||
from libs.login import current_user
|
||||
from libs.login import current_user, login_required
|
||||
from models.challenge import Challenge
|
||||
|
||||
|
||||
|
|
@ -72,7 +71,7 @@ class ChallengeListCreateApi(Resource):
|
|||
c.app_id = args["app_id"]
|
||||
# Convert empty string to None for UUID field
|
||||
workflow_id = args.get("workflow_id")
|
||||
c.workflow_id = workflow_id if workflow_id else None
|
||||
c.workflow_id = workflow_id or None
|
||||
c.name = args["name"]
|
||||
c.description = args.get("description")
|
||||
c.goal = args.get("goal")
|
||||
|
|
|
|||
|
|
@ -18,21 +18,21 @@ web_ns = Namespace("web", description="Web application API operations", path="/"
|
|||
from . import (
|
||||
app,
|
||||
audio,
|
||||
challenges,
|
||||
completion,
|
||||
conversation,
|
||||
feature,
|
||||
files,
|
||||
forgot_password,
|
||||
login,
|
||||
register,
|
||||
message,
|
||||
passport,
|
||||
red_blue_challenges,
|
||||
register,
|
||||
remote_files,
|
||||
saved_message,
|
||||
site,
|
||||
workflow,
|
||||
challenges,
|
||||
red_blue_challenges,
|
||||
)
|
||||
|
||||
api.add_namespace(web_ns)
|
||||
|
|
@ -42,20 +42,20 @@ __all__ = [
|
|||
"app",
|
||||
"audio",
|
||||
"bp",
|
||||
"challenges",
|
||||
"completion",
|
||||
"conversation",
|
||||
"feature",
|
||||
"files",
|
||||
"forgot_password",
|
||||
"login",
|
||||
"register",
|
||||
"message",
|
||||
"passport",
|
||||
"red_blue_challenges",
|
||||
"register",
|
||||
"remote_files",
|
||||
"saved_message",
|
||||
"site",
|
||||
"web_ns",
|
||||
"workflow",
|
||||
"challenges",
|
||||
"red_blue_challenges",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from flask_restx import Resource
|
||||
from sqlalchemy import select
|
||||
|
||||
from controllers.web import web_ns
|
||||
from extensions.ext_database import db
|
||||
from sqlalchemy import select
|
||||
|
||||
from models.challenge import Challenge, ChallengeAttempt
|
||||
from models.model import App, Site
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class WebRegisterApi(Resource):
|
|||
name = payload.get('name') or 'Player'
|
||||
password = payload.get('password')
|
||||
if not email or not password:
|
||||
return { 'result': 'bad_request' }, 400
|
||||
return {'result': 'bad_request'}, 400
|
||||
account = RegisterService.register(
|
||||
email=email,
|
||||
name=name,
|
||||
|
|
@ -25,6 +25,6 @@ class WebRegisterApi(Resource):
|
|||
create_workspace_required=False,
|
||||
)
|
||||
db.session.commit()
|
||||
return { 'result': 'success', 'data': { 'account_id': account.id } }, 201
|
||||
return {'result': 'success', 'data': {'account_id': account.id}}, 201
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue