mirror of
https://github.com/open-webui/open-webui
synced 2025-06-23 02:16:52 +00:00
fix: pipelines
This commit is contained in:
parent
7cec88c776
commit
4715160b53
@ -219,7 +219,7 @@ def merge_models_lists(model_lists):
|
||||
return merged_list
|
||||
|
||||
|
||||
async def get_all_models():
|
||||
async def get_all_models(raw: bool = False):
|
||||
log.info("get_all_models()")
|
||||
|
||||
if (
|
||||
@ -236,6 +236,9 @@ async def get_all_models():
|
||||
responses = await asyncio.gather(*tasks)
|
||||
log.debug(f"get_all_models:responses() {responses}")
|
||||
|
||||
if raw:
|
||||
return responses
|
||||
|
||||
models = {
|
||||
"data": merge_models_lists(
|
||||
list(
|
||||
|
@ -466,8 +466,10 @@ async def get_models(user=Depends(get_verified_user)):
|
||||
|
||||
@app.get("/api/pipelines/list")
|
||||
async def get_pipelines_list(user=Depends(get_admin_user)):
|
||||
models = await get_all_models()
|
||||
urlIdxs = list(set([model["urlIdx"] for model in models if "pipeline" in model]))
|
||||
responses = await get_openai_models(raw=True)
|
||||
|
||||
print(responses)
|
||||
urlIdxs = [idx for idx, response in enumerate(responses) if "pipelines" in response]
|
||||
|
||||
return {
|
||||
"data": [
|
||||
@ -716,9 +718,7 @@ async def update_pipeline_valves(
|
||||
pass
|
||||
|
||||
raise HTTPException(
|
||||
status_code=(
|
||||
r.status_code if r is not None else status.HTTP_404_NOT_FOUND
|
||||
),
|
||||
status_code=(r.status_code if r is not None else status.HTTP_404_NOT_FOUND),
|
||||
detail=detail,
|
||||
)
|
||||
|
||||
|
@ -154,7 +154,7 @@ export const getPipelines = async (token: string, urlIdx?: string) => {
|
||||
let error = null;
|
||||
|
||||
const searchParams = new URLSearchParams();
|
||||
if (urlIdx) {
|
||||
if (urlIdx !== undefined) {
|
||||
searchParams.append('urlIdx', urlIdx);
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ export const getPipelineValves = async (token: string, pipeline_id: string, urlI
|
||||
let error = null;
|
||||
|
||||
const searchParams = new URLSearchParams();
|
||||
if (urlIdx) {
|
||||
if (urlIdx !== undefined) {
|
||||
searchParams.append('urlIdx', urlIdx);
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ export const getPipelineValvesSpec = async (token: string, pipeline_id: string,
|
||||
let error = null;
|
||||
|
||||
const searchParams = new URLSearchParams();
|
||||
if (urlIdx) {
|
||||
if (urlIdx !== undefined) {
|
||||
searchParams.append('urlIdx', urlIdx);
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ export const updatePipelineValves = async (
|
||||
let error = null;
|
||||
|
||||
const searchParams = new URLSearchParams();
|
||||
if (urlIdx) {
|
||||
if (urlIdx !== undefined) {
|
||||
searchParams.append('urlIdx', urlIdx);
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,7 @@
|
||||
valves_spec = null;
|
||||
|
||||
if (PIPELINES_LIST.length > 0) {
|
||||
console.log(selectedPipelinesUrlIdx);
|
||||
pipelines = await getPipelines(localStorage.token, selectedPipelinesUrlIdx);
|
||||
|
||||
if (pipelines.length > 0) {
|
||||
@ -143,10 +144,10 @@
|
||||
console.log(PIPELINES_LIST);
|
||||
|
||||
if (PIPELINES_LIST.length > 0) {
|
||||
selectedPipelinesUrlIdx = PIPELINES_LIST[0]['idx'];
|
||||
selectedPipelinesUrlIdx = PIPELINES_LIST[0]['idx'].toString();
|
||||
}
|
||||
|
||||
setPipelines();
|
||||
await setPipelines();
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -182,7 +183,7 @@
|
||||
>
|
||||
|
||||
{#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
|
||||
>
|
||||
{/each}
|
||||
@ -190,7 +191,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class=" my-2">
|
||||
<div class=" mb-2 text-sm font-medium">
|
||||
@ -372,6 +372,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex justify-center h-full">
|
||||
<div class="my-auto">
|
||||
|
Loading…
Reference in New Issue
Block a user