@@ -120,102 +120,18 @@ export const ResourceContent = memo(function ResourceContent({
120120 isSourceMime
121121 )
122122
123- // #region agent log
124- if ( streamingFile ) {
125- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
126- method : 'POST' ,
127- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
128- body : JSON . stringify ( {
129- sessionId : '6f10b0' ,
130- location : 'resource-content.tsx:streaming-context' ,
131- message : 'streaming state' ,
132- data : {
133- resourceId : resource . id ,
134- resourceType : resource . type ,
135- streamOp : streamOperation ,
136- isPatch : isPatchStream ,
137- isWrite : isWriteStream ,
138- isUpdate : isUpdateStream ,
139- hasActiveFileRecord : ! ! activeFileRecord ,
140- hasFetchedContent : ! ! fetchedFileContent ,
141- fetchedContentLen : fetchedFileContent ?. length ,
142- streamingFileContentLen : streamingFile . content . length ,
143- streamingFileName : streamingFile . fileName ,
144- streamingFileMode : isWriteStream ? 'append' : 'replace' ,
145- } ,
146- timestamp : Date . now ( ) ,
147- } ) ,
148- } ) . catch ( ( ) => { } )
149- }
150- // #endregion
151123 const streamingExtractedContent = useMemo ( ( ) => {
152124 if ( ! streamingFile ) return undefined
153125 if ( ! streamOperation ) return undefined
154126
155127 if ( isPatchStream ) {
156- if ( ! fetchedFileContent ) {
157- // #region agent log
158- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
159- method : 'POST' ,
160- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
161- body : JSON . stringify ( {
162- sessionId : '6f10b0' ,
163- location : 'resource-content.tsx:patch-no-fetched' ,
164- message : 'patch but no fetchedFileContent' ,
165- data : { resourceId : resource . id , activeFileRecordId : activeFileRecord ?. id } ,
166- timestamp : Date . now ( ) ,
167- hypothesisId : 'H1' ,
168- } ) ,
169- } ) . catch ( ( ) => { } )
170- // #endregion
171- return undefined
172- }
173- const patchResult = extractPatchPreview ( streamingFile , fetchedFileContent )
174- // #region agent log
175- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
176- method : 'POST' ,
177- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
178- body : JSON . stringify ( {
179- sessionId : '6f10b0' ,
180- location : 'resource-content.tsx:patch-result' ,
181- message : 'extractPatchPreview result' ,
182- data : {
183- hasPatchResult : ! ! patchResult ,
184- patchResultLen : patchResult ?. length ,
185- fetchedLen : fetchedFileContent . length ,
186- contentPreview : streamingFile . content . slice ( 0 , 200 ) ,
187- edit : streamingFile . edit ,
188- } ,
189- timestamp : Date . now ( ) ,
190- hypothesisId : 'H4' ,
191- } ) ,
192- } ) . catch ( ( ) => { } )
193- // #endregion
194- return patchResult
128+ if ( ! fetchedFileContent ) return undefined
129+ return extractPatchPreview ( streamingFile , fetchedFileContent )
195130 }
196131
197132 const extracted = streamingFile . content
198133 if ( extracted . length === 0 ) return undefined
199134
200- // #region agent log
201- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
202- method : 'POST' ,
203- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
204- body : JSON . stringify ( {
205- sessionId : '6f10b0' ,
206- location : 'resource-content.tsx:write-update-content' ,
207- message : 'extracted content for write/update' ,
208- data : {
209- streamOp : streamOperation ,
210- extractedLen : extracted . length ,
211- extractedPreview : extracted . slice ( 0 , 150 ) ,
212- } ,
213- timestamp : Date . now ( ) ,
214- hypothesisId : 'H2' ,
215- } ) ,
216- } ) . catch ( ( ) => { } )
217- // #endregion
218-
219135 if ( isUpdateStream ) return extracted
220136 if ( isWriteStream ) return extracted
221137
0 commit comments