Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ai): hotkeys (#1225)

Eric Hayesa03f49606d2b
diff --git a/js/app/packages/app/component/SoupChatInput.tsx b/js/app/packages/app/component/SoupChatInput.tsx
index c6d972f820..5f3e348081 100644
--- a/js/app/packages/app/component/SoupChatInput.tsx
+++ b/js/app/packages/app/component/SoupChatInput.tsx
@@ -3,14 +3,21 @@ import { setPendingSendData } from '@core/component/AI/signal/pendingSend';
import type { CreateAndSend, Send } from '@core/component/AI/types';
import { isErr } from '@core/util/maybeResult';
import { cognitionApiServiceClient } from '@service-cognition/client';
-import { Show } from 'solid-js';
+import { useHotkeyDOMScope } from 'core/hotkey/hotkeys';
+import { onMount, Show } from 'solid-js';
import { useSplitPanelOrThrow } from './split-layout/layoutUtils';
export function SoupChatInput() {
+ let containerRef!: HTMLDivElement;
const splitPanelContext = useSplitPanelOrThrow();
const [preview] = splitPanelContext.previewState;
const { ChatInput } = useChatInput();
+ const [attachHotkeys] = useHotkeyDOMScope('soup.chatInput');
+
+ onMount(() => {
+ attachHotkeys(containerRef);
+ });
const handleSend = async (request: Send | CreateAndSend) => {
if (request.type !== 'createAndSend') return;
@@ -41,6 +48,7 @@ export function SoupChatInput() {
return (
<Show when={!preview()}>
<div
+ ref={containerRef}
class="absolute z-10 bottom-0 pb-2 px-2 flex justify-center w-full pointer-events-none "
style={{
'background-image': `linear-gradient(transparent, var(--color-panel) 85%)`,
diff --git a/js/app/packages/core/component/AI/component/input/useChatInput.tsx b/js/app/packages/core/component/AI/component/input/useChatInput.tsx
index 29c564ac80..8f48b51686 100644
--- a/js/app/packages/core/component/AI/component/input/useChatInput.tsx
+++ b/js/app/packages/core/component/AI/component/input/useChatInput.tsx
@@ -1,4 +1,3 @@
-import ArrowUp from '@icon/bold/arrow-up-bold.svg';
import { withAnalytics } from '@coparse/analytics';
import { useBuildChatSendRequest } from '@core/component/AI/component/input/buildRequest';
import { DEFAULT_MODEL, SMART_MODE_MODEL } from '@core/component/AI/constant';
@@ -20,6 +19,8 @@ import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
import { Hotkey, modifierMap } from '@core/component/Hotkey';
import { Tooltip } from '@core/component/Tooltip';
import { pressedKeys } from '@core/hotkey/state';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import ArrowUp from '@icon/bold/arrow-up-bold.svg';
import PlusIcon from '@icon/regular/plus.svg';
import XIcon from '@icon/regular/x.svg';
import Stop from '@phosphor-icons/core/regular/stop.svg';
@@ -36,7 +37,6 @@ import {
type UseChatMarkdown,
useChatMarkdownArea,
} from './useChatMarkdownArea';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
const { track, TrackingEvents } = withAnalytics();
@@ -172,7 +172,7 @@ function ChatInput(props: ChatInputInternalProps) {
const canSendMessage = () =>
!isEmptyInput() && !generating() && !hasUploadingAttachments();
- const LINE_HEIGHT_THRESHOLD = 32;
+ const LINE_HEIGHT_THRESHOLD = 40;
let mdRef: undefined | HTMLDivElement;
const isMultiline = () => {
// Access markdownText to create reactive dependency
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index 5c3976b590..267e29a7bb 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -119,7 +119,7 @@ export const ENABLE_STATIC_DOCUMENT_CARDS = false;
export const ENABLE_MARKDOWN_AI_GENERATE = false;
-export const ENABLE_UNIFIED_LIST_AI_INPUT = false;
+export const ENABLE_UNIFIED_LIST_AI_INPUT = true;
// snapshot mention content inline for AI chat
export const ENABLE_SNAPSHOT_NODE = true;