mehdi-akbari-ai-assistant-free 0.9.6 → 0.9.7
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 +109 -22
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,50 +1,93 @@
|
|
|
1
|
+
|
|
1
2
|
AI Assistant - React Component
|
|
3
|
+
|
|
2
4
|
Author: Mehdi Akbari
|
|
5
|
+
|
|
3
6
|
Gmail: mehdiakbarideveloper@gmail.com
|
|
7
|
+
|
|
4
8
|
Telegram: @MehdiAkbariDev
|
|
9
|
+
|
|
5
10
|

|
|
6
11
|
|
|
12
|
+
|
|
7
13
|

|
|
14
|
+
|
|
8
15
|
⚠️ Note: This project is currently under active development.
|
|
16
|
+
|
|
9
17
|
Features may change, and new updates are being added regularly. Contributions and feedback are welcome!
|
|
18
|
+
|
|
10
19
|
⚠️ توجه: این پروژه در حال حاضر در حال توسعه فعال است.
|
|
20
|
+
|
|
11
21
|
ویژگیها ممکن است تغییر کنند و بهروزرسانیهای جدید به طور مرتب اضافه میشوند. از مشارکت و بازخورد شما استقبال میشود!
|
|
22
|
+
|
|
12
23
|
English
|
|
24
|
+
|
|
13
25
|
A professional, beautiful, and ready-to-use AI chatbot component for your React projects. This package provides a floating, engaging UI, allowing you to easily integrate a smart assistant into your website. It's built with pure CSS, inspired by Tailwind's aesthetics, to ensure it works out-of-the-box in any project without extra configuration.
|
|
26
|
+
|
|
14
27
|

|
|
15
28
|
|
|
16
29
|
(Recommendation: Record a GIF of the component in action and replace this link)
|
|
30
|
+
|
|
17
31
|
✨ Key Features
|
|
32
|
+
|
|
18
33
|
Easy Setup: Just install the package, import the CSS, and drop the component into your app.
|
|
34
|
+
|
|
19
35
|
Floating Action Button (FAB): A floating button with a Lottie animation that opens and closes the chat window, accessible on all pages.
|
|
36
|
+
|
|
20
37
|
Fullscreen Mode: With a single click, the chat window expands to fill the entire screen for an immersive chat experience.
|
|
38
|
+
|
|
21
39
|
Customizable Lottie Animation: Easily replace the default FAB animation with your own Lottie animation.
|
|
40
|
+
|
|
22
41
|
Dynamic Text Input: A textarea that automatically resizes as the user types, perfect for comfortable multi-line messages.
|
|
42
|
+
|
|
23
43
|
CSS Variable Theming: Customize the component's colors and appearance to match your brand by simply overriding CSS variables.
|
|
44
|
+
|
|
24
45
|
Backend Agnostic: The component connects to any API endpoint you provide.
|
|
46
|
+
|
|
25
47
|
🚀 Installation
|
|
48
|
+
|
|
26
49
|
Install the package in your project using npm or yarn:
|
|
50
|
+
|
|
27
51
|
code
|
|
28
52
|
Bash
|
|
53
|
+
download
|
|
54
|
+
content_copy
|
|
55
|
+
expand_less
|
|
29
56
|
npm install mehdi-akbari-ai-assistant-free
|
|
57
|
+
|
|
30
58
|
or
|
|
59
|
+
|
|
31
60
|
code
|
|
32
61
|
Bash
|
|
62
|
+
download
|
|
63
|
+
content_copy
|
|
64
|
+
expand_less
|
|
33
65
|
yarn add mehdi-akbari-ai-assistant-free
|
|
34
66
|
📋 Usage
|
|
35
67
|
Step 1: Import the Styles
|
|
68
|
+
|
|
36
69
|
The most important step is to import the package's CSS file into your main application file. This makes all the necessary styles globally available.
|
|
70
|
+
|
|
37
71
|
In your layout.js/layout.tsx (Next.js) or App.js (Create React App), add the following line:
|
|
72
|
+
|
|
38
73
|
code
|
|
39
74
|
JavaScript
|
|
75
|
+
download
|
|
76
|
+
content_copy
|
|
77
|
+
expand_less
|
|
40
78
|
import 'mehdi-akbari-ai-assistant-free/styles.css';
|
|
41
79
|
Step 2: Use the Component
|
|
80
|
+
|
|
42
81
|
Import the AiAssistant component and place it in your desired page. The only required prop is apiEndpoint.
|
|
82
|
+
|
|
43
83
|
code
|
|
44
84
|
JavaScript
|
|
85
|
+
download
|
|
86
|
+
content_copy
|
|
87
|
+
expand_less
|
|
45
88
|
import { AiAssistant } from "mehdi-akbari-ai-assistant-free/react";
|
|
46
89
|
|
|
47
|
-
export default function HomePage() {
|
|
90
|
+
export default function HomePage() {
|
|
48
91
|
return (
|
|
49
92
|
<div>
|
|
50
93
|
<h1>Welcome to my website</h1>
|
|
@@ -52,7 +95,7 @@ export default function HomePage() {
|
|
|
52
95
|
|
|
53
96
|
<AiAssistant apiEndpoint="/api/chat" />
|
|
54
97
|
</div>
|
|
55
|
-
);
|
|
98
|
+
);
|
|
56
99
|
}
|
|
57
100
|
⚙️ Props (API Reference)
|
|
58
101
|
Prop Type Required Default Description
|
|
@@ -61,60 +104,98 @@ title string No "AI Assistant" The title displayed in the chat window header.
|
|
|
61
104
|
welcomeMessage string No "Hello! How can I help you?" The initial message displayed by the bot when the window opens.
|
|
62
105
|
lottieAnimationData any No A default robot animation The Lottie animation data. Can be a URL (string) or an imported JSON object.
|
|
63
106
|
🎨 Customization (Theming)
|
|
107
|
+
|
|
64
108
|
You can easily customize the component's appearance by overriding the following CSS variables in your project's main CSS file (e.g., globals.css).
|
|
109
|
+
|
|
65
110
|
code
|
|
66
111
|
CSS
|
|
112
|
+
download
|
|
113
|
+
content_copy
|
|
114
|
+
expand_less
|
|
67
115
|
:root {
|
|
68
|
-
--ai-primary: #007BFF;
|
|
69
|
-
--ai-primary-fg: #FFFFFF;
|
|
116
|
+
--ai-primary: #007BFF; /* Primary color (e.g., blue) */
|
|
117
|
+
--ai-primary-fg: #FFFFFF; /* Text color on primary background (e.g., white) */
|
|
70
118
|
|
|
71
|
-
--ai-bg: #FFFFFF;
|
|
72
|
-
--ai-border: #DDDDDD;
|
|
119
|
+
--ai-bg: #FFFFFF; /* Main background of the chat window */
|
|
120
|
+
--ai-border: #DDDDDD; /* Border color */
|
|
73
121
|
|
|
74
|
-
--ai-text: #333333;
|
|
75
|
-
--ai-text-secondary: #777777;
|
|
122
|
+
--ai-text: #333333; /* Main text color */
|
|
123
|
+
--ai-text-secondary: #777777; /* Secondary text color (like placeholders) */
|
|
76
124
|
|
|
77
|
-
--ai-bot-bg: #F1F1F1;
|
|
78
|
-
--ai-user-bg: #E1F0FF;
|
|
79
|
-
--ai-user-text: #0052D4;
|
|
125
|
+
--ai-bot-bg: #F1F1F1; /* Bot message bubble background */
|
|
126
|
+
--ai-user-bg: #E1F0FF; /* User message bubble background */
|
|
127
|
+
--ai-user-text: #0052D4; /* User message text color */
|
|
80
128
|
}
|
|
81
129
|
<br>
|
|
130
|
+
|
|
82
131
|
فارسی
|
|
132
|
+
|
|
83
133
|
یک کامپوننت چتبات هوش مصنوعی حرفهای، زیبا و کاملاً آماده برای استفاده در پروژههای React شما. این پکیج با ارائه یک رابط کاربری شناور و جذاب، به شما اجازه میدهد تا به سادگی یک دستیار هوشمند را به وبسایت خود اضافه کنید. این کامپوننت با الهام از زیباییشناسی Tailwind CSS و با استفاده از CSS خالص ساخته شده تا بدون نیاز به هیچگونه تنظیمات اضافی، در هر پروژهای قابل استفاده باشد.
|
|
134
|
+
|
|
84
135
|

|
|
85
136
|
|
|
86
137
|
(توصیه: یک فایل GIF از عملکرد کامپوننت ضبط کرده و این لینک را جایگزین کنید)
|
|
138
|
+
|
|
87
139
|
✨ ویژگیهای کلیدی
|
|
140
|
+
|
|
88
141
|
نصب و استفاده آسان: فقط پکیج را نصب کرده، فایل CSS را وارد کنید و کامپوننت را در برنامه خود قرار دهید.
|
|
142
|
+
|
|
89
143
|
رابط کاربری شناور (FAB): یک دکمه شناور با انیمیشن Lottie که پنجره چت را باز و بسته میکند و در تمام صفحات در دسترس است.
|
|
144
|
+
|
|
90
145
|
حالت تمامصفحه: با یک کلیک، پنجره چت کل صفحه را میپوشاند تا کاربر یک تجربه چت فراگیر داشته باشد.
|
|
146
|
+
|
|
91
147
|
انیمیشن Lottie قابل شخصیسازی: انیمیشن دکمه شناور را به سادگی با انیمیشن Lottie دلخواه خود جایگزین کنید.
|
|
148
|
+
|
|
92
149
|
ورودی متن داینامیک: textarea با قابلیت افزایش خودکار ارتفاع برای نوشتن پیامهای چندخطی راحت.
|
|
150
|
+
|
|
93
151
|
شخصیسازی با متغیرهای CSS: رنگها و ظاهر کامپوننت را به سادگی با override کردن متغیرهای CSS مطابق با برند خود تغییر دهید.
|
|
152
|
+
|
|
94
153
|
مستقل از Backend: کامپوننت به سادگی به هر API Endpointی که شما مشخص کنید، متصل میشود.
|
|
154
|
+
|
|
95
155
|
🚀 نصب
|
|
156
|
+
|
|
96
157
|
برای نصب پکیج، از دستور زیر در پروژه خود استفاده کنید:
|
|
158
|
+
|
|
97
159
|
code
|
|
98
160
|
Bash
|
|
161
|
+
download
|
|
162
|
+
content_copy
|
|
163
|
+
expand_less
|
|
99
164
|
npm install mehdi-akbari-ai-assistant-free
|
|
165
|
+
|
|
100
166
|
یا با استفاده از yarn:
|
|
167
|
+
|
|
101
168
|
code
|
|
102
169
|
Bash
|
|
170
|
+
download
|
|
171
|
+
content_copy
|
|
172
|
+
expand_less
|
|
103
173
|
yarn add mehdi-akbari-ai-assistant-free
|
|
104
174
|
📋 نحوه استفاده
|
|
105
175
|
مرحله ۱: وارد کردن استایلها
|
|
176
|
+
|
|
106
177
|
مهمترین قدم، وارد کردن فایل CSS پکیج در فایل اصلی برنامه شماست. این کار باعث میشود تمام استایلهای لازم در کل پروژه شما در دسترس باشند.
|
|
178
|
+
|
|
107
179
|
در فایل layout.js/layout.tsx (در Next.js) یا App.js (در Create React App)، خط زیر را اضافه کنید:
|
|
180
|
+
|
|
108
181
|
code
|
|
109
182
|
JavaScript
|
|
183
|
+
download
|
|
184
|
+
content_copy
|
|
185
|
+
expand_less
|
|
110
186
|
import 'mehdi-akbari-ai-assistant-free/styles.css';
|
|
111
187
|
مرحله ۲: استفاده از کامپوننت
|
|
188
|
+
|
|
112
189
|
کامپوننت AiAssistant را وارد کرده و آن را در صفحه مورد نظر خود قرار دهید. تنها پراپ ضروری، apiEndpoint است.
|
|
190
|
+
|
|
113
191
|
code
|
|
114
192
|
JavaScript
|
|
193
|
+
download
|
|
194
|
+
content_copy
|
|
195
|
+
expand_less
|
|
115
196
|
import { AiAssistant } from "mehdi-akbari-ai-assistant-free/react";
|
|
116
197
|
|
|
117
|
-
export default function HomePage() {
|
|
198
|
+
export default function HomePage() {
|
|
118
199
|
return (
|
|
119
200
|
<div>
|
|
120
201
|
<h1>به وبسایت من خوش آمدید</h1>
|
|
@@ -122,7 +203,7 @@ export default function HomePage() {
|
|
|
122
203
|
|
|
123
204
|
<AiAssistant apiEndpoint="/api/chat" />
|
|
124
205
|
</div>
|
|
125
|
-
);
|
|
206
|
+
);
|
|
126
207
|
}
|
|
127
208
|
⚙️ پراپها (API Reference)
|
|
128
209
|
پراپ نوع ضروری پیشفرض توضیحات
|
|
@@ -131,22 +212,28 @@ title string خیر "AI Assistant" عنوانی که در هدر پنجره چت
|
|
|
131
212
|
welcomeMessage string خیر "سلام! چطور میتوانم کمکتان کنم؟" اولین پیامی که ربات پس از باز شدن پنجره نمایش میدهد.
|
|
132
213
|
lottieAnimationData any خیر یک انیمیشن ربات پیشفرض دادههای انیمیشن Lottie. میتوانید یک URL (رشته) یا یک آبجکت JSON وارد شده به آن بدهید.
|
|
133
214
|
🎨 شخصیسازی (Theming)
|
|
215
|
+
|
|
134
216
|
شما میتوانید به راحتی ظاهر کامپوننت را با override کردن متغیرهای CSS زیر در فایل CSS اصلی پروژه خود (مانند globals.css)، شخصیسازی کنید.
|
|
217
|
+
|
|
135
218
|
code
|
|
136
219
|
CSS
|
|
220
|
+
download
|
|
221
|
+
content_copy
|
|
222
|
+
expand_less
|
|
137
223
|
:root {
|
|
138
|
-
--ai-primary: #007BFF;
|
|
139
|
-
--ai-primary-fg: #FFFFFF;
|
|
224
|
+
--ai-primary: #007BFF; /* رنگ اصلی (مثلا آبی) */
|
|
225
|
+
--ai-primary-fg: #FFFFFF; /* رنگ متن روی رنگ اصلی (مثلا سفید) */
|
|
140
226
|
|
|
141
|
-
--ai-bg: #FFFFFF;
|
|
142
|
-
--ai-border: #DDDDDD;
|
|
227
|
+
--ai-bg: #FFFFFF; /* پسزمینه اصلی پنجره چت */
|
|
228
|
+
--ai-border: #DDDDDD; /* رنگ حاشیهها */
|
|
143
229
|
|
|
144
|
-
--ai-text: #333333;
|
|
145
|
-
--ai-text-secondary: #777777;
|
|
230
|
+
--ai-text: #333333; /* رنگ متن اصلی */
|
|
231
|
+
--ai-text-secondary: #777777; /* رنگ متن ثانویه (مانند placeholder) */
|
|
146
232
|
|
|
147
|
-
--ai-bot-bg: #F1F1F1;
|
|
148
|
-
--ai-user-bg: #E1F0FF;
|
|
149
|
-
--ai-user-text: #0052D4;
|
|
233
|
+
--ai-bot-bg: #F1F1F1; /* پسزمینه حباب پیام ربات */
|
|
234
|
+
--ai-user-bg: #E1F0FF; /* پسزمینه حباب پیام کاربر */
|
|
235
|
+
--ai-user-text: #0052D4; /* رنگ متن پیام کاربر */
|
|
150
236
|
}
|
|
151
237
|
📜 لایسنس
|
|
238
|
+
|
|
152
239
|
این پروژه تحت لایسنس MIT منتشر شده است. برای اطلاعات بیشتر فایل LICENSE را مطالعه کنید.
|
package/dist/react.js
CHANGED
|
@@ -144,7 +144,7 @@ var ChatWindow = ({
|
|
|
144
144
|
}) => {
|
|
145
145
|
const [messages, setMessages] = (0, import_react3.useState)([]);
|
|
146
146
|
const [isLoading, setIsLoading] = (0, import_react3.useState)(false);
|
|
147
|
-
const version = "0.9.
|
|
147
|
+
const version = "0.9.7";
|
|
148
148
|
(0, import_react3.useEffect)(() => {
|
|
149
149
|
if (welcomeMessage && messages.length === 0) {
|
|
150
150
|
setMessages([{ role: "assistant", content: welcomeMessage }]);
|
package/dist/react.mjs
CHANGED
|
@@ -108,7 +108,7 @@ var ChatWindow = ({
|
|
|
108
108
|
}) => {
|
|
109
109
|
const [messages, setMessages] = useState2([]);
|
|
110
110
|
const [isLoading, setIsLoading] = useState2(false);
|
|
111
|
-
const version = "0.9.
|
|
111
|
+
const version = "0.9.7";
|
|
112
112
|
useEffect3(() => {
|
|
113
113
|
if (welcomeMessage && messages.length === 0) {
|
|
114
114
|
setMessages([{ role: "assistant", content: welcomeMessage }]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mehdi-akbari-ai-assistant-free",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "Professional AI Chatbot Library with self-contained CSS styles",
|
|
5
5
|
"homepage": "https://github.com/MehdiAkbariF/mehdi-akbari-ai-assistant-free#readme",
|
|
6
6
|
"repository": {
|