-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
82 lines (67 loc) · 2.61 KB
/
main.js
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import PromptManager from './PromptManager.js';
// feedback constants
const GOOD = 1;
const BAD = -1;
const NORMAL = 0;
// init a prompt manager
const manager = new PromptManager();
manager.showAll();
// add some default interactions
manager.addInteraction({prompt: 'this is my first prompt', response: 'this is my first response', feedback: GOOD});
manager.addInteraction({prompt: 'second prompt', response: 'second response', feedback: NORMAL});
manager.addInteraction({prompt: 'default prompt!', response: 'default response!', feedback: BAD});
manager.addInteraction({prompt: 'Daniel\'s prompt', response: 'Daniel\'s response', feedback: GOOD});
manager.addInteraction({prompt: 'A secret prompt', response: 'A public response', feedback: NORMAL});
// get the number of interactions
console.log(manager.getCount());
manager.showAll();
// remove an interaction
// invalid input
manager.show(6);
// remove interaction 1
manager.show(1);
manager.remove(1);
console.log(manager.getCount());
manager.show(1);
manager.showAll();
// add some Dalle interactions
manager.addDalleInteraction({prompt: 'this is my first dalle prompt', promptImgUrl: 'myPromptUrl', response: 'this is my first dalle response', responseImgUrl: 'myResponseUrl', feedback: NORMAL});
manager.addDalleInteraction({prompt: 'A dalle prompt', promptImgUrl: 'WhatAPromptImg', response: 'A dalle response', responseImgUrl: 'WahtAResponseImg', feedback: GOOD});
// get the number of interactions
console.log(manager.getCount());
manager.showAll();
// add some timestamp interactions
manager.addTimestampInteraction({prompt: 'this is my first timestamp prompt', response: 'this is my first timestamp response', feedback: GOOD});
manager.addTimestampInteraction({prompt: 'Another timestamp prompt', response: 'Another timestamp response', feedback: NORMAL});
manager.showAll();
// show all default interactions
manager.showAllDefault();
// show all dalle interactions
manager.showAllDalle();
// show all timestamp interactions
manager.showAllTimestamp();
// test getType() function
console.log(manager.getType(0));
console.log(manager.getType(5));
console.log(manager.getType(7));
// test isDalle() function
console.log(manager.isDalle(1));
console.log(manager.isDalle(4));
console.log(manager.isDalle(6));
// test show() function and remove a dalle interaction
manager.show(5);
manager.remove(5);
manager.showAllDalle();
// test invalid input
manager.remove(7);
manager.show(-1);
manager.setFeedback(9);
manager.getType(10);
// remove all the interactions
manager.removeAll();
manager.showAll();
// test invalid input
manager.remove(7);
manager.show(-1);
manager.setFeedback(9);
manager.getType(10);