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
70701894
Commit
70701894
authored
May 10, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: migrate message model config off deprecated pydantic api
parent
2c9b5310
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
models.py
aisbf/models.py
+2
-3
test_dashboard_studio.py
tests/routes/test_dashboard_studio.py
+28
-0
No files found.
aisbf/models.py
View file @
70701894
...
@@ -23,7 +23,7 @@ Why did the programmer quit his job? Because he didn't get arrays!
...
@@ -23,7 +23,7 @@ Why did the programmer quit his job? Because he didn't get arrays!
A modular proxy server for managing multiple AI provider integrations.
A modular proxy server for managing multiple AI provider integrations.
"""
"""
from
pydantic
import
BaseModel
,
Field
from
pydantic
import
BaseModel
,
ConfigDict
,
Field
from
typing
import
Dict
,
List
,
Optional
,
Union
from
typing
import
Dict
,
List
,
Optional
,
Union
class
Message
(
BaseModel
):
class
Message
(
BaseModel
):
...
@@ -33,8 +33,7 @@ class Message(BaseModel):
...
@@ -33,8 +33,7 @@ class Message(BaseModel):
tool_call_id
:
Optional
[
str
]
=
None
tool_call_id
:
Optional
[
str
]
=
None
name
:
Optional
[
str
]
=
None
name
:
Optional
[
str
]
=
None
class
Config
:
model_config
=
ConfigDict
(
extra
=
"allow"
)
extra
=
"allow"
# Allow extra fields not defined in the model
class
ChatCompletionRequest
(
BaseModel
):
class
ChatCompletionRequest
(
BaseModel
):
model
:
str
model
:
str
messages
:
List
[
Message
]
messages
:
List
[
Message
]
...
...
tests/routes/test_dashboard_studio.py
View file @
70701894
...
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
...
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
"""
import
inspect
import
json
import
json
from
pathlib
import
Path
from
pathlib
import
Path
import
sys
import
sys
...
@@ -30,6 +31,8 @@ from itsdangerous import TimestampSigner
...
@@ -30,6 +31,8 @@ from itsdangerous import TimestampSigner
sys
.
path
.
insert
(
0
,
str
(
Path
(
__file__
)
.
resolve
()
.
parents
[
2
]))
sys
.
path
.
insert
(
0
,
str
(
Path
(
__file__
)
.
resolve
()
.
parents
[
2
]))
from
aisbf.routes.dashboard
import
providers
as
dashboard_providers
from
aisbf.routes.dashboard
import
providers
as
dashboard_providers
from
aisbf.routes.dashboard
import
settings
as
dashboard_settings
from
aisbf.models
import
Message
from
aisbf.database
import
DatabaseRegistry
from
aisbf.database
import
DatabaseRegistry
from
aisbf.studio
import
build_studio_catalog
from
aisbf.studio
import
build_studio_catalog
from
main
import
app
from
main
import
app
...
@@ -572,6 +575,31 @@ def test_search_provider_models_refresh_uses_autodetect_flow_without_exposing_st
...
@@ -572,6 +575,31 @@ def test_search_provider_models_refresh_uses_autodetect_flow_without_exposing_st
assert
response
.
json
()
==
{
"models"
:
[
"whisper-large-v3"
],
"fetched_live"
:
True
}
assert
response
.
json
()
==
{
"models"
:
[
"whisper-large-v3"
],
"fetched_live"
:
True
}
def
test_message_model_uses_pydantic_v2_model_config
():
assert
Message
.
model_config
.
get
(
"extra"
)
==
"allow"
assert
"Config"
not
in
Message
.
__dict__
def
test_dashboard_user_query_uses_pattern_constraints
():
route
=
next
(
route
for
route
in
dashboard_settings
.
router
.
routes
if
route
.
endpoint
is
dashboard_settings
.
dashboard_users
)
query_params
=
{
param
.
name
:
param
for
param
in
route
.
dependant
.
query_params
}
assert
query_params
[
"order_by"
]
.
field_info
.
json_schema_extra
==
{
"pattern"
:
"^(username|last_login|created_at|tier_name)$"
}
assert
query_params
[
"direction"
]
.
field_info
.
json_schema_extra
==
{
"pattern"
:
"^(asc|desc)$"
}
assert
query_params
[
"status_filter"
]
.
field_info
.
json_schema_extra
==
{
"pattern"
:
"^(active|inactive)$"
}
assert
query_params
[
"role_filter"
]
.
field_info
.
json_schema_extra
==
{
"pattern"
:
"^(admin|user)$"
}
source
=
inspect
.
getsource
(
dashboard_settings
.
dashboard_users
)
assert
"regex="
not
in
source
def
test_fastapi_app_uses_lifespan_instead_of_on_event_decorators
():
lifespan_context
=
getattr
(
app
.
router
,
"lifespan_context"
,
None
)
assert
lifespan_context
is
not
None
assert
not
getattr
(
app
.
router
,
"on_startup"
,
[])
assert
not
getattr
(
app
.
router
,
"on_shutdown"
,
[])
class
DummyOpen
:
class
DummyOpen
:
def
__init__
(
self
,
sink
):
def
__init__
(
self
,
sink
):
self
.
sink
=
sink
self
.
sink
=
sink
...
...
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