empathai-core 0.2.1 → 0.2.2
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 +30 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,8 +36,19 @@ EmpathAI Core provides **signals**, not decisions.
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Installation
|
|
40
|
+
```bash
|
|
41
|
+
npm install empathai-core
|
|
42
|
+
# or
|
|
43
|
+
pnpm add empathai-core
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
40
47
|
|
|
48
|
+
## Usage Examples
|
|
49
|
+
|
|
50
|
+
### React (Recommended for React Apps)
|
|
51
|
+
```jsx
|
|
41
52
|
import { useEmpathAI } from 'empathai-core/hooks';
|
|
42
53
|
|
|
43
54
|
function App() {
|
|
@@ -56,11 +67,12 @@ function App() {
|
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
export default App;
|
|
70
|
+
```
|
|
59
71
|
|
|
60
72
|
---
|
|
61
73
|
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
### JavaScript (Vanilla JS)
|
|
75
|
+
```javascript
|
|
64
76
|
import { createEmpathAI } from 'empathai-core';
|
|
65
77
|
|
|
66
78
|
const empathAI = createEmpathAI({
|
|
@@ -75,12 +87,14 @@ empathAI.init();
|
|
|
75
87
|
window.addEventListener('beforeunload', () => {
|
|
76
88
|
empathAI.destroy();
|
|
77
89
|
});
|
|
90
|
+
```
|
|
78
91
|
|
|
79
92
|
---
|
|
80
93
|
|
|
81
|
-
|
|
94
|
+
### Java Backend with Web Frontend
|
|
82
95
|
|
|
83
|
-
Frontend (JavaScript)
|
|
96
|
+
**Frontend (JavaScript)**
|
|
97
|
+
```javascript
|
|
84
98
|
import { createEmpathAI } from 'empathai-core';
|
|
85
99
|
|
|
86
100
|
const empathAI = createEmpathAI({
|
|
@@ -94,8 +108,10 @@ const empathAI = createEmpathAI({
|
|
|
94
108
|
});
|
|
95
109
|
|
|
96
110
|
empathAI.init();
|
|
111
|
+
```
|
|
97
112
|
|
|
98
113
|
**Backend (Spring Boot example)**
|
|
114
|
+
```java
|
|
99
115
|
@RestController
|
|
100
116
|
@RequestMapping("/api")
|
|
101
117
|
public class EmotionController {
|
|
@@ -106,12 +122,14 @@ public class EmotionController {
|
|
|
106
122
|
return ResponseEntity.ok().build();
|
|
107
123
|
}
|
|
108
124
|
}
|
|
125
|
+
```
|
|
109
126
|
|
|
110
127
|
---
|
|
111
128
|
|
|
112
|
-
|
|
129
|
+
### Python Backend with Web Frontend
|
|
113
130
|
|
|
114
|
-
Frontend (JavaScript)
|
|
131
|
+
**Frontend (JavaScript)**
|
|
132
|
+
```javascript
|
|
115
133
|
import { createEmpathAI } from 'empathai-core';
|
|
116
134
|
|
|
117
135
|
const empathAI = createEmpathAI({
|
|
@@ -125,8 +143,10 @@ const empathAI = createEmpathAI({
|
|
|
125
143
|
});
|
|
126
144
|
|
|
127
145
|
empathAI.init();
|
|
146
|
+
```
|
|
128
147
|
|
|
129
148
|
**Backend (Flask example)**
|
|
149
|
+
```python
|
|
130
150
|
from flask import Flask, request
|
|
131
151
|
|
|
132
152
|
app = Flask(__name__)
|
|
@@ -136,12 +156,10 @@ def receive_emotion():
|
|
|
136
156
|
data = request.json
|
|
137
157
|
# Process emotion signal
|
|
138
158
|
return "", 200
|
|
159
|
+
```
|
|
139
160
|
|
|
140
161
|
---
|
|
141
162
|
|
|
142
|
-
##
|
|
163
|
+
## License
|
|
143
164
|
|
|
144
|
-
|
|
145
|
-
npm install empathai-core
|
|
146
|
-
# or
|
|
147
|
-
pnpm add empathai-core
|
|
165
|
+
MIT
|