-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample2.mjs
More file actions
57 lines (50 loc) · 1.57 KB
/
example2.mjs
File metadata and controls
57 lines (50 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import fs from 'node:fs';
import process from 'node:process';
import repl from 'node:repl';
import {
Weaver,
WalkthroughAndInterview,
LaunchDirector,
MultiVideoChoreographer,
StandardAssets,
BingImageSearchAssetGenerator,
AzureSpeech,
} from './dist/src/index.js';
// eslint-disable-next-line
global.readStory = () => {
const json = fs.readFileSync('./try.json');
return JSON.parse(json);
};
global.saveStory = weaver => {
fs.writeFileSync('./try.json', JSON.stringify(weaver.story, null, 2));
// eslint-disable-next-line
console.log('saved');
};
global.weaver = new Weaver({
openaiApiKey: process.env.OPENAI_API_KEY,
supabaseUrl: 'http://localhost:54321',
supabaseServiceRoleKey:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU',
storageBucket: 'assets',
storagePrefix: 'testuser',
story: global.readStory(),
});
global.content = new WalkthroughAndInterview(
process.env.REPLICATE_API_KEY,
'46f4bf2c-f6d7-4b71-9a13-423ad2c0eadc/user/1677102173347.mkv',
'46f4bf2c-f6d7-4b71-9a13-423ad2c0eadc/user/1677102241403.mkv'
);
global.director = new LaunchDirector();
global.choreographer = new MultiVideoChoreographer();
global.assets = new StandardAssets(
{
image: new BingImageSearchAssetGenerator(process.env.BING_IMAGE_SEARCH_KEY),
},
true
);
global.speech = new AzureSpeech(process.env.AZURE_SPEECH_KEY);
const local = repl.start({ useGlobal: true });
local.on('exit', () => {
// eslint-disable-next-line
process.exit();
});