@saber2pr/ai-assistant 0.0.10 → 0.0.12
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 +6 -2
- package/lib/app.js +0 -1
- package/lib/chat.js +1 -1
- package/lib/components/Codeblock/index.style.js +1 -1
- package/lib/components/Thread/index.js +1 -1
- package/package.json +1 -1
package/ReadMe.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
### @saber2pr/ai-assistant
|
|
2
2
|
|
|
3
|
-
Quickly customize your GPT UI.
|
|
3
|
+
Quickly customize your GPT UI.
|
|
4
|
+
|
|
5
|
+
> Demo see: https://saber2pr.top/
|
|
4
6
|
|
|
5
7
|
### Installation
|
|
6
8
|
|
|
@@ -20,7 +22,8 @@ import { initAIAssistant } from '@saber2pr/ai-assistant';
|
|
|
20
22
|
initAIAssistant({
|
|
21
23
|
welcomeMessage: 'Hello! I am your AI assistant. How can I help you today?',
|
|
22
24
|
suggestions: ['How to use this UI?', 'Tell me about assistant-ui'],
|
|
23
|
-
locale: 'en-US'
|
|
25
|
+
locale: 'en-US',
|
|
26
|
+
theme: () => document.body.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
|
|
24
27
|
});
|
|
25
28
|
```
|
|
26
29
|
|
|
@@ -42,6 +45,7 @@ Initializes and mounts the AI assistant. This assistant runs entirely in the bro
|
|
|
42
45
|
| `placeholder` | `string` | - | The placeholder text for the message input box. |
|
|
43
46
|
| `emptyMessage` | `string` | - | The message displayed when the thread list is empty. |
|
|
44
47
|
| `locale` | `'zh-CN' \| 'en-US'` | `'zh-CN'` | The language locale for the UI. |
|
|
48
|
+
| `theme` | `'light' \| 'dark' \| (() => 'light' \| 'dark')` | `'light'` | The theme for the UI. Supports a function for dynamic updates when the drawer opens. |
|
|
45
49
|
| `containerId` | `string` | `'ai-assistant-root'` | The ID of the container element where the assistant will be mounted. |
|
|
46
50
|
| `initialPosition` | `{ x: number; y: number }` | Bottom-right | The initial coordinates of the floating button. |
|
|
47
51
|
| `onBeforeChat` | `Function` | - | A hook to intercept and modify messages before they are sent to the AI. |
|
package/lib/app.js
CHANGED
package/lib/chat.js
CHANGED
|
@@ -222,7 +222,7 @@ var MyAppContent = function (_a) {
|
|
|
222
222
|
react_1.default.createElement(ThreadList_1.ThreadList, { onItemClick: function () { return setActiveTab('chat'); } }))))),
|
|
223
223
|
react_1.default.createElement(chat_style_1.PoweredBy, null,
|
|
224
224
|
"Powerd by ",
|
|
225
|
-
react_1.default.createElement(chat_style_1.PoweredByLink, { href: "https://github.com/Saber2pr/
|
|
225
|
+
react_1.default.createElement(chat_style_1.PoweredByLink, { href: "https://github.com/Saber2pr/ai-assistant/", target: "_blank", rel: "noreferrer" }, "ai-assistant"))))));
|
|
226
226
|
};
|
|
227
227
|
var initAIAssistant = function (config, container) {
|
|
228
228
|
if (config === void 0) { config = {}; }
|
|
@@ -9,5 +9,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.Contain = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
exports.Contain = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n max-width: 100%;\n overflow: hidden;\n border-radius: 8px;\n margin: 8px 0;\n\n pre {\n margin: 0 !important;\n max-width:
|
|
12
|
+
exports.Contain = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n max-width: 100%;\n overflow: hidden;\n border-radius: 8px;\n margin: 8px 0;\n\n pre {\n margin: 0 !important;\n max-width: 452px;\n overflow: auto !important;\n white-space: pre-wrap !important;\n word-break: break-all !important;\n }\n\n .Paste {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n color: rgb(173, 173, 173);\n opacity: 0.5;\n cursor: pointer;\n\n &:hover {\n opacity: 1;\n }\n }\n"], ["\n position: relative;\n max-width: 100%;\n overflow: hidden;\n border-radius: 8px;\n margin: 8px 0;\n\n pre {\n margin: 0 !important;\n max-width: 452px;\n overflow: auto !important;\n white-space: pre-wrap !important;\n word-break: break-all !important;\n }\n\n .Paste {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n color: rgb(173, 173, 173);\n opacity: 0.5;\n cursor: pointer;\n\n &:hover {\n opacity: 1;\n }\n }\n"])));
|
|
13
13
|
var templateObject_1;
|
|
@@ -127,7 +127,7 @@ var ThreadWelcomeSuggestions = function () {
|
|
|
127
127
|
? ["如何用 Typescript 实现 Helloworld?", "物联网是什么?"]
|
|
128
128
|
: ["How to implement Helloworld in Typescript?", "What is IoT?"]);
|
|
129
129
|
return (react_1.default.createElement(antd_1.Space, { style: { marginTop: 24 } }, suggestions.map(function (suggestion, index) { return (react_1.default.createElement(react_2.ThreadPrimitive.Suggestion, { key: index, prompt: suggestion, method: "replace", style: { border: 'none', padding: 0 }, autoSend: true },
|
|
130
|
-
react_1.default.createElement(antd_1.Card, { hoverable: true }, suggestion))); })));
|
|
130
|
+
react_1.default.createElement(antd_1.Card, { style: { borderRadius: 0 }, hoverable: true }, suggestion))); })));
|
|
131
131
|
};
|
|
132
132
|
// 底部的输入框
|
|
133
133
|
var Composer = function () {
|