Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
aisbf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
aisbf
Commits
b0c0e3c9
Commit
b0c0e3c9
authored
May 18, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Studio paths
parent
7d6f3e60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
admin.py
aisbf/routes/dashboard/admin.py
+71
-0
No files found.
aisbf/routes/dashboard/admin.py
View file @
b0c0e3c9
...
...
@@ -350,6 +350,77 @@ async def dashboard_studio_pipeline_custom_run(request: Request, pipeline_id: st
return
JSONResponse
(
studio_service
.
run_pipeline
(
"admin"
,
None
,
payload
))
def
_parse_studio_model_id
(
model
:
str
):
"""Parse studio model IDs → (kind, source_id, target_id).
<provider>/<model> → ('provider', provider, model)
rotation/<name> → ('rotation', name, name)
autoselect[ion]/<name> → ('autoselect', name, name)
provider/<src>/<tgt> → ('provider', src, tgt) # legacy 3-part form
"""
parts
=
(
model
or
''
)
.
split
(
'/'
,
2
)
if
not
parts
or
not
parts
[
0
]:
return
None
,
None
,
None
kind
=
parts
[
0
]
.
lower
()
if
kind
in
(
'rotation'
,):
name
=
parts
[
1
]
if
len
(
parts
)
>
1
else
''
return
'rotation'
,
name
,
name
if
kind
in
(
'autoselect'
,
'autoselection'
):
name
=
parts
[
1
]
if
len
(
parts
)
>
1
else
''
return
'autoselect'
,
name
,
name
if
kind
==
'provider'
and
len
(
parts
)
==
3
:
return
'provider'
,
parts
[
1
],
parts
[
2
]
if
len
(
parts
)
>=
2
:
return
'provider'
,
parts
[
0
],
'/'
.
join
(
parts
[
1
:])
return
None
,
None
,
None
@
router
.
post
(
"/dashboard/api/studio/chat/completions"
)
async
def
dashboard_studio_chat_completions
(
request
:
Request
):
auth_check
=
require_dashboard_auth
(
request
)
if
auth_check
:
return
auth_check
from
aisbf.handlers
import
RequestHandler
,
RotationHandler
,
AutoselectHandler
body
=
await
request
.
json
()
kind
,
source_id
,
target_id
=
_parse_studio_model_id
(
body
.
get
(
'model'
)
or
''
)
if
not
kind
:
raise
HTTPException
(
status_code
=
400
,
detail
=
"model required in format provider/source/target, rotation/name, or autoselect/name"
)
body_dict
=
dict
(
body
)
if
kind
==
'rotation'
:
handler
=
RotationHandler
(
user_id
=
None
)
body_dict
[
'model'
]
=
source_id
return
await
handler
.
handle_rotation_request
(
source_id
,
body_dict
,
None
,
None
)
if
kind
==
'autoselect'
:
handler
=
AutoselectHandler
(
user_id
=
None
)
body_dict
[
'model'
]
=
source_id
return
await
handler
.
handle_autoselect_request
(
source_id
,
body_dict
,
None
,
None
)
handler
=
RequestHandler
(
user_id
=
None
)
body_dict
[
'model'
]
=
target_id
return
await
handler
.
handle_chat_completion
(
request
,
source_id
,
body_dict
)
@
router
.
post
(
"/dashboard/api/studio/u/{username}/chat/completions"
)
async
def
dashboard_user_studio_chat_completions
(
request
:
Request
,
username
:
str
):
scope
,
user_id
=
_dashboard_studio_user_scope
(
request
,
username
)
from
aisbf.handlers
import
RequestHandler
,
RotationHandler
,
AutoselectHandler
body
=
await
request
.
json
()
kind
,
source_id
,
target_id
=
_parse_studio_model_id
(
body
.
get
(
'model'
)
or
''
)
if
not
kind
:
raise
HTTPException
(
status_code
=
400
,
detail
=
"model required in format provider/source/target, rotation/name, or autoselect/name"
)
body_dict
=
dict
(
body
)
if
kind
==
'rotation'
:
handler
=
RotationHandler
(
user_id
=
user_id
)
body_dict
[
'model'
]
=
source_id
return
await
handler
.
handle_rotation_request
(
source_id
,
body_dict
,
user_id
,
None
)
if
kind
==
'autoselect'
:
handler
=
AutoselectHandler
(
user_id
=
user_id
)
body_dict
[
'model'
]
=
source_id
return
await
handler
.
handle_autoselect_request
(
source_id
,
body_dict
,
user_id
,
None
)
handler
=
RequestHandler
(
user_id
=
user_id
)
body_dict
[
'model'
]
=
target_id
return
await
handler
.
handle_chat_completion
(
request
,
source_id
,
body_dict
)
@
router
.
get
(
"/dashboard/api/studio/u/{username}/characters"
)
async
def
dashboard_user_studio_characters
(
request
:
Request
,
username
:
str
):
scope
,
owner_id
=
_dashboard_studio_user_scope
(
request
,
username
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment