diff --git a/app/store/config.ts b/app/store/config.ts index 956e5f3eb81..53df36ec2a3 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -1,4 +1,5 @@ import { LLMModel } from "../client/api"; +import { isMacOS } from "../utils"; import { getClientConfig } from "../config/client"; import { DEFAULT_INPUT_TEMPLATE, @@ -27,7 +28,7 @@ export enum Theme { export const DEFAULT_CONFIG = { lastUpdate: Date.now(), // timestamp, to merge state - submitKey: SubmitKey.CtrlEnter as SubmitKey, + submitKey: isMacOS() ? SubmitKey.MetaEnter : SubmitKey.CtrlEnter, avatar: "1f603", fontSize: 14, theme: Theme.Auto as Theme, diff --git a/app/utils.ts b/app/utils.ts index 37c17dd760d..1b76285cc07 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -173,3 +173,15 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) { export function getCSSVar(varName: string) { return getComputedStyle(document.body).getPropertyValue(varName).trim(); } + +/** + * Detects Macintosh + */ +export function isMacOS(): boolean { + if (typeof window !== "undefined") { + let userAgent = window.navigator.userAgent.toLocaleLowerCase(); + const macintosh = /iphone|ipad|ipod|macintosh/.test(userAgent) + return !!macintosh + } + return false +}