Skip to content

Commit

Permalink
changes in how we save vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhravya committed Apr 11, 2024
1 parent 628a017 commit f8068a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 141 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ArrowRight, ArrowUp } from "lucide-react";
import { MemoryDrawer } from "./MemoryDrawer";
import useViewport from "@/hooks/useViewport";
import { AnimatePresence, motion } from "framer-motion";
import { cn, countLines } from "@/lib/utils";
import { cn, countLines, getIdsFromSource } from "@/lib/utils";
import { ChatHistory } from "../../types/memory";
import { ChatAnswer, ChatMessage, ChatQuestion } from "./ChatMessage";
import { useRouter, useSearchParams } from "next/navigation";
Expand Down Expand Up @@ -221,7 +221,7 @@ export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) {
...lastMessage,
answer: {
parts: lastMessage.answer.parts,
sources: sourcesInJson.ids ?? [],
sources: getIdsFromSource(sourcesInJson.ids) ?? [],
},
},
];
Expand Down
139 changes: 0 additions & 139 deletions apps/web/src/components/QueryAI.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions apps/web/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export function cleanUrl(url: string) {
: url;
}

export function getIdsFromSource(sourceIds: string[]) {
// This function converts an id from a form of `websiteURL-userID` to just the websiteURL
return sourceIds.map((id) => id.split("-").slice(0, -1).join("-"));
}

export function generateId() {
return Math.random().toString(36).slice(2, 9);
}
Expand Down

0 comments on commit f8068a6

Please sign in to comment.