umchat
umchat for run Alise skills or other voice assistants on the website
Run
Install dependencies
npm i umchat
To start a chat, use the UChat component, passing the options necessary for the correct operation
import { UMChat, IAppConfig } from "umchat";
function MyComponent() {
const config: IAppConfig = {
url: "...",
userId: "local_test",
};
return (
<UMChat
config={config}
panelTitle="skill name"
className="UMChat_absolute"
/>
);
}
Run project
npm start
Generate userId
To get the userId, you can use the standard generation method, or use your own solution.
import { getUserId, IAppConfig } from "umchat";
function MyComponent() {
const config: IAppConfig = {
url: "...",
userId: getUserId(),
};
return <UMChat config={config} />;
}
You can pass an argument to the method that takes a boolean value. When passing the value true, the userId is recreated on each page opening, and all data is cleared from the storage. You should not pass this argument in a release application.
Theme
For the component, you can set up themes, for this, pass the "theme" option to the component, with the name of your theme.
And also define a class in which new values for css variables will be specified
.UMChat_themes-@{your_theme} {
--panel_width: inherit;
--panel_height: inherit;
--panel_header_bg: #002d6d;
--panel_header_height: 50px;
--text_color: #333;
--contrast_text_color: #fff;
--unaccented_text_color: #aaa;
--link_text_color: #0260e8;
--link_hover_text_color: #0351c1;
--link_active_text_color: #0043a4;
--font-family: sans-serif;
--font-size-s: 10px;
--font-size-m: 14px;
--font-size-mt: 18px;
--font-size-l: 20px;
--padding-s: 4px;
--padding-st: 6px;
--padding-m: 8px;
--padding-mt: 10px;
--padding-l: 12px;
--border-radius-xs: 2px;
--border-radius-s: 4px;
--border-radius-m: 6px;
--border-radius-l: 8px;
--inline-height-s: 18px;
--inline-height-m: 24px;
--inline-height-l: 40px;
--scrollbar_size: 5px;
--bg: #fff;
--danger_bg: #bc0022;
--unaccented_bg: #f8f8f8;
--unaccented_hover_bg: #eff0f4;
--unaccented_active_bg: #e7e9ec;
--unaccented_border_color: #d4dade;
--unaccented_active_border_color: #8f99a3;
--primary_bg: #f6733c;
--primary_hover_bg: #e4662f;
--primary_active_bg: #d6551f;
--primary_same_hover_bg: #e4662f25;
--primary_same_active_bg: #d6551f40;
--secondary_bg: #265fa1;
--secondary_hover_bg: #2b5688;
--secondary_active_bg: #274c77;
--secondary_same_hover_bg: #2b568825;
--secondary_same_active_bg: #274c7740;
--translucent_dark_bg: rgba(
255,
255,
255,
0.15
);
--translucent_hover_dark_bg: rgba(
255,
255,
255,
0.25
);
--translucent_active_dark_bg: rgba(
255,
255,
255,
0.35
);
--border_color: #8c8c8c;
--user_msg_bg: #e5f0ff;
--bot_msg_bg: #580be4;
}
Demo
Помощь и поддержка проекта
Любая помощь и поддержка приветствуется.
Если будут найдены различные ошибки или предложения по улучшению, то смело пишите на почту: maximco36895@yandex.ru