File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,10 +196,10 @@ export const AddKnowledgeModal: React.FC<AddKnowledgeModalProps> = ({
196196
197197 { formData . metadata && formData . metadata . length > 0 ? (
198198 < div className = "space-y-2" >
199- { formData . metadata . map ( ( { key, value } ) => {
199+ { formData . metadata . map ( ( { key, value } , index ) => {
200200 const suggestedValues = getSuggestedValues ( key )
201201 return (
202- < div key = { key } className = "flex gap-2 items-center" >
202+ < div key = { `metadata- key- ${ index } ` } className = "flex gap-2 items-center" >
203203 < Input
204204 value = { key }
205205 onChange = { ( e ) => {
@@ -222,6 +222,7 @@ export const AddKnowledgeModal: React.FC<AddKnowledgeModalProps> = ({
222222 }
223223 return { ...prev , metadata : newMetadata }
224224 } )
225+ e . target . focus ( )
225226 } }
226227 placeholder = "Key"
227228 className = "w-32 h-8 text-sm"
Original file line number Diff line number Diff line change @@ -469,7 +469,7 @@ export default function ToolbarPlugin() {
469469 ) ) }
470470 </ DropdownMenuContent >
471471 </ DropdownMenu >
472- < DropdownMenu >
472+ { /* <DropdownMenu>
473473 <DropdownMenuTrigger className="flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs">
474474 <Plus width={15} height={15} />
475475 <ChevronDown width={15} height={15} />
@@ -487,7 +487,7 @@ export default function ToolbarPlugin() {
487487 </DropdownMenuItem>
488488 ))}
489489 </DropdownMenuContent>
490- </ DropdownMenu >
490+ </DropdownMenu> */ }
491491 { /* {imageDialogOpen && (
492492 <InsertInlineImageDialog
493493 activeEditor={editor}
Original file line number Diff line number Diff line change @@ -104,8 +104,7 @@ export function DocumentEdit({
104104 }
105105
106106 const handleAddMetadataField = ( ) => {
107- const newKey = `field_${ Date . now ( ) } `
108- handleMetadataChange ( newKey , '' )
107+ handleMetadataChange ( '' , '' )
109108 }
110109
111110 const handleRemoveMetadataField = ( key : string ) => {
@@ -200,14 +199,15 @@ export function DocumentEdit({
200199
201200 { editedDocument . metadata && Object . keys ( editedDocument . metadata ) . length > 0 ? (
202201 < div className = "space-y-2" >
203- { Object . entries ( editedDocument . metadata ) . map ( ( [ key , value ] ) => {
202+ { Object . entries ( editedDocument . metadata ) . map ( ( [ key , value ] , index ) => {
204203 const suggestedValues = getSuggestedValues ( key )
205204 return (
206- < div key = { key } className = "flex gap-2 items-center" >
205+ < div key = { `metadata- key- ${ index } ` } className = "flex gap-2 items-center" >
207206 < Input
208207 value = { key }
209208 onChange = { ( e ) => {
210- const newKey = e . target . value
209+ const newKey = e . target . value || ''
210+
211211 const oldValue = editedDocument . metadata ?. [ key ]
212212 setEditedDocument ( ( prev ) => {
213213 const newMetadata = { ...prev . metadata }
You can’t perform that action at this time.
0 commit comments