Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update mention suggestion filtering logic #1763

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ export const useMentionConfig = ({
});
},
onUpdate: (props) => {
reactRenderer?.updateProps(props);

if (!props.clientRect) {
return;
}
reactRenderer?.updateProps({
...props,
suggestionData: {
...suggestionData,
items: props.items,
},
});
},
onKeyDown: (props) => {
if (props.event.key === "Escape") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { CopyButton } from "./components/CopyButton";
import { MessageContent } from "./components/MessageContent";
import { QuestionBrain } from "./components/QuestionBrain";
import { QuestionPrompt } from "./components/QuestionPrompt";
import { SourcesButton } from './components/SourcesButton'; // Import the new component
import { SourcesButton } from "./components/SourcesButton";
import { useMessageRow } from "./hooks/useMessageRow";


type MessageRowProps = {
speaker: "user" | "assistant";
text?: string;
Expand Down Expand Up @@ -38,9 +37,11 @@ export const MessageRow = React.forwardRef(

const sourcesIndex = messageContent.lastIndexOf("**Sources:**");
const hasSources = sourcesIndex !== -1;

if (hasSources) {
sourcesContent = messageContent.substring(sourcesIndex + "**Sources:**".length).trim();
sourcesContent = messageContent
.substring(sourcesIndex + "**Sources:**".length)
.trim();
messageContent = messageContent.substring(0, sourcesIndex).trim();
}

Expand All @@ -49,7 +50,7 @@ export const MessageRow = React.forwardRef(
<div ref={ref} className={containerClasses}>
<div className="flex justify-between items-start w-full">
{/* Left section for the question and prompt */}
<div className="flex">
<div className="flex gap-1">
<QuestionBrain brainName={brainName} />
<QuestionPrompt promptName={promptName} />
</div>
Expand All @@ -74,5 +75,5 @@ export const MessageRow = React.forwardRef(
);
}
);

MessageRow.displayName = "MessageRow";
Loading