Skip to content

Commit 608964a

Browse files
fix(kb-tags): docs page kb tags ui (#838)
* fix(kb-tags): docs page kb tags ui * remove console logs * remove console error
1 parent 5b53cc2 commit 608964a

File tree

2 files changed

+253
-233
lines changed

2 files changed

+253
-233
lines changed

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/upload-modal/upload-modal.tsx

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import { Button } from '@/components/ui/button'
66
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
77
import { Label } from '@/components/ui/label'
88
import { createLogger } from '@/lib/logs/console/logger'
9-
import {
10-
type DocumentTag,
11-
DocumentTagEntry,
12-
} from '@/app/workspace/[workspaceId]/knowledge/components/document-tag-entry/document-tag-entry'
139
import { useKnowledgeUpload } from '@/app/workspace/[workspaceId]/knowledge/hooks/use-knowledge-upload'
1410

1511
const logger = createLogger('UploadModal')
@@ -50,7 +46,7 @@ export function UploadModal({
5046
}: UploadModalProps) {
5147
const fileInputRef = useRef<HTMLInputElement>(null)
5248
const [files, setFiles] = useState<FileWithPreview[]>([])
53-
const [tags, setTags] = useState<DocumentTag[]>([])
49+
5450
const [fileError, setFileError] = useState<string | null>(null)
5551
const [isDragging, setIsDragging] = useState(false)
5652

@@ -66,7 +62,6 @@ export function UploadModal({
6662
if (isUploading) return // Prevent closing during upload
6763

6864
setFiles([])
69-
setTags([])
7065
setFileError(null)
7166
setIsDragging(false)
7267
onOpenChange(false)
@@ -145,23 +140,7 @@ export function UploadModal({
145140
if (files.length === 0) return
146141

147142
try {
148-
// Convert DocumentTag array to TagData format
149-
const tagData: Record<string, string> = {}
150-
tags.forEach((tag) => {
151-
if (tag.value.trim()) {
152-
tagData[tag.slot] = tag.value.trim()
153-
}
154-
})
155-
156-
// Create files with tags for upload
157-
const filesWithTags = files.map((file) => {
158-
// Add tags as custom properties to the file object
159-
const fileWithTags = file as unknown as File & Record<string, string>
160-
Object.assign(fileWithTags, tagData)
161-
return fileWithTags
162-
})
163-
164-
await uploadFiles(filesWithTags, knowledgeBaseId, {
143+
await uploadFiles(files, knowledgeBaseId, {
165144
chunkSize: chunkingConfig?.maxSize || 1024,
166145
minCharactersPerChunk: chunkingConfig?.minSize || 100,
167146
chunkOverlap: chunkingConfig?.overlap || 200,
@@ -180,19 +159,6 @@ export function UploadModal({
180159
</DialogHeader>
181160

182161
<div className='flex-1 space-y-6 overflow-auto'>
183-
{/* Document Tag Entry Section */}
184-
<DocumentTagEntry
185-
tags={tags}
186-
onTagsChange={setTags}
187-
disabled={isUploading}
188-
knowledgeBaseId={knowledgeBaseId}
189-
documentId={null} // No specific document for upload
190-
onSave={async () => {
191-
// For upload modal, tags are saved when document is uploaded
192-
// This is a placeholder as tags will be applied during upload
193-
}}
194-
/>
195-
196162
{/* File Upload Section */}
197163
<div className='space-y-3'>
198164
<Label>Select Files</Label>

0 commit comments

Comments
 (0)