feat(kb): added tags information to kb docs table#2589
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryAdded 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:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
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
|
| <TableCell className='px-[12px] py-[8px]'> | ||
| <Skeleton className='h-[24px] w-[64px] rounded-md' /> | ||
| </TableCell> | ||
| <TableCell className='px-[12px] py-[8px]'> |
There was a problem hiding this comment.
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]'> |
There was a problem hiding this comment.
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' /> |
There was a problem hiding this comment.
{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> |
There was a problem hiding this comment.
if (isLoading) return
if (!data.length) return
e6c7bd3 to
6b332ee
Compare
|
@greptile |
Summary
Type of Change
Testing
Tested manually
Checklist
Screenshots/Videos