mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
05f284d4a6
commit
ecae944fd0
@ -203,8 +203,11 @@ async def get_all_models(request, user: UserModel = None):
|
|||||||
"id": f"{function.id}.{action['id']}",
|
"id": f"{function.id}.{action['id']}",
|
||||||
"name": action.get("name", f"{function.name} ({action['id']})"),
|
"name": action.get("name", f"{function.name} ({action['id']})"),
|
||||||
"description": function.meta.description,
|
"description": function.meta.description,
|
||||||
"icon_url": action.get(
|
"icon": action.get(
|
||||||
"icon_url", function.meta.manifest.get("icon_url", None)
|
"icon_url",
|
||||||
|
function.meta.manifest.get("icon_url", None)
|
||||||
|
or getattr(module, "icon_url", None)
|
||||||
|
or getattr(module, "icon", None),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
for action in actions
|
for action in actions
|
||||||
@ -215,7 +218,9 @@ async def get_all_models(request, user: UserModel = None):
|
|||||||
"id": function.id,
|
"id": function.id,
|
||||||
"name": function.name,
|
"name": function.name,
|
||||||
"description": function.meta.description,
|
"description": function.meta.description,
|
||||||
"icon_url": function.meta.manifest.get("icon_url", None),
|
"icon": function.meta.manifest.get("icon_url", None)
|
||||||
|
or getattr(module, "icon_url", None)
|
||||||
|
or getattr(module, "icon", None),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -226,7 +231,9 @@ async def get_all_models(request, user: UserModel = None):
|
|||||||
"id": function.id,
|
"id": function.id,
|
||||||
"name": function.name,
|
"name": function.name,
|
||||||
"description": function.meta.description,
|
"description": function.meta.description,
|
||||||
"icon_url": function.meta.manifest.get("icon_url", None),
|
"icon": function.meta.manifest.get("icon_url", None)
|
||||||
|
or getattr(module, "icon_url", None)
|
||||||
|
or getattr(module, "icon", None),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1167,17 +1167,17 @@
|
|||||||
filter.id
|
filter.id
|
||||||
)
|
)
|
||||||
? 'bg-gray-50 dark:bg-gray-400/10 border-gray-100 dark:border-gray-700 text-gray-600 dark:text-gray-400'
|
? 'bg-gray-50 dark:bg-gray-400/10 border-gray-100 dark:border-gray-700 text-gray-600 dark:text-gray-400'
|
||||||
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 '} capitalize"
|
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 '} capitalize"
|
||||||
>
|
>
|
||||||
{#if filter?.icon_url}
|
{#if filter?.icon}
|
||||||
<div class="size-5">
|
<div class="size-5 items-center flex justify-center">
|
||||||
<img
|
<img
|
||||||
src={filter?.icon_url}
|
src={filter.icon}
|
||||||
class="size-5 {filter.icon_url.includes('svg')
|
class="size-4.5 {filter.icon.includes('svg')
|
||||||
? 'dark:invert-[80%]'
|
? 'dark:invert-[80%]'
|
||||||
: ''}"
|
: ''}"
|
||||||
style="fill: currentColor;"
|
style="fill: currentColor;"
|
||||||
alt={filter?.name}
|
alt={filter.name}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
@ -1199,7 +1199,7 @@
|
|||||||
class="px-1.5 @xl:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden border {webSearchEnabled ||
|
class="px-1.5 @xl:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden border {webSearchEnabled ||
|
||||||
($settings?.webSearch ?? false) === 'always'
|
($settings?.webSearch ?? false) === 'always'
|
||||||
? 'bg-blue-100 dark:bg-blue-500/20 border-blue-400/20 text-blue-500 dark:text-blue-400'
|
? 'bg-blue-100 dark:bg-blue-500/20 border-blue-400/20 text-blue-500 dark:text-blue-400'
|
||||||
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800'}"
|
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 border-gray-200 hover:bg-gray-50 dark:hover:bg-gray-800'}"
|
||||||
>
|
>
|
||||||
<GlobeAlt className="size-5" strokeWidth="1.75" />
|
<GlobeAlt className="size-5" strokeWidth="1.75" />
|
||||||
<span
|
<span
|
||||||
@ -1218,7 +1218,7 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="px-1.5 @xl:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden border {imageGenerationEnabled
|
class="px-1.5 @xl:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden border {imageGenerationEnabled
|
||||||
? 'bg-gray-50 dark:bg-gray-400/10 border-gray-100 dark:border-gray-700 text-gray-600 dark:text-gray-400'
|
? 'bg-gray-50 dark:bg-gray-400/10 border-gray-100 dark:border-gray-700 text-gray-600 dark:text-gray-400'
|
||||||
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 '}"
|
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 '}"
|
||||||
>
|
>
|
||||||
<Photo className="size-5" strokeWidth="1.75" />
|
<Photo className="size-5" strokeWidth="1.75" />
|
||||||
<span
|
<span
|
||||||
@ -1237,7 +1237,7 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="px-1.5 @xl:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden border {codeInterpreterEnabled
|
class="px-1.5 @xl:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden border {codeInterpreterEnabled
|
||||||
? 'bg-gray-50 dark:bg-gray-400/10 border-gray-100 dark:border-gray-700 text-gray-600 dark:text-gray-400 '
|
? 'bg-gray-50 dark:bg-gray-400/10 border-gray-100 dark:border-gray-700 text-gray-600 dark:text-gray-400 '
|
||||||
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 '}"
|
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 '}"
|
||||||
>
|
>
|
||||||
<CommandLine className="size-5" strokeWidth="1.75" />
|
<CommandLine className="size-5" strokeWidth="1.75" />
|
||||||
<span
|
<span
|
||||||
|
@ -1401,11 +1401,11 @@
|
|||||||
actionMessage(action.id, message);
|
actionMessage(action.id, message);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{#if action.icon_url}
|
{#if action?.icon}
|
||||||
<div class="size-4">
|
<div class="size-4">
|
||||||
<img
|
<img
|
||||||
src={action.icon_url}
|
src={action.icon}
|
||||||
class="w-4 h-4 {action.icon_url.includes('svg')
|
class="w-4 h-4 {action.icon.includes('svg')
|
||||||
? 'dark:invert-[80%]'
|
? 'dark:invert-[80%]'
|
||||||
: ''}"
|
: ''}"
|
||||||
style="fill: currentColor;"
|
style="fill: currentColor;"
|
||||||
|
Loading…
Reference in New Issue
Block a user