forked from SugarcaneDefender/z-waif
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanual how to.txt
218 lines (172 loc) · 5.36 KB
/
manual how to.txt
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# Project Documentation
## Overview
This project is an interactive AI system that utilizes advanced memory management, emotion recognition, and adaptive learning to provide personalized user interactions. The system is designed to handle various functionalities, including chat history management, dynamic personality shaping, and voice tone mapping.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [API Endpoints](#api-endpoints)
- [Learn Message](#learn-message)
- [Generate Response](#generate-response)
- [Add Personality Template](#add-personality-template)
- [Get Personality Template](#get-personality-template)
- [User Profile](#user-profile)
- [Feedback](#feedback)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)
## Installation
To set up the project, follow these steps:
1. **Clone the repository**:
```bash
git clone https://github.com/YourUsername/YourRepository.git
cd YourRepository
```
2. **Create a virtual environment**:
```bash
python -m venv venv
```
3. **Activate the virtual environment**:
- On Windows:
```bash
venv\Scripts\activate
```
- On macOS/Linux:
```bash
source venv/bin/activate
```
4. **Install dependencies**:
```bash
pip install -r requirements.txt
```
5. **Run the application**:
```bash
python main.py
```
## Usage
Once the application is running, you can interact with it through the provided API endpoints.
## API Endpoints
### Learn Message
- **Endpoint**: `/learn`
- **Method**: `POST`
- **Description**: Learn a new message and store its associated sentiment and emotion.
- **Request Body**:
```json
{
"message": "Hello, how are you?",
"sentiment": 0.5,
"emotion": "happy",
"user_id": "user123",
"context": "greeting"
}
```
### Generate Response
- **Endpoint**: `/generate_response`
- **Method**: `POST`
- **Description**: Generate a personalized response based on the user profile and message context.
- **Request Body**:
```json
{
"user_id": "user123",
"message": "What can you do?"
}
```
### Add Personality Template
- **Endpoint**: `/add_template`
- **Method**: `POST`
- **Description**: Add a new personality template for the AI.
- **Request Body**:
```json
{
"name": "Friendly",
"template": "Hello! How can I assist you today?"
}
```
### Get Personality Template
- **Endpoint**: `/get_template/<name>`
- **Method**: `GET`
- **Description**: Retrieve a personality template by name.
- **Response**:
```json
{
"template": "Hello! How can I assist you today?"
}
```
### User Profile
- **Endpoint**: `/user_profile/<user_id>`
- **Method**: `GET`
- **Description**: Retrieve the user profile by user ID.
- **Response**:
```json
{
"profile": {
"personality": "Friendly",
"preferences": {}
}
}
```
### Feedback
- **Endpoint**: `/feedback`
- **Method**: `POST`
- **Description**: Provide feedback to adjust the user's personality.
- **Request Body**:
```json
{
"user_id": "user123",
"feedback": "positive"
}
```
## Examples
### Learning a Message
To learn a message, send a POST request to `/learn` with the message data.
### Generating a Response
To generate a response, send a POST request to `/generate_response` with the user ID and message.
### Adding a Personality Template
To add a personality template, send a POST request to `/add_template` with the template data.
## Manual Commands
### Running the Application
1. **Start the Application**:
After setting up the environment and installing dependencies, run the application using:
```bash
python main.py
```
2. **Interact with the API**:
You can use tools like `curl`, Postman, or any HTTP client to interact with the API endpoints. Here are some example commands using `curl`:
- **Learn a Message**:
```bash
curl -X POST http://localhost:5000/learn -H "Content-Type: application/json" -d '{
"message": "Hello, how are you?",
"sentiment": 0.5,
"emotion": "happy",
"user_id": "user123",
"context": "greeting"
}'
```
- **Generate a Response**:
```bash
curl -X POST http://localhost:5000/generate_response -H "Content-Type: application/json" -d '{
"user_id": "user123",
"message": "What can you do?"
}'
```
- **Add a Personality Template**:
```bash
curl -X POST http://localhost:5000/add_template -H "Content-Type: application/json" -d '{
"name": "Friendly",
"template": "Hello! How can I assist you today?"
}'
```
- **Get User Profile**:
```bash
curl -X GET http://localhost:5000/user_profile/user123
```
- **Provide Feedback**:
```bash
curl -X POST http://localhost:5000/feedback -H "Content-Type: application/json" -d '{
"user_id": "user123",
"feedback": "positive"
}'
```
## Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.
## License
This project is licensed under the MIT License. See the LICENSE file for more details.