fix: local websearch is enough to display websearch toggle
Browse files- README.md +3 -1
- src/routes/+layout.server.ts +2 -1
README.md
CHANGED
@@ -122,7 +122,9 @@ PUBLIC_APP_DISCLAIMER=
|
|
122 |
|
123 |
### Web Search config
|
124 |
|
125 |
-
You can enable the web search by adding
|
|
|
|
|
126 |
|
127 |
### Custom models
|
128 |
|
|
|
122 |
|
123 |
### Web Search config
|
124 |
|
125 |
+
You can enable the web search through an API by adding `YDC_API_KEY` ([docs.you.com](https://docs.you.com)) or `SERPER_API_KEY` ([serper.dev](https://serper.dev/)) or `SERPAPI_KEY` ([serpapi.com](https://serpapi.com/)) to your `.env.local`.
|
126 |
+
|
127 |
+
You can also simply enable the local websearch by setting `USE_LOCAL_WEBSEARCH=true` in your `.env.local`.
|
128 |
|
129 |
### Custom models
|
130 |
|
src/routes/+layout.server.ts
CHANGED
@@ -11,6 +11,7 @@ import {
|
|
11 |
SERPER_API_KEY,
|
12 |
MESSAGES_BEFORE_LOGIN,
|
13 |
YDC_API_KEY,
|
|
|
14 |
} from "$env/static/private";
|
15 |
|
16 |
export const load: LayoutServerLoad = async ({ locals, depends, url }) => {
|
@@ -87,7 +88,7 @@ export const load: LayoutServerLoad = async ({ locals, depends, url }) => {
|
|
87 |
ethicsModalAcceptedAt: settings?.ethicsModalAcceptedAt ?? null,
|
88 |
activeModel: settings?.activeModel ?? DEFAULT_SETTINGS.activeModel,
|
89 |
hideEmojiOnSidebar: settings?.hideEmojiOnSidebar ?? false,
|
90 |
-
searchEnabled: !!(SERPAPI_KEY || SERPER_API_KEY || YDC_API_KEY),
|
91 |
customPrompts: settings?.customPrompts ?? {},
|
92 |
},
|
93 |
models: models.map((model) => ({
|
|
|
11 |
SERPER_API_KEY,
|
12 |
MESSAGES_BEFORE_LOGIN,
|
13 |
YDC_API_KEY,
|
14 |
+
USE_LOCAL_WEBSEARCH,
|
15 |
} from "$env/static/private";
|
16 |
|
17 |
export const load: LayoutServerLoad = async ({ locals, depends, url }) => {
|
|
|
88 |
ethicsModalAcceptedAt: settings?.ethicsModalAcceptedAt ?? null,
|
89 |
activeModel: settings?.activeModel ?? DEFAULT_SETTINGS.activeModel,
|
90 |
hideEmojiOnSidebar: settings?.hideEmojiOnSidebar ?? false,
|
91 |
+
searchEnabled: !!(SERPAPI_KEY || SERPER_API_KEY || YDC_API_KEY || USE_LOCAL_WEBSEARCH),
|
92 |
customPrompts: settings?.customPrompts ?? {},
|
93 |
},
|
94 |
models: models.map((model) => ({
|