Skip to content

Commit b733bb5

Browse files
authored
feat: ai overview support is enabled with shortcut (#597)
* feat: ai overview support is enabled with shortcut * docs: update changelog
1 parent 5046754 commit b733bb5

7 files changed

Lines changed: 50 additions & 6 deletions

File tree

docs/content.en/docs/release-notes/_index.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ title: "Release Notes"
77

88
Information about release notes of Coco Server is provided here.
99

10-
## Latest (In development)
11-
### ❌ Breaking changes
12-
### 🚀 Features
13-
### 🐛 Bug fix
14-
### ✈️ Improvements
10+
## Latest (In development)
11+
12+
### ❌ Breaking changes
13+
14+
### 🚀 Features
15+
16+
- feat: ai overview support is enabled with shortcut #597
17+
18+
### 🐛 Bug fix
19+
20+
### ✈️ Improvements
1521

1622
## 0.5.1 (2025-05-31)
1723

src/components/Search/InputControls.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ const InputControls = ({
224224
const aiOverviewAssistant = useExtensionsStore((state) => {
225225
return state.aiOverviewAssistant;
226226
});
227+
const aiOverviewShortcut = useShortcutsStore((state) => state.aiOverview);
227228

228229
return (
229230
<div
@@ -326,7 +327,15 @@ const InputControls = ({
326327
setEnabledAiOverview(!enabledAiOverview);
327328
}}
328329
>
329-
<Sparkles className="size-4" />
330+
<VisibleKey
331+
shortcut={aiOverviewShortcut}
332+
onKeyPress={() => {
333+
setEnabledAiOverview(!enabledAiOverview);
334+
}}
335+
>
336+
<Sparkles className="size-4" />
337+
</VisibleKey>
338+
330339
<span
331340
className={clsx("text-xs", { hidden: !enabledAiOverview })}
332341
>

src/components/Settings/Advanced/components/Shortcuts/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
INITIAL_SERVICE_LIST,
2323
INITIAL_EXTERNAL,
2424
useShortcutsStore,
25+
INITIAL_AI_OVERVIEW,
2526
} from "@/stores/shortcutsStore";
2627
import { ModifierKey } from "@/types/index";
2728
import platformAdapter from "@/utils/platformAdapter";
@@ -87,6 +88,8 @@ const Shortcuts = () => {
8788
const external = useShortcutsStore((state) => state.external);
8889
const setExternal = useShortcutsStore((state) => state.setExternal);
8990
const addError = useAppStore((state) => state.addError);
91+
const aiOverview = useShortcutsStore((state) => state.aiOverview);
92+
const setAiOverview = useShortcutsStore((state) => state.setAiOverview);
9093

9194
useEffect(() => {
9295
const unlisten = useShortcutsStore.subscribe((state) => {
@@ -233,6 +236,15 @@ const Shortcuts = () => {
233236
setExternal(INITIAL_EXTERNAL);
234237
},
235238
},
239+
{
240+
title: "settings.advanced.shortcuts.aiOverview.title",
241+
description: "settings.advanced.shortcuts.aiOverview.description",
242+
value: aiOverview,
243+
setValue: setAiOverview,
244+
reset: () => {
245+
setAiOverview(INITIAL_AI_OVERVIEW);
246+
},
247+
},
236248
];
237249

238250
const handleChange = (value: string, setValue: (value: string) => void) => {

src/hooks/useSyncStore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export const useSyncStore = () => {
108108
const setAiOverviewDelay = useExtensionsStore((state) => {
109109
return state.setAiOverviewDelay;
110110
});
111+
const setAiOverview = useShortcutsStore((state) => state.setAiOverview);
111112

112113
useEffect(() => {
113114
if (!resetFixedWindow) {
@@ -137,7 +138,9 @@ export const useSyncStore = () => {
137138
fixedWindow,
138139
serviceList,
139140
external,
141+
aiOverview,
140142
} = payload;
143+
141144
setModifierKey(modifierKey);
142145
setModeSwitch(modeSwitch);
143146
setReturnToInput(returnToInput);
@@ -154,6 +157,7 @@ export const useSyncStore = () => {
154157
setFixedWindow(fixedWindow);
155158
setServiceList(serviceList);
156159
setExternal(external);
160+
setAiOverview(aiOverview);
157161
}),
158162

159163
platformAdapter.listenEvent("change-startup-store", ({ payload }) => {

src/locales/en/translation.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@
150150
"hits": {
151151
"isSystem": "This shortcut is reserved by the system, please choose another key.",
152152
"isUse": "This shortcut is already in use, please choose another key."
153+
},
154+
"aiOverview": {
155+
"title": "AI Overview",
156+
"description": "Shortcut button to enable AI Overview in chat mode."
153157
}
154158
},
155159
"connect": {

src/locales/zh/translation.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@
150150
"hits": {
151151
"isSystem": "该快捷键已被系统保留,请选择其他按键。",
152152
"isUse": "该快捷键已被占用,请选择其他按键。"
153+
},
154+
"aiOverview": {
155+
"title": "AI 总结",
156+
"description": "在搜索模式下启用 AI 总结的快捷按键。"
153157
}
154158
},
155159
"connect": {

src/stores/shortcutsStore.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export type IShortcutsStore = {
4343
setExternal: (external: string) => void;
4444
resetFixedWindow: boolean;
4545
setResetFixedWindow: (resetFixedWindow: boolean) => void;
46+
aiOverview: string;
47+
setAiOverview: (aiOverview: string) => void;
4648
};
4749

4850
export const INITIAL_MODE_SWITCH = "T";
@@ -60,6 +62,7 @@ export const INITIAL_NEW_SESSION = "N";
6062
export const INITIAL_FIXED_WINDOW = "P";
6163
export const INITIAL_SERVICE_LIST = "S";
6264
export const INITIAL_EXTERNAL = "E";
65+
export const INITIAL_AI_OVERVIEW = "O";
6366

6467
export const useShortcutsStore = create<IShortcutsStore>()(
6568
persist(
@@ -114,6 +117,8 @@ export const useShortcutsStore = create<IShortcutsStore>()(
114117
setResetFixedWindow: (resetFixedWindow) => {
115118
return set({ resetFixedWindow });
116119
},
120+
aiOverview: INITIAL_AI_OVERVIEW,
121+
setAiOverview: (aiOverview) => set({ aiOverview }),
117122
}),
118123
{
119124
name: "shortcuts-store",

0 commit comments

Comments
 (0)