@@ -2279,23 +2279,23 @@ ${this.researchResults.notes}
22792279 */
22802280 async viewDocument ( documentId ) {
22812281 try {
2282- const document = await this . vectorStore . getDocument ( documentId ) ;
2283- if ( ! document ) {
2282+ const docData = await this . vectorStore . getDocument ( documentId ) ;
2283+ if ( ! docData ) {
22842284 alert ( 'Document not found' ) ;
22852285 return ;
22862286 }
22872287
22882288 // 🆕 Check if this is a generated research document
2289- const isGeneratedResearch = document . metadata ?. type === 'generated_research' ;
2289+ const isGeneratedResearch = docData . metadata ?. type === 'generated_research' ;
22902290
22912291 // Create modal for document viewing
22922292 const modal = document . createElement ( 'div' ) ;
22932293 modal . className = 'document-modal' ;
22942294 modal . style . zIndex = '6000' ;
22952295
22962296 const title = isGeneratedResearch ?
2297- `🔬 Generated Research: ${ document . name } ` :
2298- `📄 Document: ${ document . name } ` ;
2297+ `🔬 Generated Research: ${ docData . name } ` :
2298+ `📄 Document: ${ docData . name } ` ;
22992299
23002300 const metadata = isGeneratedResearch ? `
23012301 <div style="
@@ -2307,12 +2307,12 @@ ${this.researchResults.notes}
23072307 ">
23082308 <h3>🔬 Research Metadata</h3>
23092309 <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 10px;">
2310- <div><strong>Research Type:</strong> ${ document . metadata . researchType } </div>
2311- <div><strong>Depth:</strong> ${ document . metadata . researchDepth } </div>
2312- <div><strong>Topics:</strong> ${ document . metadata . topicsCount } </div>
2313- <div><strong>AI Provider:</strong> ${ document . metadata . aiProvider } </div>
2314- <div><strong>Generated:</strong> ${ new Date ( document . metadata . generatedAt ) . toLocaleDateString ( ) } </div>
2315- <div><strong>Document Integration:</strong> ${ document . metadata . hasDocumentIntegration ? 'Yes' : 'No' } </div>
2310+ <div><strong>Research Type:</strong> ${ docData . metadata . researchType } </div>
2311+ <div><strong>Depth:</strong> ${ docData . metadata . researchDepth } </div>
2312+ <div><strong>Topics:</strong> ${ docData . metadata . topicsCount } </div>
2313+ <div><strong>AI Provider:</strong> ${ docData . metadata . aiProvider } </div>
2314+ <div><strong>Generated:</strong> ${ new Date ( docData . metadata . generatedAt ) . toLocaleDateString ( ) } </div>
2315+ <div><strong>Document Integration:</strong> ${ docData . metadata . hasDocumentIntegration ? 'Yes' : 'No' } </div>
23162316 </div>
23172317 </div>
23182318 ` : `
@@ -2323,10 +2323,10 @@ ${this.researchResults.notes}
23232323 margin-bottom: 20px;
23242324 ">
23252325 <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px;">
2326- <div><strong>Type:</strong> ${ document . type } </div>
2327- <div><strong>Size:</strong> ${ this . formatFileSize ( document . size ) } </div>
2328- <div><strong>Uploaded:</strong> ${ new Date ( document . createdAt ) . toLocaleDateString ( ) } </div>
2329- <div><strong>MIME Type:</strong> ${ document . mimeType || 'Unknown' } </div>
2326+ <div><strong>Type:</strong> ${ docData . type } </div>
2327+ <div><strong>Size:</strong> ${ this . formatFileSize ( docData . size ) } </div>
2328+ <div><strong>Uploaded:</strong> ${ new Date ( docData . createdAt ) . toLocaleDateString ( ) } </div>
2329+ <div><strong>MIME Type:</strong> ${ docData . mimeType || 'Unknown' } </div>
23302330 </div>
23312331 </div>
23322332 ` ;
@@ -2352,7 +2352,7 @@ ${this.researchResults.notes}
23522352 line-height: 1.6;
23532353 color: rgba(255, 255, 255, 0.9);
23542354 ">
2355- ${ document . content }
2355+ ${ docData . content }
23562356 </div>
23572357
23582358 <div style="display: flex; gap: 10px; margin-top: 20px;">
@@ -2383,17 +2383,17 @@ ${this.researchResults.notes}
23832383 */
23842384 async downloadResearchDocument ( documentId ) {
23852385 try {
2386- const document = await this . vectorStore . getDocument ( documentId ) ;
2387- if ( ! document ) {
2386+ const docData = await this . vectorStore . getDocument ( documentId ) ;
2387+ if ( ! docData ) {
23882388 alert ( 'Document not found' ) ;
23892389 return ;
23902390 }
23912391
2392- const blob = new Blob ( [ document . content ] , { type : 'text/markdown' } ) ;
2392+ const blob = new Blob ( [ docData . content ] , { type : 'text/markdown' } ) ;
23932393 const url = URL . createObjectURL ( blob ) ;
23942394 const a = document . createElement ( 'a' ) ;
23952395 a . href = url ;
2396- a . download = document . name ;
2396+ a . download = docData . name ;
23972397 document . body . appendChild ( a ) ;
23982398 a . click ( ) ;
23992399 document . body . removeChild ( a ) ;
@@ -2410,17 +2410,17 @@ ${this.researchResults.notes}
24102410 */
24112411 async downloadDocument ( documentId ) {
24122412 try {
2413- const document = await this . vectorStore . getDocument ( documentId ) ;
2414- if ( ! document ) {
2413+ const docData = await this . vectorStore . getDocument ( documentId ) ;
2414+ if ( ! docData ) {
24152415 alert ( 'Document not found' ) ;
24162416 return ;
24172417 }
24182418
2419- const blob = new Blob ( [ document . content ] , { type : document . mimeType || 'text/plain' } ) ;
2419+ const blob = new Blob ( [ docData . content ] , { type : docData . mimeType || 'text/plain' } ) ;
24202420 const url = URL . createObjectURL ( blob ) ;
24212421 const a = document . createElement ( 'a' ) ;
24222422 a . href = url ;
2423- a . download = document . name ;
2423+ a . download = docData . name ;
24242424 document . body . appendChild ( a ) ;
24252425 a . click ( ) ;
24262426 document . body . removeChild ( a ) ;
0 commit comments