feat: open quick ai with modifier key + enter (#939)

* feat: open quick ai with modifier key + enter

* docs: update changelog
This commit is contained in:
ayangweb
2025-10-21 15:56:01 +08:00
committed by GitHub
parent d1ad1af71a
commit cbd8dc52cd
4 changed files with 14 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ feat: support pageup/pagedown to navigate search results #920
feat: standardize multi-level menu label structure #925
feat(View Extension): page field now accepts HTTP(s) links #925
feat: return sub-exts when extension type exts themselves are matched #928
feat: open quick ai with modifier key + enter #939
### 🐛 Bug fix

View File

@@ -7,8 +7,9 @@ import platformAdapter from "@/utils/platformAdapter";
import { Get } from "@/api/axiosRequest";
import type { Assistant } from "@/types/chat";
import { useAppStore } from "@/stores/appStore";
import { navigateBack } from "@/utils";
import { canNavigateBack, navigateBack } from "@/utils";
import { useKeyPress } from "ahooks";
import { useShortcutsStore } from "@/stores/shortcutsStore";
interface AssistantManagerProps {
isChatMode: boolean;
@@ -49,6 +50,7 @@ export function useAssistantManager({
}, [quickAiAccessAssistant, selectedAssistant]);
const [assistantDetail, setAssistantDetail] = useState<any>({});
const { modifierKey } = useShortcutsStore();
useEffect(() => {
if (goAskAi) return;
@@ -78,7 +80,7 @@ export function useAssistantManager({
}, [askAI?.id, askAI?.querySource?.id, disabledExtensions]);
const handleAskAi = useCallback(() => {
if (!isTauri) return;
if (!isTauri || canNavigateBack()) return;
if (disabledExtensions.includes("QuickAIAccess")) return;
@@ -206,6 +208,11 @@ export function useAssistantManager({
setSourceData(selectedSearchContent);
});
useKeyPress(`${modifierKey}.enter`, () => {
assistant_get();
return handleAskAi();
});
return {
askAI,
askAIRef,

View File

@@ -28,6 +28,7 @@ import {
import { useTauriFocus } from "@/hooks/useTauriFocus";
import { SendMessageParams } from "../Assistant/Chat";
import { isEmpty } from "lodash-es";
import { formatKey } from "@/utils/keyboardUtils";
interface ChatInputProps {
onSend: (params: SendMessageParams) => void;
@@ -253,8 +254,8 @@ export default function ChatInput({
replace: [akiAiTooltipPrefix, askAI.name],
})}
</span>
<div className="flex items-center justify-center w-8 h-[20px] text-xs rounded-md border border-black/10 dark:border-[#545454]">
Tab
<div className="flex items-center justify-center px-1 h-[20px] text-xs rounded-md border border-black/10 dark:border-[#545454]">
{formatKey(modifierKey)} + {formatKey("Enter")}
</div>
</div>
)}

View File

@@ -37,7 +37,7 @@ export const KEY_SYMBOLS: Record<string, string> = {
// Special keys
Space: "Space",
space: "Space",
Enter: "",
Enter: "↩︎",
Backspace: "⌫",
Delete: "Del",
Escape: "Esc",