Skip to content

Commit e2129a6

Browse files
committed
fix: Checked env
1 parent 8ff04de commit e2129a6

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

examples/studio/conversational-rag/rag-engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ if (isBrowser) {
113113
} else {
114114
console.log(`File found: ${filePath}`);
115115
}
116-
116+
117117
await uploadGetUpdateDelete(filePath, Date.now().toString());
118118
console.log('=== First operation completed ===\n');
119119
await sleep(2000);

src/files/NodeFilesHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ export class NodeFilesHandler extends BaseFilesHandler {
2222
async prepareFormDataRequest(file: FilePathOrFileObject): Promise<FormDataRequest> {
2323
console.log('Preparing form data request for Node.js');
2424
try {
25-
const FormData = await import('form-data').then(m => m.default || m);
25+
const FormData = await import('form-data').then((m) => m.default || m);
2626
console.log('Successfully imported form-data module');
27-
27+
2828
const formData = new FormData();
2929
console.log('Created new FormData instance');
3030

3131
if (typeof file === 'string') {
32-
const fs = await import('fs').then(m => m.default || m);
32+
const fs = await import('fs').then((m) => m.default || m);
3333
if (!fs.existsSync(file)) {
3434
throw new Error(`File not found: ${file}`);
3535
}

src/runtime.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,19 @@ export const isNode =
2424

2525
export function createFetchInstance(): Fetch {
2626
if (isBrowser || isWebWorker) {
27+
console.log('Creating BrowserFetch instance');
2728
return new BrowserFetch();
2829
}
2930

31+
console.log('Creating NodeFetch instance');
3032
return new NodeFetch();
3133
}
3234

3335
export function createFilesHandlerInstance(): BaseFilesHandler {
3436
if (isBrowser || isWebWorker) {
37+
console.log('Creating BrowserFilesHandler instance');
3538
return new BrowserFilesHandler();
3639
}
40+
console.log('Creating NodeFilesHandler instance');
3741
return new NodeFilesHandler();
3842
}

0 commit comments

Comments
 (0)