mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
parent
02847af580
commit
8cbb6ba166
2 changed files with 15 additions and 11 deletions
|
|
@ -27,7 +27,7 @@ export default function Mention({
|
||||||
const localize = useLocalize();
|
const localize = useLocalize();
|
||||||
const assistantMap = useAssistantsMapContext();
|
const assistantMap = useAssistantsMapContext();
|
||||||
const { options, presets, modelSpecs, modelsConfig, endpointsConfig, assistantListMap } =
|
const { options, presets, modelSpecs, modelsConfig, endpointsConfig, assistantListMap } =
|
||||||
useMentions({ assistantMap, includeAssistants });
|
useMentions({ assistantMap: assistantMap || {}, includeAssistants });
|
||||||
const { onSelectMention } = useSelectMention({
|
const { onSelectMention } = useSelectMention({
|
||||||
presets,
|
presets,
|
||||||
modelSpecs,
|
modelSpecs,
|
||||||
|
|
@ -161,7 +161,9 @@ export default function Mention({
|
||||||
type={type}
|
type={type}
|
||||||
index={index}
|
index={index}
|
||||||
key={`${mention.value}-${index}`}
|
key={`${mention.value}-${index}`}
|
||||||
onClick={() => {
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
if (timeoutRef.current) {
|
if (timeoutRef.current) {
|
||||||
clearTimeout(timeoutRef.current);
|
clearTimeout(timeoutRef.current);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,16 @@ import React from 'react';
|
||||||
import { Clock4 } from 'lucide-react';
|
import { Clock4 } from 'lucide-react';
|
||||||
import { cn } from '~/utils';
|
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({
|
export default function MentionItem({
|
||||||
name,
|
name,
|
||||||
onClick,
|
onClick,
|
||||||
|
|
@ -10,15 +20,7 @@ export default function MentionItem({
|
||||||
isActive,
|
isActive,
|
||||||
description,
|
description,
|
||||||
type = 'mention',
|
type = 'mention',
|
||||||
}: {
|
}: MentionItemProps) {
|
||||||
name: string;
|
|
||||||
onClick: () => void;
|
|
||||||
index: number;
|
|
||||||
type?: 'prompt' | 'mention' | 'add-convo';
|
|
||||||
icon?: React.ReactNode;
|
|
||||||
isActive?: boolean;
|
|
||||||
description?: string;
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<button tabIndex={index} onClick={onClick} id={`${type}-item-${index}`} className="w-full">
|
<button tabIndex={index} onClick={onClick} id={`${type}-item-${index}`} className="w-full">
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue