address ts issues

This commit is contained in:
Saatvik Arya 2024-07-24 22:14:15 -07:00
parent 77f7c9b6f1
commit 04e57ccf80
6 changed files with 26 additions and 26 deletions

View file

@ -10,7 +10,7 @@ import { CheckIcon, PlusCircleIcon } from "@heroicons/react/24/outline";
import { motion } from "framer-motion";
import { useEffect, useState } from "react";
import { toast } from "sonner";
import { completeOnboarding, createMemory } from "@repo/web/app/actions/doers";
import { completeOnboarding, createMemory } from "@/app/actions/doers";
import { useRouter } from "next/navigation";
import Logo from "../../../public/logo.svg";
import Image from "next/image";

View file

@ -62,7 +62,9 @@ export function FilterSpaces({
placeholder={selectedSpaces.length ? "" : "Search in Spaces"}
onKeyDown={handleKeyDown}
className="text-white peer placeholder:text-white"
onChangeCapture={(e) => setInput(e.currentTarget.value)}
onChangeCapture={(e: React.ChangeEvent<HTMLInputElement>) =>
setInput(e.target.value)
}
value={input}
/>
</div>

View file

@ -1,12 +1,8 @@
import { getChatHistory } from "@repo/web/app/actions/fetchers";
import { ArrowLongRightIcon } from "@heroicons/react/24/outline";
import { Skeleton } from "@repo/ui/shadcn/skeleton";
import Link from "next/link";
import { memo, useEffect, useState } from "react";
import { motion } from "framer-motion";
import { chatThreads } from "@/server/db/schema";
import { getQuerySuggestions } from "@/app/actions/doers";
import { Button } from "@repo/ui/shadcn/button";
const History = memo(({ setQuery }: { setQuery: (q: string) => void }) => {
const [suggestions, setSuggestions] = useState<string[] | null>(null);

View file

@ -288,7 +288,7 @@ export const createMemory = async (input: {
};
}
let contentId: number | undefined;
let contentId: number;
const response = (await vectorSaveResponse.json()) as {
status: string;
@ -345,6 +345,14 @@ export const createMemory = async (input: {
revalidatePath("/memories");
revalidatePath("/home");
if (!insertResponse[0]?.id) {
return {
success: false,
data: 0,
error: "Something went wrong while saving the document to the database",
};
}
contentId = insertResponse[0]?.id;
} catch (e) {
const error = e as Error;
@ -369,14 +377,6 @@ export const createMemory = async (input: {
};
}
if (!contentId) {
return {
success: false,
data: 0,
error: "Something went wrong while saving the document to the database",
};
}
if (storeToSpaces.length > 0) {
// Adding the many-to-many relationship between content and spaces
const spaceData = await db

View file

@ -52,7 +52,7 @@ const createMemoryFromAPI = async (input: {
};
}
let contentId: number | undefined;
let contentId: number;
const saveToDbUrl =
(input.data.url.split("#supermemory-user-")[0] ?? input.data.url) +
@ -79,7 +79,15 @@ const createMemoryFromAPI = async (input: {
})
.returning({ id: storedContent.id });
contentId = insertResponse[0]?.id;
if (!insertResponse[0]?.id) {
return {
success: false,
data: 0,
error: "Failed to save to database",
};
}
contentId = insertResponse[0].id;
} catch (e) {
const error = e as Error;
console.log("Error: ", error.message);
@ -99,14 +107,6 @@ const createMemoryFromAPI = async (input: {
};
}
if (!contentId) {
return {
success: false,
data: 0,
error: "Failed to save to database",
};
}
if (input.data.spaces.length > 0) {
// Adding the many-to-many relationship between content and spaces
const spaceData = await db

View file

@ -45,7 +45,9 @@ const ComboboxWithCreate: React.FC<ComboboxWithCreateProps> = ({
return (
<Command className={cn("group", className)}>
<CommandInput
onChangeCapture={(e) => setInputValue(e.currentTarget.value)}
onChangeCapture={(e: React.ChangeEvent<HTMLInputElement>) =>
setInputValue(e.currentTarget.value)
}
placeholder={placeholder}
value={inputValue}
/>