Skip to content

Commit

Permalink
📧 fix: @/+command timing for click selections - closes #3613 (#3617)
Browse files Browse the repository at this point in the history
  • Loading branch information
berry-13 authored Aug 12, 2024
1 parent 02847af commit 8cbb6ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
6 changes: 4 additions & 2 deletions client/src/components/Chat/Input/Mention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Mention({
const localize = useLocalize();
const assistantMap = useAssistantsMapContext();
const { options, presets, modelSpecs, modelsConfig, endpointsConfig, assistantListMap } =
useMentions({ assistantMap, includeAssistants });
useMentions({ assistantMap: assistantMap || {}, includeAssistants });
const { onSelectMention } = useSelectMention({
presets,
modelSpecs,
Expand Down Expand Up @@ -161,7 +161,9 @@ export default function Mention({
type={type}
index={index}
key={`${mention.value}-${index}`}
onClick={() => {
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
Expand Down
20 changes: 11 additions & 9 deletions client/src/components/Chat/Input/MentionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import React from 'react';
import { Clock4 } from 'lucide-react';
import { cn } from '~/utils';

export interface MentionItemProps {
name: string;
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
index: number;
type?: 'prompt' | 'mention' | 'add-convo';
icon?: React.ReactNode;
isActive?: boolean;
description?: string;
}

export default function MentionItem({
name,
onClick,
Expand All @@ -10,15 +20,7 @@ export default function MentionItem({
isActive,
description,
type = 'mention',
}: {
name: string;
onClick: () => void;
index: number;
type?: 'prompt' | 'mention' | 'add-convo';
icon?: React.ReactNode;
isActive?: boolean;
description?: string;
}) {
}: MentionItemProps) {
return (
<button tabIndex={index} onClick={onClick} id={`${type}-item-${index}`} className="w-full">
<div
Expand Down

0 comments on commit 8cbb6ba

Please sign in to comment.