Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • added tags information to kb docs table, so if a user parses through the docs, they can quickly see what each doc is tagged with without having to click into it

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Screenshot 2025-12-26 at 2 06 18 AM

@vercel
Copy link

vercel bot commented Dec 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 26, 2025 9:47pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 26, 2025

Greptile Summary

Added tags column to the knowledge base documents table to display tag information for each document, improving visibility of document metadata without requiring navigation to individual documents.

Key Changes:

  • Added new Tags column to the documents table with proper responsive design (hidden on smaller screens via adjusted column widths)
  • Implemented getDocumentTags() function to compute and format tag values from document data using tag definitions
  • Integrated useKnowledgeBaseTagDefinitions hook to fetch tag display names and field types
  • Added proper formatting for different tag types (text, number, date, boolean)
  • Displays tags as truncated text with tooltip showing full tag details on hover
  • Refactored status badge display to use the Badge component with proper variants
  • Adjusted responsive column visibility (Size and Tokens now hidden on smaller screens, Chunks visible)
  • Updated table skeleton loading states to match new column structure
  • Simplified uploaded date display to show short format with full details in tooltip

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Well-implemented feature addition that follows established patterns, maintains type safety, and includes proper error handling
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx Added tags column to knowledge base documents table with proper formatting, tooltips, and responsive design changes

Sequence Diagram

sequenceDiagram
    participant User
    participant KnowledgeBase
    participant Hook as useKnowledgeBaseTagDefinitions
    participant API as /api/knowledge/{id}/tag-definitions
    participant getDocumentTags
    participant Table as Documents Table

    User->>KnowledgeBase: View documents table
    KnowledgeBase->>Hook: useKnowledgeBaseTagDefinitions(id)
    Hook->>API: fetch tag definitions
    API-->>Hook: return TagDefinition[]
    Hook-->>KnowledgeBase: tagDefinitions
    
    loop For each document
        KnowledgeBase->>getDocumentTags: getDocumentTags(doc, tagDefinitions)
        getDocumentTags->>getDocumentTags: iterate TAG_SLOTS
        getDocumentTags->>getDocumentTags: format values by fieldType
        getDocumentTags-->>KnowledgeBase: TagValue[]
        KnowledgeBase->>Table: render tags column
        Table-->>User: display truncated tags
    end
    
    User->>Table: hover over tags
    Table-->>User: show tooltip with full tag details
Loading

<TableCell className='px-[12px] py-[8px]'>
<Skeleton className='h-[24px] w-[64px] rounded-md' />
</TableCell>
<TableCell className='px-[12px] py-[8px]'>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function SkeletonCell({
w,
h,
rounded = 'md',
className = '',
}: {
w: string
h: string
rounded?: 'sm' | 'md' | 'full'
className?: string
}) {
const roundedMap = {
sm: 'rounded-[4px]',
md: 'rounded-md',
full: 'rounded-full',
}

return (
<Skeleton
className={${h} ${w} ${roundedMap[rounded]} ${className}}
/>
)
}

<Skeleton className='h-[24px] w-[64px] rounded-md' />
</TableCell>
<TableCell className='px-[12px] py-[8px]'>
<div className='flex items-center gap-[4px]'>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const columns = [
{ key: 'name', width: '180px' },
{ key: 'size', width: '8%' },
{ key: 'tokens', width: '8%' },
{ key: 'chunks', width: '8%', responsive: 'lg' },
...
]

</TableCell>
<TableCell className='px-[12px] py-[8px]'>
<div className='flex items-center gap-[4px]'>
<Skeleton className='h-[18px] w-[40px] rounded-full' />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{columns.map(col => (
<TableCell key={col.key} style={{ width: col.width }}>


))}

<Skeleton className='h-[18px] w-[40px] rounded-full' />
<Skeleton className='h-[18px] w-[40px] rounded-full' />
</div>
</TableCell>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (isLoading) return
if (!data.length) return

@emir-karabeg
Copy link
Collaborator

@greptile

@emir-karabeg emir-karabeg merged commit 7793a6d into staging Dec 26, 2025
11 checks passed
@emir-karabeg emir-karabeg deleted the improvement/kv branch December 26, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants