Skip to content
Open
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
172 changes: 0 additions & 172 deletions apps/roam/src/components/VectorDuplicateMatches.tsx

This file was deleted.

22 changes: 2 additions & 20 deletions apps/roam/src/components/settings/AdminPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,13 @@ const FeatureFlagsTab = (): React.ReactElement => {
const [pendingFeatureKey, setPendingFeatureKey] = useState<
keyof FeatureFlags | null
>(null);
const [duplicateNodeAlertValue, setDuplicateNodeAlertValue] = useState(
getFeatureFlag("Duplicate node alert enabled"),
);
const [suggestiveOverlayValue, setSuggestiveOverlayValue] = useState(
getFeatureFlag("Suggestive mode overlay enabled"),
);
const [advancedNodeSearchValue, setAdvancedNodeSearchValue] = useState(
getFeatureFlag("Advanced node search enabled"),
);
const syncAlreadyEnabled = duplicateNodeAlertValue || suggestiveOverlayValue;
const syncAlreadyEnabled = suggestiveOverlayValue;

const ensureSyncEnabled = (
featureKey: keyof FeatureFlags,
Expand Down Expand Up @@ -338,17 +335,6 @@ const FeatureFlagsTab = (): React.ReactElement => {

return (
<div className="flex flex-col gap-4 p-4">
<FeatureFlagPanel
title="Duplicate node alert"
description="Show possible duplicate nodes when viewing a discourse node page."
featureKey="Duplicate node alert enabled"
value={duplicateNodeAlertValue}
onBeforeEnable={() => ensureSyncEnabled("Duplicate node alert enabled")}
onAfterChange={(checked) =>
handleFeatureToggled(checked, setDuplicateNodeAlertValue)
}
/>

<FeatureFlagPanel
title="Suggestive mode overlay"
description="Overlay suggestive mode button over discourse node references."
Expand All @@ -375,11 +361,7 @@ const FeatureFlagsTab = (): React.ReactElement => {
onConfirm={() => {
if (pendingFeatureKey) {
setFeatureFlag(pendingFeatureKey, true);
if (pendingFeatureKey === "Duplicate node alert enabled") {
setDuplicateNodeAlertValue(true);
} else if (
pendingFeatureKey === "Suggestive mode overlay enabled"
) {
if (pendingFeatureKey === "Suggestive mode overlay enabled") {
setSuggestiveOverlayValue(true);
}
}
Expand Down
1 change: 0 additions & 1 deletion apps/roam/src/components/settings/utils/accessors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ export const readAllLegacyDiscourseNodeSettings = (
};

export const isSyncEnabled = (): boolean =>
getFeatureFlag("Duplicate node alert enabled") ||
getFeatureFlag("Suggestive mode overlay enabled");

export const setFeatureFlag = (
Expand Down
1 change: 0 additions & 1 deletion apps/roam/src/components/settings/utils/settingKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type {

export const FEATURE_FLAG_KEYS = {
enableLeftSidebar: "Enable left sidebar",
duplicateNodeAlertEnabled: "Duplicate node alert enabled",
suggestiveModeOverlayEnabled: "Suggestive mode overlay enabled",
useNewSettingsStore: "Use new settings store",
} as const satisfies Record<string, keyof FeatureFlags>;
Comment thread
sid597 marked this conversation as resolved.
Expand Down
2 changes: 0 additions & 2 deletions apps/roam/src/components/settings/utils/zodSchema.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,13 @@ const discourseNodeSettings: DiscourseNodeSettings = {
const featureFlags: FeatureFlags = {
"Advanced node search enabled": true,
"Enable left sidebar": true,
"Duplicate node alert enabled": true,
"Suggestive mode overlay enabled": true,
"Use new settings store": false,
};

const defaultFeatureFlags: FeatureFlags = {
"Advanced node search enabled": false,
"Enable left sidebar": false,
"Duplicate node alert enabled": false,
"Suggestive mode overlay enabled": false,
"Use new settings store": false,
};
Expand Down
1 change: 0 additions & 1 deletion apps/roam/src/components/settings/utils/zodSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ export const DiscourseRelationSchema = z.object({
export const FeatureFlagsSchema = z.object({
"Advanced node search enabled": z.boolean().default(false),
"Enable left sidebar": z.boolean().default(false),
"Duplicate node alert enabled": z.boolean().default(false),
"Suggestive mode overlay enabled": z.boolean().default(false),
"Use new settings store": z.boolean().default(false),
});
Expand Down
61 changes: 0 additions & 61 deletions apps/roam/src/utils/hyde.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getLoggedInClient, getSupabaseContext } from "./supabaseContext";
import { Result } from "./types";
import normalizePageTitle from "roamjs-components/queries/normalizePageTitle";
import { render as renderToast } from "roamjs-components/components/Toast";
import findDiscourseNode from "./findDiscourseNode";
import { nextApiRoot } from "@repo/utils/execContext";
import { DiscourseNode } from "./getDiscourseNodes";
Expand Down Expand Up @@ -513,63 +512,3 @@ export const performHydeSearch = async ({
}
return [];
};

export type VectorMatch = {
node: Result;
score: number;
};

export const findSimilarNodesVectorOnly = async ({
text,
threshold = 0.4,
limit = 15,
}: {
text: string;
threshold?: number;
limit?: number;
}): Promise<VectorMatch[]> => {
if (!text.trim()) {
return [];
}

try {
const supabase = await getLoggedInClient();
if (!supabase) return [];

const queryEmbedding = await createEmbedding(text);

const { data, error } = await supabase
.rpc("match_content_embeddings", {
query_embedding: JSON.stringify(queryEmbedding),
match_threshold: threshold,
})
.limit(limit);

if (error) {
console.error("Vector search failed:", error);
throw error;
}

if (!data || !Array.isArray(data)) return [];

const results: VectorMatch[] = data.map((item) => ({
node: {
uid: item.roam_uid,
text: item.text_content,
},
score: item.similarity,
}));

return results;
} catch (error) {
console.error("Error in vector-only similar nodes search:", error);
renderToast({
content: `Error in vector-only similar nodes search: ${
error instanceof Error ? error.message : String(error)
}`,
intent: "danger",
id: "vector-search-error",
});
return [];
}
};
7 changes: 0 additions & 7 deletions apps/roam/src/utils/initializeObserversAndListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import { renderImageToolsMenu } from "./renderImageToolsMenu";
import { mountLeftSidebar } from "~/components/LeftSidebarView";
import { getCleanTagText } from "~/components/settings/NodeConfig";
import { getNodeTagStyles } from "~/utils/getDiscourseNodeColors";
import { renderPossibleDuplicates } from "~/components/VectorDuplicateMatches";
import { renderPublishNodeTitleButton } from "~/components/PublishNodeTitleButton";
import { renderCanvasEmbed } from "~/components/canvas/CanvasEmbed";
import getPageUidByPageTitle from "roamjs-components/queries/getPageUidByPageTitle";
Expand Down Expand Up @@ -125,7 +124,6 @@ export const initObservers = ({
const isDiscourseNode = node && node.backedBy !== "default";
if (isDiscourseNode) {
const syncEnabled =
settings.featureFlags[FEATURE_FLAG_KEYS.duplicateNodeAlertEnabled] ||
settings.featureFlags[FEATURE_FLAG_KEYS.suggestiveModeOverlayEnabled];
if (syncEnabled && node.backedBy === "user") {
renderPublishNodeTitleButton({
Expand All @@ -138,11 +136,6 @@ export const initObservers = ({
if (settings.personalSettings[PERSONAL_KEYS.discourseContextOverlay]) {
renderDiscourseContext({ h1, uid });
}
if (
settings.featureFlags[FEATURE_FLAG_KEYS.duplicateNodeAlertEnabled]
) {
renderPossibleDuplicates(h1, title, node);
}
const linkedReferencesDiv = document.querySelector(
".rm-reference-main",
) as HTMLDivElement;
Expand Down