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
4715160b
Commit
4715160b
authored
May 29, 2024
by
Timothy J. Baek
Browse files
fix: pipelines
parent
7cec88c7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
167 deletions
+171
-167
backend/apps/openai/main.py
backend/apps/openai/main.py
+4
-1
backend/main.py
backend/main.py
+5
-5
src/lib/apis/index.ts
src/lib/apis/index.ts
+4
-4
src/lib/components/admin/Settings/Pipelines.svelte
src/lib/components/admin/Settings/Pipelines.svelte
+158
-157
No files found.
backend/apps/openai/main.py
View file @
4715160b
...
@@ -219,7 +219,7 @@ def merge_models_lists(model_lists):
...
@@ -219,7 +219,7 @@ def merge_models_lists(model_lists):
return
merged_list
return
merged_list
async
def
get_all_models
():
async
def
get_all_models
(
raw
:
bool
=
False
):
log
.
info
(
"get_all_models()"
)
log
.
info
(
"get_all_models()"
)
if
(
if
(
...
@@ -236,6 +236,9 @@ async def get_all_models():
...
@@ -236,6 +236,9 @@ async def get_all_models():
responses
=
await
asyncio
.
gather
(
*
tasks
)
responses
=
await
asyncio
.
gather
(
*
tasks
)
log
.
debug
(
f
"get_all_models:responses()
{
responses
}
"
)
log
.
debug
(
f
"get_all_models:responses()
{
responses
}
"
)
if
raw
:
return
responses
models
=
{
models
=
{
"data"
:
merge_models_lists
(
"data"
:
merge_models_lists
(
list
(
list
(
...
...
backend/main.py
View file @
4715160b
...
@@ -466,8 +466,10 @@ async def get_models(user=Depends(get_verified_user)):
...
@@ -466,8 +466,10 @@ async def get_models(user=Depends(get_verified_user)):
@
app
.
get
(
"/api/pipelines/list"
)
@
app
.
get
(
"/api/pipelines/list"
)
async
def
get_pipelines_list
(
user
=
Depends
(
get_admin_user
)):
async
def
get_pipelines_list
(
user
=
Depends
(
get_admin_user
)):
models
=
await
get_all_models
()
responses
=
await
get_openai_models
(
raw
=
True
)
urlIdxs
=
list
(
set
([
model
[
"urlIdx"
]
for
model
in
models
if
"pipeline"
in
model
]))
print
(
responses
)
urlIdxs
=
[
idx
for
idx
,
response
in
enumerate
(
responses
)
if
"pipelines"
in
response
]
return
{
return
{
"data"
:
[
"data"
:
[
...
@@ -716,9 +718,7 @@ async def update_pipeline_valves(
...
@@ -716,9 +718,7 @@ async def update_pipeline_valves(
pass
pass
raise
HTTPException
(
raise
HTTPException
(
status_code
=
(
status_code
=
(
r
.
status_code
if
r
is
not
None
else
status
.
HTTP_404_NOT_FOUND
),
r
.
status_code
if
r
is
not
None
else
status
.
HTTP_404_NOT_FOUND
),
detail
=
detail
,
detail
=
detail
,
)
)
...
...
src/lib/apis/index.ts
View file @
4715160b
...
@@ -154,7 +154,7 @@ export const getPipelines = async (token: string, urlIdx?: string) => {
...
@@ -154,7 +154,7 @@ export const getPipelines = async (token: string, urlIdx?: string) => {
let
error
=
null
;
let
error
=
null
;
const
searchParams
=
new
URLSearchParams
();
const
searchParams
=
new
URLSearchParams
();
if
(
urlIdx
)
{
if
(
urlIdx
!==
undefined
)
{
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
}
}
...
@@ -188,7 +188,7 @@ export const getPipelineValves = async (token: string, pipeline_id: string, urlI
...
@@ -188,7 +188,7 @@ export const getPipelineValves = async (token: string, pipeline_id: string, urlI
let
error
=
null
;
let
error
=
null
;
const
searchParams
=
new
URLSearchParams
();
const
searchParams
=
new
URLSearchParams
();
if
(
urlIdx
)
{
if
(
urlIdx
!==
undefined
)
{
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
}
}
...
@@ -224,7 +224,7 @@ export const getPipelineValvesSpec = async (token: string, pipeline_id: string,
...
@@ -224,7 +224,7 @@ export const getPipelineValvesSpec = async (token: string, pipeline_id: string,
let
error
=
null
;
let
error
=
null
;
const
searchParams
=
new
URLSearchParams
();
const
searchParams
=
new
URLSearchParams
();
if
(
urlIdx
)
{
if
(
urlIdx
!==
undefined
)
{
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
}
}
...
@@ -265,7 +265,7 @@ export const updatePipelineValves = async (
...
@@ -265,7 +265,7 @@ export const updatePipelineValves = async (
let
error
=
null
;
let
error
=
null
;
const
searchParams
=
new
URLSearchParams
();
const
searchParams
=
new
URLSearchParams
();
if
(
urlIdx
)
{
if
(
urlIdx
!==
undefined
)
{
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
searchParams
.
append
(
'
urlIdx
'
,
urlIdx
);
}
}
...
...
src/lib/components/admin/Settings/Pipelines.svelte
View file @
4715160b
...
@@ -90,6 +90,7 @@
...
@@ -90,6 +90,7 @@
valves_spec = null;
valves_spec = null;
if (PIPELINES_LIST.length > 0) {
if (PIPELINES_LIST.length > 0) {
console.log(selectedPipelinesUrlIdx);
pipelines = await getPipelines(localStorage.token, selectedPipelinesUrlIdx);
pipelines = await getPipelines(localStorage.token, selectedPipelinesUrlIdx);
if (pipelines.length > 0) {
if (pipelines.length > 0) {
...
@@ -143,10 +144,10 @@
...
@@ -143,10 +144,10 @@
console.log(PIPELINES_LIST);
console.log(PIPELINES_LIST);
if (PIPELINES_LIST.length > 0) {
if (PIPELINES_LIST.length > 0) {
selectedPipelinesUrlIdx = PIPELINES_LIST[0]['idx'];
selectedPipelinesUrlIdx = PIPELINES_LIST[0]['idx']
.toString()
;
}
}
setPipelines();
await
setPipelines();
});
});
</script>
</script>
...
@@ -182,7 +183,7 @@
...
@@ -182,7 +183,7 @@
>
>
{#each PIPELINES_LIST as pipelines, idx}
{#each PIPELINES_LIST as pipelines, idx}
<option value={pipelines.idx} class="bg-gray-100 dark:bg-gray-700"
<option value={pipelines.idx
.toString()
} class="bg-gray-100 dark:bg-gray-700"
>{pipelines.url}</option
>{pipelines.url}</option
>
>
{/each}
{/each}
...
@@ -190,7 +191,6 @@
...
@@ -190,7 +191,6 @@
</div>
</div>
</div>
</div>
</div>
</div>
{/if}
<div class=" my-2">
<div class=" my-2">
<div class=" mb-2 text-sm font-medium">
<div class=" mb-2 text-sm font-medium">
...
@@ -372,6 +372,7 @@
...
@@ -372,6 +372,7 @@
</div>
</div>
</div>
</div>
{/if}
{/if}
{/if}
{:else}
{:else}
<div class="flex justify-center h-full">
<div class="flex justify-center h-full">
<div class="my-auto">
<div class="my-auto">
...
...
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