mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-25 04:12:44 +03:00
fix: update mention suggestion filtering logic (#1763)
Issue: https://github.com/StanGirard/quivr/issues/1762 Demo: https://github.com/StanGirard/quivr/assets/63923024/c578b9f0-5b1d-4196-85cf-042a93acd9c6
This commit is contained in:
parent
a84219f193
commit
00f11f93f2
@ -79,11 +79,13 @@ export const useMentionConfig = ({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onUpdate: (props) => {
|
onUpdate: (props) => {
|
||||||
reactRenderer?.updateProps(props);
|
reactRenderer?.updateProps({
|
||||||
|
...props,
|
||||||
if (!props.clientRect) {
|
suggestionData: {
|
||||||
return;
|
...suggestionData,
|
||||||
}
|
items: props.items,
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onKeyDown: (props) => {
|
onKeyDown: (props) => {
|
||||||
if (props.event.key === "Escape") {
|
if (props.event.key === "Escape") {
|
||||||
|
@ -4,10 +4,9 @@ import { CopyButton } from "./components/CopyButton";
|
|||||||
import { MessageContent } from "./components/MessageContent";
|
import { MessageContent } from "./components/MessageContent";
|
||||||
import { QuestionBrain } from "./components/QuestionBrain";
|
import { QuestionBrain } from "./components/QuestionBrain";
|
||||||
import { QuestionPrompt } from "./components/QuestionPrompt";
|
import { QuestionPrompt } from "./components/QuestionPrompt";
|
||||||
import { SourcesButton } from './components/SourcesButton'; // Import the new component
|
import { SourcesButton } from "./components/SourcesButton";
|
||||||
import { useMessageRow } from "./hooks/useMessageRow";
|
import { useMessageRow } from "./hooks/useMessageRow";
|
||||||
|
|
||||||
|
|
||||||
type MessageRowProps = {
|
type MessageRowProps = {
|
||||||
speaker: "user" | "assistant";
|
speaker: "user" | "assistant";
|
||||||
text?: string;
|
text?: string;
|
||||||
@ -40,7 +39,9 @@ export const MessageRow = React.forwardRef(
|
|||||||
const hasSources = sourcesIndex !== -1;
|
const hasSources = sourcesIndex !== -1;
|
||||||
|
|
||||||
if (hasSources) {
|
if (hasSources) {
|
||||||
sourcesContent = messageContent.substring(sourcesIndex + "**Sources:**".length).trim();
|
sourcesContent = messageContent
|
||||||
|
.substring(sourcesIndex + "**Sources:**".length)
|
||||||
|
.trim();
|
||||||
messageContent = messageContent.substring(0, sourcesIndex).trim();
|
messageContent = messageContent.substring(0, sourcesIndex).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ export const MessageRow = React.forwardRef(
|
|||||||
<div ref={ref} className={containerClasses}>
|
<div ref={ref} className={containerClasses}>
|
||||||
<div className="flex justify-between items-start w-full">
|
<div className="flex justify-between items-start w-full">
|
||||||
{/* Left section for the question and prompt */}
|
{/* Left section for the question and prompt */}
|
||||||
<div className="flex">
|
<div className="flex gap-1">
|
||||||
<QuestionBrain brainName={brainName} />
|
<QuestionBrain brainName={brainName} />
|
||||||
<QuestionPrompt promptName={promptName} />
|
<QuestionPrompt promptName={promptName} />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user