KomaSattarov
KomaSattarov
CCConvex Community
Created by KomaSattarov on 2/28/2024 in #support-community
Langchain + Convex, please...
Hey there beautiful people at convex.dev! I am thinking of implementing an AI functionality to my nextjs typescript app. The convex schema looks like this:
export default defineSchema({ documents: defineTable({ title: v.string(), userId: v.string(), content: v.optional(v.string()), category: v.optional(v.string()), isChecked: v.optional(v.boolean()), trScore: v.optional(v.number()), //Task Response Score ccScore: v.optional(v.number()), //Coherence & cohesion Score lrScore: v.optional(v.number()), //Lexical Resources Score grScore: v.optional(v.number()), //Grammar Range & accuracy Score overallScore: v.optional(v.number()), trScoreFeedback: v.optional(v.string()), ccScoreFeedback: v.optional(v.string()), lrScoreFeedback: v.optional(v.string()), grScoreFeedback: v.optional(v.string()), overallScoreFeedback: v.optional(v.string()), }).index("by_user", ["userId"]), });
I ve already set up an api call to OpenAI to assess the user's written work, create scores and feedback for each scoring criteria, and store those scores. However, I now, want to create a context aware chat functionality that already knows the document's content, the assessment scores, and the feedback for each score. The main idea of this chat function is to allow users to ask questions related to ONLY this document. For example, user may ask "Why my Task Response score was low, and how could I improve it?", and the AI should create a response based on its knowledge of document content, task response score and feedback. I don't know how to do it. Please, guide me, show me the way... I am new to coding, so, detailed guidence would be highly appreciated. Thank you very much!
4 replies
CCConvex Community
Created by KomaSattarov on 12/29/2023 in #support-community
how to display an uploaded image? [beginner]
PLEASE, RESPOND WITH CODE ONLY, no reference to links that would further complicate things for a beginner
12 replies
CCConvex Community
Created by KomaSattarov on 12/23/2023 in #support-community
Manual image uploads on convex dashboard
Hey there everyone! Here's my schema: ItemTable: defineTable({ name: v.string(), category: v.optional(v.string()), questionDesc: v.optional(v.string()), questionType: v.optional(v.string()), chartData: v.optional(v.string()), }), What I am trying to do is to upload a .jpeg / .png file manually from the convex dashboard, and the chartData (see above) should get that image as its value. How can I achieve this? is giving v.string() as hartData's value wrong? How am I going to link the image to chartData on convex dashboard? Please, help!
15 replies
CCConvex Community
Created by KomaSattarov on 12/20/2023 in #support-community
Constantly getting this error and cant get pass by
const topics = useQuery(api.titles.collectTitles); const filteredTopics = useMemo( () => Object.entries(topics).reduce((acc, [key, topic]) => { if ( fields.categories.length > 0 && (!topic.category || !fields.categories.includes(topic.category)) ) { return acc; } if ( fields.questionTypes.length > 0 && !fields.questionTypes.includes(topic.questionType as string) ) { return acc; } if ( fields.search && !topic.name.toLowerCase().includes(fields.search.toLowerCase()) && !topic.questionDesc ?.toString() .toLowerCase() .includes(fields.search.toLowerCase()) ) { return acc; } acc?.push(topic); return acc; }, {} as typeof topics), [fields, topics] ); Type 'undefined' is not assignable to type '{}'.ts(2769) This error is showing up here when the topics is declared Object.entries(topics).reduce
8 replies
CCConvex Community
Created by KomaSattarov on 12/9/2023 in #support-community
What's wrong with the following simple line of code?
Schema: readyTitles: defineTable({ name: v.string(), category: v.optional(v.string()), }).index("by_name", ["name"]), Query: export const collectTitles = query({ handler: async (ctx) => { const titles = await ctx.db .query("readyTitles") .withIndex("by_name") .collect(); return titles; }, }); And, the page.tsx where I want to display all the title names: ... const titles = useQuery(api.titles.collectTitles); // some more code <div className="grid gap-4 space-y-4"> <h3>Essay Titles:</h3> {titles?.map((title) => ( <p key={title._id}>{title.name}</p> ))} </div> I want all the readyTitles to be displayed on page.tsx. I think I followed the docs correctly, but, no result. Just empty space instead of the list of mapped titles. The table data was generated manually using the convex.dev dashboard, and seems like they are all saved, because once i logged off and logged in the data is there. What am i missing? Please, help me solve this small issue. I am new to web dev and still in my learning journey. Thanks beforehand!
4 replies
CCConvex Community
Created by KomaSattarov on 12/5/2023 in #support-community
Occasional onvex error:
Unhandled Runtime Error Error: [CONVEX Q(essays:getByEssayId)] Uncaught Error: Essay not found at handler (../convex/essays.ts:120:4) Called by client I get this error from time to time, not always. It happens when I delete a document.
5 replies
CCConvex Community
Created by KomaSattarov on 11/28/2023 in #support-community
Need help creating and organizing my schema:
Here's is what I am trying to achieve: I am working on app that helps users to improve thier essay writing skills. There are three ways they can create an essay: 1) Blank Essay Page, where they have to manually enter an essay title 2) An essay with an already prepared essay title beforehand, so the user needs to pick one, and start writing its content. The essay also needs to have a list of categories for filtering 3) Similar to 2nd one, but this time, along with the essay title, there is a data chart that is also prepared before hand and also has list of categories like economics, science, tech, and etc. Additionally, all the essay content should be evaluated by an AI and will be assessed based on a sclae of 1-10. Here's how my initial schema looks like: blankEssay: defineTable({ title: v.string(), userId: v.string(), isArchived: v.boolean(), content: v.optional(v.string()), isPublished: v.optional(v.boolean()), score: v.optional(v.number()), }).index("by_user", ["userId"]), chartEssays: defineTable({ title: v.string(), userId: v.string(), isArchived: v.boolean(), content: v.optional(v.string()), isPublished: v.optional(v.boolean()), score: v.optional(v.number()), // additional table for displaying the charts: chartData: v.optional(v.string()), }).index("by_user", ["userId"]), }); It would be great if I could have one table called essays that has a relation to "blankEssays", "selectEssays", chartEssays", and all of these tables had a relationship to "essayCategories" and "score" table. How to achieve that? Please, anyone help...
6 replies