Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/client/platforms/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class GeminiProApi implements LLMApi {
model: options.config.model,
},
};
const requestPayload = {
const requestPayload: any = {
contents: messages,
generationConfig: {
// stopSequences: [
Expand Down Expand Up @@ -181,6 +181,10 @@ export class GeminiProApi implements LLMApi {
],
};

if (modelConfig.enableWebSearch) {
requestPayload.tools = [{ googleSearch: {} }];
}

let shouldStream = !!options.config.stream;
const controller = new AbortController();
options.onController?.(controller);
Expand Down
17 changes: 17 additions & 0 deletions app/components/model-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,23 @@ export function ModelConfigList(props: {
}
></input>
</ListItem>
{props.modelConfig?.providerName == ServiceProvider.Google && (
<ListItem
title={Locale.Settings.EnableWebSearch.Title}
subTitle={Locale.Settings.EnableWebSearch.SubTitle}
>
<input
aria-label={Locale.Settings.EnableWebSearch.Title}
type="checkbox"
checked={props.modelConfig.enableWebSearch}
onChange={(e) =>
props.updateConfig(
(config) => (config.enableWebSearch = e.currentTarget.checked),
)
}
></input>
</ListItem>
)}
<ListItem
title={Locale.Settings.CompressModel.Title}
subTitle={Locale.Settings.CompressModel.SubTitle}
Expand Down
4 changes: 4 additions & 0 deletions app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,10 @@ const cn = {
},
},

EnableWebSearch: {
Title: "ε―η”¨η½‘η»œζœη΄’",
SubTitle: "δΈΊθ―₯ζ¨‘εž‹ε―η”¨η½‘η»œζœη΄’ε·₯ε…·οΌˆδ»…ι™ GeminiοΌ‰",
},
Model: "ζ¨‘εž‹ (model)",
CompressModel: {
Title: "ε―Ήθ―ζ‘˜θ¦ζ¨‘εž‹",
Expand Down
4 changes: 4 additions & 0 deletions app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ const en: LocaleType = {
},
},

EnableWebSearch: {
Title: "Enable Web Search",
SubTitle: "Enable web search tool for this model (Gemini only)",
},
Model: "Model",
CompressModel: {
Title: "Summary Model",
Expand Down
8 changes: 7 additions & 1 deletion app/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const DEFAULT_CONFIG = {
compressModel: "",
compressProviderName: "",
enableInjectSystemPrompts: true,
enableWebSearch: false,
template: config?.template ?? DEFAULT_INPUT_TEMPLATE,
size: "1024x1024" as ModelSize,
quality: "standard" as DalleQuality,
Expand Down Expand Up @@ -195,7 +196,7 @@ export const useAppConfig = createPersistStore(
}),
{
name: StoreKey.Config,
version: 4.1,
version: 4.2,

merge(persistedState, currentState) {
const state = persistedState as ChatConfig | undefined;
Expand Down Expand Up @@ -255,6 +256,11 @@ export const useAppConfig = createPersistStore(
DEFAULT_CONFIG.modelConfig.compressProviderName;
}

if (version < 4.2) {
state.modelConfig.enableWebSearch =
DEFAULT_CONFIG.modelConfig.enableWebSearch;
}

return state as any;
},
},
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
"scripts": {
"mask": "npx tsx app/masks/build.ts",
"mask:watch": "npx watch \"yarn mask\" app/masks",
"dev": "concurrently -r \"yarn run mask:watch\" \"next dev\"",
"dev": "concurrently -r \"yarn run mask:watch\" \"next dev --webpack\"",
"build": "yarn mask && cross-env BUILD_MODE=standalone next build",
"start": "next start",
"lint": "next lint",
"export": "yarn mask && cross-env BUILD_MODE=export BUILD_APP=1 next build",
"export:dev": "concurrently -r \"yarn mask:watch\" \"cross-env BUILD_MODE=export BUILD_APP=1 next dev\"",
"export:dev": "concurrently -r \"yarn mask:watch\" \"cross-env BUILD_MODE=export BUILD_APP=1 next dev --webpack\"",
"app:dev": "concurrently -r \"yarn mask:watch\" \"yarn tauri dev\"",
"app:build": "yarn mask && yarn tauri build",
"app:clear": "yarn tauri dev",
"prompts": "node ./scripts/fetch-prompts.mjs",
"prepare": "husky install",
"proxy-dev": "sh ./scripts/init-proxy.sh && proxychains -f ./scripts/proxychains.conf yarn dev",
"test": "node --no-warnings --experimental-vm-modules $(yarn bin jest) --watch",
"test:ci": "node --no-warnings --experimental-vm-modules $(yarn bin jest) --ci"
Expand All @@ -24,7 +23,7 @@
"@fortaine/fetch-event-source": "^3.0.6",
"@hello-pangea/dnd": "^16.5.0",
"@modelcontextprotocol/sdk": "^1.0.4",
"@next/third-parties": "^14.1.0",
"@next/third-parties": "^16.1.6",
"@svgr/webpack": "^6.5.1",
"@vercel/analytics": "^0.1.11",
"@vercel/speed-insights": "^1.0.2",
Expand All @@ -39,7 +38,7 @@
"markdown-to-txt": "^2.0.1",
"mermaid": "^10.6.1",
"nanoid": "^5.0.3",
"next": "^14.1.1",
"next": "^16.1.6",
"node-fetch": "^3.3.1",
"openapi-client-axios": "^7.5.5",
"react": "^18.2.0",
Expand All @@ -55,6 +54,7 @@
"sass": "^1.59.2",
"spark-md5": "^3.0.2",
"use-debounce": "^9.0.4",
"yarn": "^1.22.22",
"zod": "^3.24.1",
"zustand": "^4.3.8"
},
Expand All @@ -81,13 +81,13 @@
"eslint-plugin-unused-imports": "^3.2.0",
"husky": "^8.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-environment-jsdom": "^30.3.0",
"lint-staged": "^13.2.2",
"prettier": "^3.0.2",
"ts-node": "^10.9.2",
"tsx": "^4.16.0",
"typescript": "5.2.2",
"watch": "^1.0.2",
"watch": "^0.13.0",
"webpack": "^5.88.1"
},
"resolutions": {
Expand Down
24 changes: 19 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -12,17 +16,27 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
"@/*": [
"./*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}