ai-ebm-assistant-v4 0.0.1 → 0.0.3
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
|
@@ -1 +1,141 @@
|
|
|
1
|
-
#
|
|
1
|
+
# emb-ai
|
|
2
|
+
|
|
3
|
+
## Project Description
|
|
4
|
+
This project appears to be a web application, likely built with Preact and Vite, featuring an AI Assistant component. It includes custom component generation templates using Plop.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
### Prerequisites
|
|
9
|
+
- Node.js (v14 or higher recommended)
|
|
10
|
+
- npm or yarn
|
|
11
|
+
|
|
12
|
+
### Installation
|
|
13
|
+
|
|
14
|
+
1. Clone the repository:
|
|
15
|
+
```bash
|
|
16
|
+
git clone <repository_url>
|
|
17
|
+
cd emb-ai
|
|
18
|
+
```
|
|
19
|
+
2. Install dependencies:
|
|
20
|
+
```bash
|
|
21
|
+
npm install
|
|
22
|
+
# or yarn install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Available Scripts
|
|
26
|
+
|
|
27
|
+
In the project directory, you can run:
|
|
28
|
+
|
|
29
|
+
### `npm run dev`
|
|
30
|
+
Runs the app in development mode.
|
|
31
|
+
Open [http://localhost:5173](http://localhost:5173) to view it in the browser.
|
|
32
|
+
|
|
33
|
+
The page will reload if you make edits.
|
|
34
|
+
You will also see any lint errors in the console.
|
|
35
|
+
|
|
36
|
+
### `npm run build`
|
|
37
|
+
Builds the app for production to the `dist` folder.
|
|
38
|
+
It correctly bundles Preact in production mode and optimizes the build for the best performance.
|
|
39
|
+
|
|
40
|
+
The build is minified and the filenames include the hashes.
|
|
41
|
+
Your app is ready to be deployed!
|
|
42
|
+
|
|
43
|
+
### `npm run preview`
|
|
44
|
+
Locally previews the production build.
|
|
45
|
+
|
|
46
|
+
### `npm run generate`
|
|
47
|
+
Runs Plop to generate new components or atoms based on templates.
|
|
48
|
+
|
|
49
|
+
## Technologies Used
|
|
50
|
+
|
|
51
|
+
- **Preact**: A fast 3.5kB alternative to React with the same ES6 API.
|
|
52
|
+
- **Vite**: A next-generation frontend tooling that provides an extremely fast development experience.
|
|
53
|
+
- **Axios**: Promise-based HTTP client for the browser and Node.js.
|
|
54
|
+
- **Plop**: A micro-generator framework that makes it easy to create new components, modules, or any other repetitive code.
|
|
55
|
+
- **Node.js**: JavaScript runtime environment.
|
|
56
|
+
- **npm / Yarn**: Package managers for JavaScript.
|
|
57
|
+
|
|
58
|
+
## Publishing to NPM
|
|
59
|
+
|
|
60
|
+
This project's components are designed to be published as an NPM package. There are two primary ways to publish updates:
|
|
61
|
+
|
|
62
|
+
### Manual Publishing
|
|
63
|
+
|
|
64
|
+
Follow these steps for a manual publishing process:
|
|
65
|
+
|
|
66
|
+
1. **Build and Commit**: First, build the library and commit your changes.
|
|
67
|
+
```bash
|
|
68
|
+
npm run build
|
|
69
|
+
git add .
|
|
70
|
+
git commit -m 'Your descriptive commit message'
|
|
71
|
+
```
|
|
72
|
+
2. **Update Version**: Increment the package version using one of the following commands:
|
|
73
|
+
- `npm version patch`: For bug fixes.
|
|
74
|
+
- `npm version minor`: For a new component addition.
|
|
75
|
+
- `npm version major`: For a completed feature.
|
|
76
|
+
3. **NPM Login**: Log in to your NPM account (if not already logged in).
|
|
77
|
+
```bash
|
|
78
|
+
npm login
|
|
79
|
+
```
|
|
80
|
+
4. **Publish**: Publish the package to NPM.
|
|
81
|
+
```bash
|
|
82
|
+
npm publish --access public
|
|
83
|
+
```
|
|
84
|
+
5. **Verify**: Check the version update on the NPM website after publishing.
|
|
85
|
+
|
|
86
|
+
### Automated Publishing with `publish.sh`
|
|
87
|
+
|
|
88
|
+
To automate the publishing process, you can use the provided `publish.sh` script. Follow these steps:
|
|
89
|
+
|
|
90
|
+
1. **Set NPM Credentials (Securely!)**: Before running the script, ensure your NPM username, password, and email are set as environment variables. **DO NOT hardcode them in the script or commit them to version control.**
|
|
91
|
+
```bash
|
|
92
|
+
export NPM_USERNAME="your_username"
|
|
93
|
+
export NPM_PASSWORD="your_password"
|
|
94
|
+
export NPM_EMAIL="your_email@example.com"
|
|
95
|
+
```
|
|
96
|
+
2. **Run the Publish Script**: Execute the `publish.sh` script. This will:
|
|
97
|
+
- Install npm dependencies.
|
|
98
|
+
- Stage and commit changes (with a default message).
|
|
99
|
+
- Automatically increment the package version (patch).
|
|
100
|
+
- Build the library.
|
|
101
|
+
- Log in to NPM using the provided environment variables.
|
|
102
|
+
- Publish the package to NPM with public access.
|
|
103
|
+
```bash
|
|
104
|
+
./publish.sh
|
|
105
|
+
```
|
|
106
|
+
3. **Verify**: Check the version update on the NPM website after publishing.
|
|
107
|
+
|
|
108
|
+
For more details on manual publishing, refer to the [NPM documentation](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages).
|
|
109
|
+
|
|
110
|
+
## API Structure
|
|
111
|
+
|
|
112
|
+
The project primarily uses `fetch` and `axios` for making API calls. A generic `AxiosCall` utility is available in `src/components/aiAssistant/components/logger/logger.jsx` which can be used for various HTTP methods.
|
|
113
|
+
|
|
114
|
+
- **Read Operations**:
|
|
115
|
+
- Examples like `https://arangodbservice.dev.ainqaplatform.in/api/read_qdmqueries` are used with `POST` requests to fetch data based on specific filters and `queryid`s.
|
|
116
|
+
- Data retrieval often involves passing a `db_name` and a `filter` object in the request body.
|
|
117
|
+
|
|
118
|
+
- **Create, Update, Delete Operations**:
|
|
119
|
+
- While a generic `AxiosCall` exists, explicit examples of dedicated `PUT`, `DELETE`, or `POST` for creation (beyond logging) were not found in the initial scan.
|
|
120
|
+
- It is assumed that new APIs for these operations would leverage the `AxiosCall` utility with appropriate HTTP methods (`POST` for create, `PUT` for update, `DELETE` for delete).
|
|
121
|
+
|
|
122
|
+
- **Pagination**:
|
|
123
|
+
- Current API calls do not explicitly include pagination parameters such as `offset`, `limit`, `page`, or `size`.
|
|
124
|
+
- **Recommendation**: For any API endpoints designed to retrieve a collection of resources ("get all" APIs), it is recommended to implement pagination. A suggested default structure would include `offset` (defaulting to 0) and `limit` (defaulting to 10) parameters to control the number of results returned and the starting point of the collection. The API should also return the `overall count` of items available.
|
|
125
|
+
|
|
126
|
+
## Project Structure (Initial Observations)
|
|
127
|
+
- `src/`: Contains the main application source code.
|
|
128
|
+
- `app.jsx`: Serves as a playground for developing and testing components in isolation before they are packaged for NPM. It's where new components are integrated and demonstrated.
|
|
129
|
+
- `main.jsx`: Main application entry point for the development server.
|
|
130
|
+
- `components/`: Reusable UI components, intended to be part of the published NPM package.
|
|
131
|
+
- `aiAssistant/`: A significant part of the application, likely an AI-powered chat or assistant interface.
|
|
132
|
+
- `atoms/`: Potentially smaller, more granular components or state management entities.
|
|
133
|
+
- `assets/`: Static assets like images or SVGs.
|
|
134
|
+
- `store/`: Suggests state management (e.g., Zustand, Redux, Context API).
|
|
135
|
+
- `plop-templates/`: Templates for generating new code using Plop.
|
|
136
|
+
- `dist/`: Output directory for production builds.
|
|
137
|
+
- `vite.config.js`: Vite configuration file.
|
|
138
|
+
- `package.json`: Project dependencies and scripts.
|
|
139
|
+
|
|
140
|
+
## Vite Library Mode
|
|
141
|
+
This project leverages Vite's library mode (`vite build --watch --mode library`) to build components into a shareable NPM package. This configuration optimizes the output for library consumption, making it easy to integrate these components into other projects. The `app.jsx` serves as a development playground to test these components during their creation.
|