Skip to content

Commit 18b46a0

Browse files
amirai21asafgardin
authored andcommitted
feat: swap condition
1 parent 585e278 commit 18b46a0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AI21, FileResponse, UploadFileResponse, isNode } from 'ai21';
1+
import { AI21, FileResponse, UploadFileResponse, isBrowser } from 'ai21';
22
import path from 'path';
33

44
function sleep(ms) {
@@ -73,11 +73,10 @@ const fileContent = Buffer.from(
7373
);
7474
const dummyFile = new File([fileContent], 'example.txt', { type: 'text/plain' });
7575

76-
if (isNode) {
76+
if (isBrowser) {
77+
console.log('Cannot run upload examples in Browser environment');
78+
} else {
7779
console.log('Running file upload in Node environment');
7880
uploadGetUpdateDelete(dummyFile, Date.now().toString()).catch(console.error);
7981
listFiles().catch(console.error);
80-
} else {
81-
// TODO - add node support for files
82-
console.log('Cannot run uploads in not Node environment');
8382
}

0 commit comments

Comments
 (0)