Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
d4b6b7c4
Commit
d4b6b7c4
authored
Jun 25, 2024
by
Jonathan Rohde
Browse files
feat(sqlalchemy): reverted not needed api change
parent
642c352c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
6 deletions
+15
-6
backend/apps/webui/routers/models.py
backend/apps/webui/routers/models.py
+1
-1
backend/test/apps/webui/routers/test_models.py
backend/test/apps/webui/routers/test_models.py
+2
-2
backend/test/util/abstract_integration_test.py
backend/test/util/abstract_integration_test.py
+8
-2
src/lib/apis/models/index.ts
src/lib/apis/models/index.ts
+4
-1
No files found.
backend/apps/webui/routers/models.py
View file @
d4b6b7c4
...
...
@@ -56,7 +56,7 @@ async def add_new_model(
############################
@
router
.
get
(
"/
{id}
"
,
response_model
=
Optional
[
ModelModel
])
@
router
.
get
(
"/"
,
response_model
=
Optional
[
ModelModel
])
async
def
get_model_by_id
(
id
:
str
,
user
=
Depends
(
get_verified_user
)):
model
=
Models
.
get_model_by_id
(
id
)
...
...
backend/test/apps/webui/routers/test_models.py
View file @
d4b6b7c4
...
...
@@ -42,9 +42,9 @@ class TestModels(AbstractPostgresTest):
assert
len
(
response
.
json
())
==
1
with
mock_webui_user
(
id
=
"2"
):
response
=
self
.
fast_api_client
.
get
(
self
.
create_url
(
"
/
my-model"
))
response
=
self
.
fast_api_client
.
get
(
self
.
create_url
(
query_params
=
{
"id"
:
"my-model"
}
))
assert
response
.
status_code
==
200
data
=
response
.
json
()
data
=
response
.
json
()
[
0
]
assert
data
[
"id"
]
==
"my-model"
assert
data
[
"name"
]
==
"Hello World"
...
...
backend/test/util/abstract_integration_test.py
View file @
d4b6b7c4
...
...
@@ -23,14 +23,20 @@ def get_fast_api_client():
class
AbstractIntegrationTest
:
BASE_PATH
=
None
def
create_url
(
self
,
path
):
def
create_url
(
self
,
path
=
""
,
query_params
=
None
):
if
self
.
BASE_PATH
is
None
:
raise
Exception
(
"BASE_PATH is not set"
)
parts
=
self
.
BASE_PATH
.
split
(
"/"
)
parts
=
[
part
.
strip
()
for
part
in
parts
if
part
.
strip
()
!=
""
]
path_parts
=
path
.
split
(
"/"
)
path_parts
=
[
part
.
strip
()
for
part
in
path_parts
if
part
.
strip
()
!=
""
]
return
"/"
.
join
(
parts
+
path_parts
)
query_parts
=
""
if
query_params
:
query_parts
=
"&"
.
join
(
[
f
"
{
key
}
=
{
value
}
"
for
key
,
value
in
query_params
.
items
()]
)
query_parts
=
f
"?
{
query_parts
}
"
return
"/"
.
join
(
parts
+
path_parts
)
+
query_parts
@
classmethod
def
setup_class
(
cls
):
...
...
src/lib/apis/models/index.ts
View file @
d4b6b7c4
...
...
@@ -63,7 +63,10 @@ export const getModelInfos = async (token: string = '') => {
export
const
getModelById
=
async
(
token
:
string
,
id
:
string
)
=>
{
let
error
=
null
;
const
res
=
await
fetch
(
`
${
WEBUI_API_BASE_URL
}
/models/
${
id
}
`
,
{
const
searchParams
=
new
URLSearchParams
();
searchParams
.
append
(
'
id
'
,
id
);
const
res
=
await
fetch
(
`
${
WEBUI_API_BASE_URL
}
/models?
${
searchParams
.
toString
()}
`
,
{
method
:
'
GET
'
,
headers
:
{
Accept
:
'
application/json
'
,
...
...
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