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
a5379627
Commit
a5379627
authored
Jun 01, 2024
by
Timothy J. Baek
Browse files
refac: web search config
parent
fbdfb7e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
5 deletions
+35
-5
backend/apps/rag/main.py
backend/apps/rag/main.py
+4
-4
src/lib/components/documents/Settings/WebParams.svelte
src/lib/components/documents/Settings/WebParams.svelte
+31
-1
No files found.
backend/apps/rag/main.py
View file @
a5379627
...
...
@@ -370,7 +370,7 @@ async def get_rag_config(user=Depends(get_admin_user)):
"web"
:
{
"ssl_verification"
:
app
.
state
.
config
.
ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION
,
"search"
:
{
"enable"
:
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
,
"enable
d
"
:
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
,
"engine"
:
app
.
state
.
config
.
RAG_WEB_SEARCH_ENGINE
,
"searxng_query_url"
:
app
.
state
.
config
.
SEARXNG_QUERY_URL
,
"google_pse_api_key"
:
app
.
state
.
config
.
GOOGLE_PSE_API_KEY
,
...
...
@@ -397,7 +397,7 @@ class YoutubeLoaderConfig(BaseModel):
class
WebSearchConfig
(
BaseModel
):
enable
:
bool
enable
d
:
bool
engine
:
Optional
[
str
]
=
None
searxng_query_url
:
Optional
[
str
]
=
None
google_pse_api_key
:
Optional
[
str
]
=
None
...
...
@@ -443,7 +443,7 @@ async def update_rag_config(form_data: ConfigUpdateForm, user=Depends(get_admin_
form_data
.
web
.
web_loader_ssl_verification
)
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
=
form_data
.
web
.
search
.
enable
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
=
form_data
.
web
.
search
.
enable
d
app
.
state
.
config
.
RAG_WEB_SEARCH_ENGINE
=
form_data
.
web
.
search
.
engine
app
.
state
.
config
.
SEARXNG_QUERY_URL
=
form_data
.
web
.
search
.
searxng_query_url
app
.
state
.
config
.
GOOGLE_PSE_API_KEY
=
form_data
.
web
.
search
.
google_pse_api_key
...
...
@@ -475,7 +475,7 @@ async def update_rag_config(form_data: ConfigUpdateForm, user=Depends(get_admin_
"web"
:
{
"ssl_verification"
:
app
.
state
.
config
.
ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION
,
"search"
:
{
"enable"
:
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
,
"enable
d
"
:
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
,
"engine"
:
app
.
state
.
config
.
RAG_WEB_SEARCH_ENGINE
,
"searxng_query_url"
:
app
.
state
.
config
.
SEARXNG_QUERY_URL
,
"google_pse_api_key"
:
app
.
state
.
config
.
GOOGLE_PSE_API_KEY
,
...
...
src/lib/components/documents/Settings/WebParams.svelte
View file @
a5379627
...
...
@@ -58,7 +58,7 @@
{$i18n.t('Enable Web Search')}
</div>
<Switch bind:state={webConfig.search.enable} />
<Switch bind:state={webConfig.search.enable
d
} />
</div>
</div>
...
...
@@ -191,6 +191,36 @@
{/if}
</div>
{/if}
{#if webConfig.search.enabled}
<div class="mt-2 flex gap-2 mb-1">
<div class="w-full">
<div class=" self-center text-xs font-medium mb-1">
{$i18n.t('Search Result Count')}
</div>
<input
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
placeholder={$i18n.t('Search Result Count')}
bind:value={webConfig.search.result_count}
required
/>
</div>
<div class="w-full">
<div class=" self-center text-xs font-medium mb-1">
{$i18n.t('Concurrent Requests')}
</div>
<input
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
placeholder={$i18n.t('Concurrent Requests')}
bind:value={webConfig.search.concurrent_requests}
required
/>
</div>
</div>
{/if}
</div>
<hr class=" dark:border-gray-850 my-2" />
...
...
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