onairos 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,30 +18,45 @@ npm install onairos
18
18
  First create the Request Object which Users will Authorize (or not) in the extension popup
19
19
  ```json
20
20
  "RequestObject":{
21
- "interestModel": {
22
- "title":"Interest",
21
+ "Small": {
22
+ "type":"Personality",
23
23
  "descriptions":"Insight into your Interests",
24
24
  "reward":"10% Discount"
25
25
  },
26
- "personalityModel":{
27
- "title":"Personality",
26
+ "Medium":{
27
+ "type":"Personality",
28
28
  "descriptions":"Insight into your Interests",
29
29
  "reward":"2 USDC"
30
30
  },
31
- "intelectModel":{
32
- "title":"Intellect",
31
+ "Large":{
32
+ "type":"Personality",
33
33
  "descriptions":"Insight into your Interests",
34
34
  "reward":"2 USDC"
35
35
  }
36
36
  }
37
37
 
38
38
  ```
39
- Only the personalityModel request object is valid at this time
39
+ RequestObject.size key:
40
+ - `Small` - Upto 16 inference items
41
+ - `Medium` - Upto 32 inference items
42
+ - `Large` - Upto 64 inference items
40
43
 
41
- Then instantiate the Onairos object from the Onairos package - passing in your Onairos Developer ID and your Request Object
42
- ```jsx
43
- <Onairos sendData={sendData} onairosID={onairosID} />
44
- ```
44
+ Individual Request Information:
45
+ - `type`: Only the Personality key is valid at this time (represents the users Onairos Personality)
46
+ - `description`: Description to display to users about your request
47
+ - `reward`: Reward Given to User for granting Data Request
48
+
49
+ Then instantiate the Onairos object from the Onairos package - passing in your Onairos Developer ID and your Request Object
50
+ ```jsx
51
+ <Onairos requestData={requestData} onairosID={onairosID} access_token={access_token} webpageName={webpageName} proofMode={proofMode} />
52
+ ```
53
+
54
+ Onairos Object fields:
55
+ - `requestData` - Request Object - Json
56
+ - `onairosID` - App Assigned Onairos ID - String
57
+ - `access_token` - App Assigned Access Token - String
58
+ - `webpageName` - App Display Name - String
59
+ - `proofMode` - Wish to recieve ZK proof after recieving Data , default FALSE - boolean
45
60
 
46
61
  That is all for the initial setup
47
62
 
@@ -54,6 +69,22 @@ event.data.source === 'content-script'
54
69
  event.data.type === 'API_URL_RESPONSE'
55
70
  ```
56
71
 
72
+ For example:
73
+
74
+ ``` jsx
75
+ export default async function UseAPIURL(event){
76
+ if (event.data && event.data.source === 'content-script' && event.data.type === 'API_URL_RESPONSE') {
77
+ //Fetch Onairos Data from Returned API url
78
+ }
79
+ }
80
+ useEffect(() => {
81
+ window.addEventListener('message', UseAPIURL);
82
+ return () => {
83
+ window.removeEventListener('message', UseAPIURL);
84
+ };
85
+ }, []);
86
+ ```
87
+
57
88
  ## Using the Inference API
58
89
 
59
90
  The Inference API provides a machine learning model that can generate predictions based on the provided data. This documentation will guide you on how to properly format your input for the API and interpret the results received from the API.
@@ -62,9 +93,9 @@ The Inference API provides a machine learning model that can generate prediction
62
93
 
63
94
  Send a POST request to the API endpoint with a JSON payload containing a set of entries for prediction. Each entry should include the following information:
64
95
 
65
- - `title`: The title of the content (String).
66
- - `category`: The category to which the content belongs (String).
67
- - `img_url`: The URL of an image associated with the content (String).
96
+ - `text`: The text input for the inference result (String) - required
97
+ - `category`: The category to which the content belongs (String) - required
98
+ - `img_url`: The URL of an image associated with the content (String) - optional
68
99
 
69
100
  Example JSON body for the POST request:
70
101
 
@@ -72,17 +103,17 @@ Example JSON body for the POST request:
72
103
 
73
104
  "Input": {
74
105
  "input1": {
75
- "title": "Example Title 1",
106
+ "text": "Example text input 1",
76
107
  "category": "Example Category 1",
77
108
  "img_url": "http://example.com/image1.jpg"
78
109
  },
79
110
  "input2": {
80
- "title": "Example Title 2",
111
+ "text": "Example text input 2",
81
112
  "category": "Example Category 2",
82
113
  "img_url": "http://example.com/image2.jpg"
83
114
  },
84
115
  "input3": {
85
- "title": "Example Title 3",
116
+ "text": "Example text input 3",
86
117
  "category": "Example Category 3",
87
118
  "img_url": "http://example.com/image3.jpg"
88
119
  }
@@ -110,6 +141,7 @@ export default async function UseAPIURL(event){
110
141
  .catch(error => console.error(error));
111
142
 
112
143
  }}
144
+
113
145
  ```
114
146
 
115
147
  ### 6. Output Format
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onairos",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "dependencies": {
5
5
  "@testing-library/jest-dom": "^5.17.0",
6
6
  "@testing-library/react": "^13.4.0",
package/src/onairos.jsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import onairosLogo from "./OnairosBlack.png";
3
3
 
4
- function Onairos( {sendData, onairosID, access_token}) {
4
+ function Onairos( {requestData, onairosID, access_token, proofMode=false,webpageName}) {
5
5
  const OnairosAnime = async () => {
6
6
  try {
7
7
  console.log("Clicked Onairos Connect")
@@ -19,11 +19,12 @@ function Onairos( {sendData, onairosID, access_token}) {
19
19
  window.postMessage({
20
20
  source: 'webpage',
21
21
  type: 'GET_API_URL',
22
- webpage: 'proxy book store',
22
+ webpageName: webpageName,
23
23
  onairosID:onairosID,
24
24
  access_token:access_token,
25
25
  account:"ConnectedAccountRef.current", //No Longer needed, REMOVE
26
- requestData: sendData,
26
+ requestData: requestData,
27
+ proofMode:proofMode
27
28
  });
28
29
  };
29
30