diff --git a/backend/apps/openai/main.py b/backend/apps/openai/main.py index fb16a579b..c97fd99ce 100644 --- a/backend/apps/openai/main.py +++ b/backend/apps/openai/main.py @@ -120,8 +120,8 @@ async def speech(request: Request, user=Depends(get_verified_user)): headers["Authorization"] = f"Bearer {app.state.config.OPENAI_API_KEYS[idx]}" headers["Content-Type"] = "application/json" if "openrouter.ai" in app.state.OPENAI_API_BASE_URLS[idx]: - headers['HTTP-Referer'] = "https://openwebui.com/" - headers['X-Title'] = "Open WebUI" + headers["HTTP-Referer"] = "https://openwebui.com/" + headers["X-Title"] = "Open WebUI" r = None try: r = requests.post( diff --git a/backend/apps/web/routers/chats.py b/backend/apps/web/routers/chats.py index f72ed79b3..aaf173521 100644 --- a/backend/apps/web/routers/chats.py +++ b/backend/apps/web/routers/chats.py @@ -58,7 +58,7 @@ async def delete_all_user_chats(request: Request, user=Depends(get_current_user) if ( user.role == "user" - and not request.app.state.USER_PERMISSIONS["chat"]["deletion"] + and not request.app.state.config.USER_PERMISSIONS["chat"]["deletion"] ): raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, @@ -266,7 +266,7 @@ async def delete_chat_by_id(request: Request, id: str, user=Depends(get_current_ result = Chats.delete_chat_by_id(id) return result else: - if not request.app.state.USER_PERMISSIONS["chat"]["deletion"]: + if not request.app.state.config.USER_PERMISSIONS["chat"]["deletion"]: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.ACCESS_PROHIBITED, diff --git a/backend/main.py b/backend/main.py index 5c4cd0c57..3fc83949f 100644 --- a/backend/main.py +++ b/backend/main.py @@ -145,12 +145,12 @@ class RAGMiddleware(BaseHTTPMiddleware): data["messages"], citations = rag_messages( docs=data["docs"], messages=data["messages"], - template=rag_app.state.RAG_TEMPLATE, + template=rag_app.state.config.RAG_TEMPLATE, embedding_function=rag_app.state.EMBEDDING_FUNCTION, k=rag_app.state.TOP_K, reranking_function=rag_app.state.sentence_transformer_rf, - r=rag_app.state.RELEVANCE_THRESHOLD, - hybrid_search=rag_app.state.ENABLE_RAG_HYBRID_SEARCH, + r=rag_app.state.config.RELEVANCE_THRESHOLD, + hybrid_search=rag_app.state.config.ENABLE_RAG_HYBRID_SEARCH, ) del data["docs"] diff --git a/src/lib/components/chat/Settings/Interface.svelte b/src/lib/components/chat/Settings/Interface.svelte index 1eb1999d5..fef648e9d 100644 --- a/src/lib/components/chat/Settings/Interface.svelte +++ b/src/lib/components/chat/Settings/Interface.svelte @@ -235,7 +235,10 @@
{$i18n.t('Set Task Model')}
+ content={$i18n.t( + 'A task model is used when performing tasks such as generating titles for chats and web search queries' + )} + > message.role === 'user').map((message) => message.content); + const previousMessages = messages + .filter((message) => message.role === 'user') + .map((message) => message.content); return await generateSearchQuery( localStorage.token, diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index d178b6e5e..f7153fe5c 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -893,7 +893,9 @@ const userMessage = history.messages[messageId]; const userPrompt = userMessage.content; - const previousMessages = messages.filter((message) => message.role === 'user').map((message) => message.content); + const previousMessages = messages + .filter((message) => message.role === 'user') + .map((message) => message.content); return await generateSearchQuery( localStorage.token, diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5a8a8bba3..dd90caa27 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -24,9 +24,9 @@ let backendConfig = null; try { backendConfig = await getBackendConfig(); - console.log("Backend config:", backendConfig); + console.log('Backend config:', backendConfig); } catch (error) { - console.error("Error loading backend config:", error); + console.error('Error loading backend config:', error); } // Initialize i18n even if we didn't get a backend config, // so `/error` can show something that's not `undefined`.