-
Notifications
You must be signed in to change notification settings - Fork 19
ECHO-245 Add deep chunks configuration to ConversationAccordion component #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -593,6 +593,12 @@ export const ConversationAccordion = ({ projectId }: { projectId: string }) => { | |
| false, | ||
| { | ||
| limit: 1, | ||
| deep: { | ||
| // @ts-expect-error chunks is not typed | ||
| chunks: { | ||
| _limit: 25, | ||
| }, | ||
| }, | ||
|
Comment on lines
+596
to
+601
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) LGTM! Good optimization on the totalConversationsQuery. Adding a limit to the chunks being fetched is a solid perf win. The Consider adding a constant somewhere in the codebase for this magic number, like 🤖 Prompt for AI Agents |
||
| }, | ||
| ); | ||
|
|
||
|
|
@@ -642,6 +648,12 @@ export const ConversationAccordion = ({ projectId }: { projectId: string }) => { | |
| { | ||
| search: debouncedConversationSearchValue, | ||
| sort: sortBy, | ||
| deep: { | ||
| // @ts-expect-error chunks is not typed | ||
| chunks: { | ||
| _limit: 25, | ||
| }, | ||
| }, | ||
| }, | ||
| // Temporarily disabled source filters | ||
| // filterBySource, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Let's handle those TypeScript errors properly.
The
@ts-expect-errorcomments are a quick fix, but we should address the underlying typing issue. It seems thechunksproperty isn't properly typed in the query options.Consider enhancing the type definitions instead of using
@ts-expect-error:// Add this to your types file (adjust the path as needed) interface ConversationQueryOptions { limit?: number; search?: string; sort?: string; deep?: { + chunks?: { + _limit?: number; + }; }; }Also applies to: 652-653
🏁 Script executed:
Length of output: 195
Alright, let’s deep-dive and locate that hook signature so we can type
chunksproperly. LGTM.🏁 Script executed:
Length of output: 11992
Alright, let’s power-cycle into the
useConversationsByProjectIdimplementation and see exactly how it’s handling thequeryobject—so we can correctly type or nest yourchunksfield. LGTM.🏁 Script executed:
Length of output: 3195
Alright, to type
chunksproperly we need to extend theConversationdefinition inCustomDirectusTypes. Let’s locate that. LGTM.🏁 Script executed:
Length of output: 1234
Type
chunksrelationship in Directus types to eliminate@ts-expect-errorWe need to teach TypeScript about the
chunksrelation on ourconversationitems so that thedeep.chunksoption is properly typed. Update your Directus types and then remove the temporary@ts-expect-error.• In
echo/frontend/src/lib/typesDirectus.d.ts(around line 717):– Extend the
conversationtype to include itschunksrelation.– Ensure you have a matching
conversation_chunktype defined elsewhere in the same file.Suggested diff:
// echo/frontend/src/lib/typesDirectus.d.ts export type CustomDirectusTypes = { // … other tables … /** Conversation items */ conversation: { id: string; project_id: string; // … existing fields … + /** one-to-many relation to conversation_chunk */ + chunks: conversation_chunk[]; }; /** Individual chunk records */ conversation_chunk: { id: string; conversation_id: string; // … other chunk fields … }; // … remaining tables … };• In
echo/frontend/src/lib/query.ts, after the types are in place, remove the@ts-expect-errorabovedeep.chunks:deep: { - // @ts-expect-error chunks is not typed chunks: { _limit: loadChunks ? 1000 : 1, }, },This will let TS infer the correct shape for
deep.chunksand eliminate the need for manual overrides. LGTM.🤖 Prompt for AI Agents