Khalil
Khalil
CCConvex Community
Created by Khalil on 7/29/2024 in #support-community
Is there a recommended way to use Convex on "admin mode"
ok that could work, I do lose type-safety tho D:
10 replies
CCConvex Community
Created by Khalil on 7/29/2024 in #support-community
Is there a recommended way to use Convex on "admin mode"
and for internal functions that I would like to trigger from within an app? For example: I have a hono api that queries data or performs mutations, here is where I use the apiKey approach, but feels odd passing this on the body payload
10 replies
CCConvex Community
Created by Khalil on 7/29/2024 in #support-community
Is there a recommended way to use Convex on "admin mode"
or bypassing authorization checks
10 replies
CCConvex Community
Created by Khalil on 7/29/2024 in #support-community
Is there a recommended way to use Convex on "admin mode"
building an admin dashboard for example
10 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
wow that was a fast resolution, thank you!
15 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
It was working some time ago! My guess is that something changed recently
15 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
when I remove the filter, it works, but of course I need that filter to only search based on a chatbot's resources
15 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
// convex/schema.ts

export default defineSchema({
document: defineTable({
text: v.string(),
embeddings: v.array(v.float64()),
metadata: v.object({
chatbotId: v.id("chatbot"),
}),
})
.vectorIndex("byEmbeddings", {
vectorField: "embeddings",
filterFields: ["metadata.chatbotId"],
dimensions: 1024,
})
.index("by_chatbot", ["metadata.chatbotId"])
})
// convex/schema.ts

export default defineSchema({
document: defineTable({
text: v.string(),
embeddings: v.array(v.float64()),
metadata: v.object({
chatbotId: v.id("chatbot"),
}),
})
.vectorIndex("byEmbeddings", {
vectorField: "embeddings",
filterFields: ["metadata.chatbotId"],
dimensions: 1024,
})
.index("by_chatbot", ["metadata.chatbotId"])
})
15 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
// convex/ai.ts

export const search = internalAction({
args: {
query: v.string(),
chatbotId: v.id("chatbot"),
},
handler: async (ctx, args) => {
const embeddings = await cohereClient.embed({
texts: [args.query],
model: DEFAULT_EMBEDDING_MODEL,
inputType: "search_query",
});
const [vector] = embeddings.embeddings as number[][];

const results = await ctx.vectorSearch("document", "byEmbeddings", {
vector,
filter: (q) => q.eq("metadata.chatbotId", args.chatbotId),
limit: 5,
});

return results;
},
});
// convex/ai.ts

export const search = internalAction({
args: {
query: v.string(),
chatbotId: v.id("chatbot"),
},
handler: async (ctx, args) => {
const embeddings = await cohereClient.embed({
texts: [args.query],
model: DEFAULT_EMBEDDING_MODEL,
inputType: "search_query",
});
const [vector] = embeddings.embeddings as number[][];

const results = await ctx.vectorSearch("document", "byEmbeddings", {
vector,
filter: (q) => q.eq("metadata.chatbotId", args.chatbotId),
limit: 5,
});

return results;
},
});
15 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
"convex": "^1.13.0",
15 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
this is using the langchain convex integration, also tried with vanilla vectorSearch and no luck
15 replies
CCConvex Community
Created by Khalil on 7/11/2024 in #support-community
vector search stopped working
const results = await vectorStore.similaritySearch(args.query, 5, {
filter: (q) =>
q.eq(
"metadata.chatbotId",
args.chatbotId,
),
});
const results = await vectorStore.similaritySearch(args.query, 5, {
filter: (q) =>
q.eq(
"metadata.chatbotId",
args.chatbotId,
),
});
The results are always empty, I triple made sure that metadata.chatbotId exists for the value I am passing, and again, my code has not changed, this used to work some time ago
15 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
the problem was this:
const ServicesProvider: React.FC<React.PropsWithChildren> = ({ children }) => {
const convex = new ConvexReactClient(env.NEXT_PUBLIC_CONVEX_URL);
const { resolvedTheme } = useTheme();
return (
<ClerkProvider
signInFallbackRedirectUrl="/sign-in"
signUpFallbackRedirectUrl="/sign-up"
afterSignOutUrl="/sign-in"
appearance={{
baseTheme: resolvedTheme === "dark" ? darkThemeClerk : undefined,
variables: {
colorPrimary: "hsl(263.4, 70%, 50.4%)",
},
}}
>
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
{children}
</ConvexProviderWithClerk>
</ClerkProvider>
);
};
const ServicesProvider: React.FC<React.PropsWithChildren> = ({ children }) => {
const convex = new ConvexReactClient(env.NEXT_PUBLIC_CONVEX_URL);
const { resolvedTheme } = useTheme();
return (
<ClerkProvider
signInFallbackRedirectUrl="/sign-in"
signUpFallbackRedirectUrl="/sign-up"
afterSignOutUrl="/sign-in"
appearance={{
baseTheme: resolvedTheme === "dark" ? darkThemeClerk : undefined,
variables: {
colorPrimary: "hsl(263.4, 70%, 50.4%)",
},
}}
>
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
{children}
</ConvexProviderWithClerk>
</ClerkProvider>
);
};
The const convex = new ConvexReactClient(env.NEXT_PUBLIC_CONVEX_URL); declaration should be outside of a React component for whatever reason
34 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
now there is another issue, but it seems Clerk related
34 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
managed to fix it!
34 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
is there an example repo using convex + clerk core 2 that I can refer to?
34 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
that <div> matches the /sign-in clerk page
// app/sign-in/[[...sign-in]]/page.tsx
import { SignIn } from "@clerk/nextjs";

export default function Page() {
return (
<div className="flex h-screen w-full items-center justify-center">
<SignIn
path="/sign-in"
signUpUrl="/sign-up"
fallbackRedirectUrl="/projects"
/>
</div>
);
}
// app/sign-in/[[...sign-in]]/page.tsx
import { SignIn } from "@clerk/nextjs";

export default function Page() {
return (
<div className="flex h-screen w-full items-center justify-center">
<SignIn
path="/sign-in"
signUpUrl="/sign-up"
fallbackRedirectUrl="/projects"
/>
</div>
);
}
34 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
that is after signin or signout?
34 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
I did notice that on sign out, the current page is refetched, for whatever reason
34 replies
CCConvex Community
Created by Khalil on 5/14/2024 in #support-community
Convex+Clerk: sign out unhandled runtime error
not sure if that is helpful, I also enable convex debug logs, but could not find anything wrong there
34 replies