Added parameter to: app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION to get_web_loader(verify_ssl).

Invert variable value to send to UI , not ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION.
This commit is contained in:
Davi Sclifo Zucon 2024-11-04 16:21:26 -03:00
parent 5306b49be0
commit 35a9140567

View File

@ -428,7 +428,7 @@ async def get_rag_config(user=Depends(get_admin_user)):
"translation": app.state.YOUTUBE_LOADER_TRANSLATION,
},
"web": {
"web_loader_ssl_verification": app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION,
"web_loader_ssl_verification": not app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION,
"search": {
"enabled": app.state.config.ENABLE_RAG_WEB_SEARCH,
"engine": app.state.config.RAG_WEB_SEARCH_ENGINE,
@ -536,8 +536,9 @@ async def update_rag_config(form_data: ConfigUpdateForm, user=Depends(get_admin_
app.state.YOUTUBE_LOADER_TRANSLATION = form_data.youtube.translation
if form_data.web is not None:
# if "Bypass SSL verification for Websites" == True then web_loader_ssl_verification = False.
app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION = (
form_data.web.web_loader_ssl_verification
not form_data.web.web_loader_ssl_verification
)
app.state.config.ENABLE_RAG_WEB_SEARCH = form_data.web.search.enabled
@ -592,7 +593,7 @@ async def update_rag_config(form_data: ConfigUpdateForm, user=Depends(get_admin_
"translation": app.state.YOUTUBE_LOADER_TRANSLATION,
},
"web": {
"web_loader_ssl_verification": app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION,
"web_loader_ssl_verification": not app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION,
"search": {
"enabled": app.state.config.ENABLE_RAG_WEB_SEARCH,
"engine": app.state.config.RAG_WEB_SEARCH_ENGINE,
@ -1229,7 +1230,7 @@ def process_web_search(form_data: SearchForm, user=Depends(get_verified_user)):
urls = [result.link for result in web_results]
loader = get_web_loader(urls)
loader = get_web_loader(urls, verify_ssl=app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION)
docs = loader.load()
save_docs_to_vector_db(docs, collection_name, overwrite=True)