An App that helps improve user documents.
Env Variables
- create a .env file in the backend directory with the following fields
- HOST=127.0.0.1
- DB_USER=
- DB_PASS=<your_password>
- DB_NAME=document_assistant
- DB_PORT=<db_port>
- JWT_SECRET_KEY=<jwt_secret>
- PORT=8080
- GEMMA_API_KEY=<grab_from_https://ai.google.dev/aistudio>
Running the app
- Install typescript globally
- run npm install in the root directory
- run tsc commad
- run npm run dev to start the dev server or npm start to start the app
- All this should happen at the backend directory
-
Endpoint:
POST /api/users/login
-
Description: Sign up as a User
-
Request Headers: None
-
Request Body
-
username
(String): a unique user string . -
password
(String): Password with at least 8 characters. -
email
(String): a valid email address. -
Sample:
{ "email": "[email protected]", "username":"new_user" "password": "@ValidPassword123" }
-
-
Response
-
Success
- Status: 201 Created
-
-
Endpoint:
POST /api/users/login
-
Request Body
email
: user's emailpassword
: user's password- Sample:
{ "email": "[email protected]", "password": "@ValidPassword123" }
-
Response
- Status: 200 OK
- Body: JSON Object with auth token,
-
Endpoint:
GET /api/users/:id
-
Parameters
id
(number): found in the 'id' field of each user
-
Response
- Status: 200 OK
- Body: JSON object with the found user
-
Endpoint:
GET /api/users/logout
-
Response
- Status: 200 OK
- Body: JSON object with the found user
-
Endpoint:
POST /api/documents/upload
-
Request
-
Body: Multi-type form data with the File
{ "document": "File" }
-
-
Response
-
Status: 201 Created
-
Body: JSON object with the id of the created document and success message
-
Sample:
{ "message": "document saved successfully", "docId": 1 //"id of the interted document " }
-
-
Endpoint:
GET /api/documents/
-
Response
- Status: 200 OK
- Body: JSON object with the all found documents their user details and the content
-
Endpoint:
DELETE /api/documents/:id/
-
Parameters
id
(number): found in the 'id' field of each document entry
-
Response
- Status: 200 OK
-
Endpoint:
POST /api/content/:contId/improve
-
Request
-
Body: json object with content as text,
{ "content": "sample text " }
-
-
Response
- Status: 200 OK
- Body: Output of the model in html transformed from markdown to render on the react quill editor if the user want to edit
-
Endpoint:
POST /api/content/:id
-
Parameters
id
(number): found in the 'id' field of each content entry
-
Request
-
Body: JSON Object with the text as string, the original document id and the original content id
-
Sample:
{ "text": "sample text", //String: required. "document_id": 1 // "id of the document the content wa extracted from " }
-
-
Response
- Status: 200 OK
- Body: success message
-
Endpoint:
DELETE /api/content/:id
-
Parameters
id
(number): found in the 'id' field of each entry
-
Response
- Status: 200 OK
- Body: success message
- Sample:
-
Endpoint:
GET /api/content/original/:id
-
Parameters
-
id
(number): found in the 'id' field of each entry -
Response
- Status: 200 OK
- Body: JSON Object with content
-
Endpoint:
GET /api/content/:id
-
Parameters
id
(number): found in the 'id' field of eachentry
-
Response
- Status: 200 OK
- Body: JSON Object with found entry
- Sample:
-
ENV VARS
- Create an .env file and add
- VITE_API_URL=http://localhost:8080/api
-
Install Dependencies
-
run npm install
-
run npm run dev make sure your backend is running
-
DEMO