mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-27 06:46:30 -05:00
refac
This commit is contained in:
@@ -326,8 +326,9 @@ class SafeFireCrawlLoader(BaseLoader, RateLimitMixin, URLProcessingMixin):
|
|||||||
self.params = params or {}
|
self.params = params or {}
|
||||||
|
|
||||||
def lazy_load(self) -> Iterator[Document]:
|
def lazy_load(self) -> Iterator[Document]:
|
||||||
try:
|
for url in self.web_paths:
|
||||||
for url in self.web_paths:
|
try:
|
||||||
|
self._sync_wait_for_rate_limit()
|
||||||
doc = scrape_firecrawl_url(
|
doc = scrape_firecrawl_url(
|
||||||
self.api_url,
|
self.api_url,
|
||||||
self.api_key,
|
self.api_key,
|
||||||
@@ -338,22 +339,32 @@ class SafeFireCrawlLoader(BaseLoader, RateLimitMixin, URLProcessingMixin):
|
|||||||
)
|
)
|
||||||
if doc is not None:
|
if doc is not None:
|
||||||
yield doc
|
yield doc
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if self.continue_on_failure:
|
if self.continue_on_failure:
|
||||||
log.warning(f'Error extracting content from URLs with Firecrawl: {e}')
|
log.warning(f'Error extracting content from {url} with Firecrawl: {e}')
|
||||||
else:
|
continue
|
||||||
raise e
|
raise
|
||||||
|
|
||||||
async def alazy_load(self):
|
async def alazy_load(self):
|
||||||
try:
|
for url in self.web_paths:
|
||||||
docs = await run_in_threadpool(lambda: list(self.lazy_load()))
|
try:
|
||||||
for doc in docs:
|
await self._wait_for_rate_limit()
|
||||||
yield doc
|
doc = await run_in_threadpool(
|
||||||
except Exception as e:
|
scrape_firecrawl_url,
|
||||||
if self.continue_on_failure:
|
self.api_url,
|
||||||
log.warning(f'Error extracting content from URLs with Firecrawl: {e}')
|
self.api_key,
|
||||||
else:
|
url,
|
||||||
raise e
|
verify_ssl=self.verify_ssl,
|
||||||
|
timeout=self.timeout,
|
||||||
|
params=self.params,
|
||||||
|
)
|
||||||
|
if doc is not None:
|
||||||
|
yield doc
|
||||||
|
except Exception as e:
|
||||||
|
if self.continue_on_failure:
|
||||||
|
log.warning(f'Error extracting content from {url} with Firecrawl: {e}')
|
||||||
|
continue
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
class SafeTavilyLoader(BaseLoader, RateLimitMixin, URLProcessingMixin):
|
class SafeTavilyLoader(BaseLoader, RateLimitMixin, URLProcessingMixin):
|
||||||
|
|||||||
@@ -1684,7 +1684,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" flex justify-between mt-0.5 mb-2.5 mx-0.5 max-w-full" dir="ltr">
|
<div class=" flex justify-between mt-0.5 mb-2.5 mx-0.5 max-w-full" dir="ltr">
|
||||||
<div class="ml-1 self-end flex items-center flex-1 max-w-[80%]">
|
<div class="ml-1 self-end flex items-center flex-1 min-w-0">
|
||||||
<InputMenu
|
<InputMenu
|
||||||
bind:files
|
bind:files
|
||||||
selectedModels={selectedModelIds}
|
selectedModels={selectedModelIds}
|
||||||
@@ -1740,7 +1740,7 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
id="input-menu-button"
|
id="input-menu-button"
|
||||||
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-8 flex justify-center items-center outline-hidden focus:outline-hidden"
|
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-8 flex justify-center items-center outline-hidden focus:outline-hidden shrink-0"
|
||||||
aria-label={$i18n.t('More')}
|
aria-label={$i18n.t('More')}
|
||||||
>
|
>
|
||||||
<PlusAlt className="size-5.5" />
|
<PlusAlt className="size-5.5" />
|
||||||
@@ -1749,9 +1749,12 @@
|
|||||||
|
|
||||||
{#if showWebSearchButton || showImageGenerationButton || showCodeInterpreterButton || showToolsButton || showSkillsButton || (toggleFilters && toggleFilters.length > 0)}
|
{#if showWebSearchButton || showImageGenerationButton || showCodeInterpreterButton || showToolsButton || showSkillsButton || (toggleFilters && toggleFilters.length > 0)}
|
||||||
<div
|
<div
|
||||||
class="flex self-center w-[1px] h-4 mx-1 bg-gray-200/50 dark:bg-gray-800/50"
|
class="flex self-center w-[1px] h-4 mx-1 bg-gray-200/50 dark:bg-gray-800/50 shrink-0"
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="flex flex-1 items-center min-w-0 overflow-x-auto scrollbar-none">
|
||||||
|
{#if showWebSearchButton || showImageGenerationButton || showCodeInterpreterButton || showToolsButton || showSkillsButton || (toggleFilters && toggleFilters.length > 0)}
|
||||||
<IntegrationsMenu
|
<IntegrationsMenu
|
||||||
selectedModels={selectedModelIds}
|
selectedModels={selectedModelIds}
|
||||||
{toggleFilters}
|
{toggleFilters}
|
||||||
@@ -1783,34 +1786,34 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
id="integration-menu-button"
|
id="integration-menu-button"
|
||||||
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-8 flex justify-center items-center outline-hidden focus:outline-hidden"
|
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-8 flex justify-center items-center outline-hidden focus:outline-hidden shrink-0"
|
||||||
aria-label={$i18n.t('Integrations')}
|
aria-label={$i18n.t('Integrations')}
|
||||||
>
|
>
|
||||||
<Component className="size-4.5" strokeWidth="1.5" />
|
<Component className="size-4.5" strokeWidth="1.5" />
|
||||||
</button>
|
</button>
|
||||||
</IntegrationsMenu>
|
</IntegrationsMenu>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if selectedModelIds.length === 1 && $models.find((m) => m.id === selectedModelIds[0])?.has_user_valves}
|
{#if selectedModelIds.length === 1 && $models.find((m) => m.id === selectedModelIds[0])?.has_user_valves}
|
||||||
<div class="ml-1 flex gap-1.5">
|
<div class="ml-1 flex gap-1.5 shrink-0">
|
||||||
<Tooltip content={$i18n.t('Valves')} placement="top">
|
<Tooltip content={$i18n.t('Valves')} placement="top">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
id="model-valves-button"
|
id="model-valves-button"
|
||||||
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-8 flex justify-center items-center outline-hidden focus:outline-hidden"
|
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-8 flex justify-center items-center outline-hidden focus:outline-hidden"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selectedValvesType = 'function';
|
selectedValvesType = 'function';
|
||||||
selectedValvesItemId = selectedModelIds[0]?.split('.')[0];
|
selectedValvesItemId = selectedModelIds[0]?.split('.')[0];
|
||||||
showValvesModal = true;
|
showValvesModal = true;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Knobs className="size-4" strokeWidth="1.5" />
|
<Knobs className="size-4" strokeWidth="1.5" />
|
||||||
</button>
|
</button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="ml-1 flex gap-1.5">
|
<div class="ml-1 flex gap-1.5 shrink-0">
|
||||||
{#if (selectedToolIds ?? []).length > 0}
|
{#if (selectedToolIds ?? []).length > 0}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={$i18n.t('{{COUNT}} Available Tools', {
|
content={$i18n.t('{{COUNT}} Available Tools', {
|
||||||
@@ -2000,6 +2003,7 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="self-end flex space-x-1 mr-1 shrink-0 gap-[0.5px]">
|
<div class="self-end flex space-x-1 mr-1 shrink-0 gap-[0.5px]">
|
||||||
|
|||||||
Reference in New Issue
Block a user