Skip to content

Commit 8b41371

Browse files
committed
fix(knowledge): serve list totals when a request omits the count flag
1 parent 8f3eb3a commit 8b41371

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks
    • lib/api/contracts/knowledge

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-data.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export function useMentionData(props: UseMentionDataProps): MentionDataReturn {
250250
try {
251251
setIsLoadingKnowledge(true)
252252
const result = await requestJson(listKnowledgeBasesContract, {
253-
query: { workspaceId },
253+
query: { workspaceId, includeCounts: false },
254254
})
255255
const items = result.data
256256
const sorted = [...items].sort((a, b) => {

‎apps/sim/lib/api/contracts/knowledge/base.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ export type KnowledgeScope = z.output<typeof knowledgeScopeSchema>
2626
export const listKnowledgeBasesQuerySchema = z.object({
2727
workspaceId: z.string().min(1).optional(),
2828
scope: knowledgeScopeSchema.default('active'),
29-
/** Adds `docCount` and `tokenCount` for the documents the caller can see; costs a document scan. */
30-
includeCounts: booleanQueryFlagSchema.optional().default(false),
29+
/**
30+
* Adds `docCount` and `tokenCount` for the documents the caller can see; costs a document scan.
31+
* Absent means counted: a page loaded before this flag existed requires both totals on every
32+
* row, and current clients always send it.
33+
*/
34+
includeCounts: booleanQueryFlagSchema.optional().default(true),
3135
})
3236

3337
/**

0 commit comments

Comments
 (0)