llmasaservice-ui 0.1.6 → 0.1.8
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/.github/workflows/deploy-github-pages.yml +37 -0
- package/README.md +139 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/ChatPanel.tsx +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# .github/workflows/deploy-github-pages.yaml
|
|
2
|
+
|
|
3
|
+
# Workflow name
|
|
4
|
+
name: Build and Publish Storybook to GitHub Pages
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
# Event for the workflow to run on
|
|
8
|
+
push:
|
|
9
|
+
branches:
|
|
10
|
+
- 'main' # Replace with the branch you want to deploy from
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
# List of jobs
|
|
18
|
+
jobs:
|
|
19
|
+
deploy:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
# Job steps
|
|
22
|
+
steps:
|
|
23
|
+
# Manual Checkout
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
# Set up Node
|
|
27
|
+
- uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: '18.x'
|
|
30
|
+
|
|
31
|
+
#👇 Add Storybook build and deploy to GitHub Pages as a step in the workflow
|
|
32
|
+
- uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3
|
|
33
|
+
with:
|
|
34
|
+
install_command: yarn install # default: npm ci
|
|
35
|
+
build_command: yarn build-storybook # default: npm run build-storybook
|
|
36
|
+
path: storybook-static # default: dist/storybook
|
|
37
|
+
checkout: false # default: true
|
package/README.md
CHANGED
|
@@ -1,2 +1,141 @@
|
|
|
1
1
|
# Prebuilt UI chat panel for LLM as a Service
|
|
2
2
|
|
|
3
|
+
LLMAsAService.io is a platform to accelerate and securely develop LLM features in your applications and websites.
|
|
4
|
+
|
|
5
|
+
This library offers a pre-built panel for incorporating chat GPT style features in react/nextjs applications.
|
|
6
|
+
|
|
7
|
+
Features
|
|
8
|
+
- Multi-turn style chat interface
|
|
9
|
+
- Open with an initial prompt (for example, after a click on a Summarize button in your application, set the initialPrompt to "Summarize the following text ..." and the panel will automatically show the summary)
|
|
10
|
+
- Light and dark theme
|
|
11
|
+
- Abort functionality
|
|
12
|
+
- Markdown response display
|
|
13
|
+
- Sizable vertically and horizontally to suit your app. use 100vh or 100vw for the height and width to full size the panel in that orientation.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
What is LLM as a Service: https://llmasaservice.io
|
|
17
|
+
|
|
18
|
+
Register for a LLM as a Service account and get your unique project id from the integration page https://app.llmasaservice.io/integration
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
To install the library, use npm or yarn:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Using npm
|
|
27
|
+
npm install llmasaservice-ui
|
|
28
|
+
|
|
29
|
+
# Using yarn
|
|
30
|
+
yarn add llmasaservice-ui
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
In a React application
|
|
36
|
+
|
|
37
|
+
1. Import the ChatPanel component
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import React from 'react';
|
|
41
|
+
import ChatPanel from 'llmasaservice-ui';
|
|
42
|
+
import "../../node_modules/llmasaservice-ui/dist/index.css"; // default styles for light and dark, or replace with your own
|
|
43
|
+
|
|
44
|
+
const App = () => {
|
|
45
|
+
return (
|
|
46
|
+
<div>
|
|
47
|
+
<h1>My Chat Application</h1>
|
|
48
|
+
<ChatPanel
|
|
49
|
+
project_id="[[get this from the LLMAsAService control panel]]"
|
|
50
|
+
initialPrompt="Give a nice welcome message"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default App;
|
|
57
|
+
```
|
|
58
|
+
2. Run your application
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm start
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
In a Next.js application
|
|
65
|
+
|
|
66
|
+
1. Create a new page in pages/chat.js and add the following code
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import React from 'react';
|
|
70
|
+
import ChatPanel from 'llmasaservice-ui';
|
|
71
|
+
import "../../node_modules/llmasaservice-ui/dist/index.css"; // default styles for light and dark, or replace with your own
|
|
72
|
+
|
|
73
|
+
const ChatPage = () => {
|
|
74
|
+
return (
|
|
75
|
+
<div>
|
|
76
|
+
<h1>Chat Page</h1>
|
|
77
|
+
<ChatPanel
|
|
78
|
+
project_id="[[your project_id from the llmasaservice control panel]]"
|
|
79
|
+
title="Chat with us"
|
|
80
|
+
initialPrompt="Write a short three sentence background on the city called: Seattle"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default ChatPage;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
2. Run Your Next.js Application:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm run dev
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Tailwind CSS support
|
|
97
|
+
|
|
98
|
+
If you use tailwind for CSS styling do these additional steps for proper markdown formatting -
|
|
99
|
+
|
|
100
|
+
a) install the Typography:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install -D @tailwindcss/typography
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
b) add the plugin to your tailwind.config.js file:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
module.exports = {
|
|
110
|
+
theme: {
|
|
111
|
+
// ...
|
|
112
|
+
},
|
|
113
|
+
plugins: [
|
|
114
|
+
require('@tailwindcss/typography'),
|
|
115
|
+
// ...
|
|
116
|
+
],
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
c) use prose as the class for the markdownStyle. This example is for dark mode
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
<ChatPanel
|
|
124
|
+
project_id="[[your project_id from the llmasaservice control panel]]"
|
|
125
|
+
title="Chat with us"
|
|
126
|
+
initialPrompt="Write a short three sentence background on the city called: Seattle"
|
|
127
|
+
theme="dark"
|
|
128
|
+
markdownClass="prose prose-sm !max-w-none dark:prose-invert"
|
|
129
|
+
/>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Customization
|
|
133
|
+
You can customize the chat panel by passing props to the ChatPanel component. Refer to the library documentation for more details on available props and customization options.
|
|
134
|
+
|
|
135
|
+
See our storybook documentation showing how to theme, size and use the variaous features in this component:
|
|
136
|
+
|
|
137
|
+
https://predictabilityatscale.github.io/llmasaservice-ui/?path=/docs/chatpanel--docs
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
This project is licensed under the MIT License.
|
package/dist/index.js
CHANGED
|
@@ -199,7 +199,7 @@ var ChatPanel = ({
|
|
|
199
199
|
{
|
|
200
200
|
xmlns: "http://www.w3.org/2000/svg",
|
|
201
201
|
viewBox: "0 0 24 24",
|
|
202
|
-
|
|
202
|
+
strokeWidth: "2",
|
|
203
203
|
stroke: "currentColor",
|
|
204
204
|
fill: "none",
|
|
205
205
|
strokeLinecap: "round",
|
|
@@ -214,7 +214,7 @@ var ChatPanel = ({
|
|
|
214
214
|
{
|
|
215
215
|
xmlns: "http://www.w3.org/2000/svg",
|
|
216
216
|
viewBox: "0 0 24 24",
|
|
217
|
-
|
|
217
|
+
strokeWidth: "1",
|
|
218
218
|
stroke: "currentColor",
|
|
219
219
|
fill: "currentColor",
|
|
220
220
|
className: "icon-svg-large"
|
package/dist/index.mjs
CHANGED
|
@@ -166,7 +166,7 @@ var ChatPanel = ({
|
|
|
166
166
|
{
|
|
167
167
|
xmlns: "http://www.w3.org/2000/svg",
|
|
168
168
|
viewBox: "0 0 24 24",
|
|
169
|
-
|
|
169
|
+
strokeWidth: "2",
|
|
170
170
|
stroke: "currentColor",
|
|
171
171
|
fill: "none",
|
|
172
172
|
strokeLinecap: "round",
|
|
@@ -181,7 +181,7 @@ var ChatPanel = ({
|
|
|
181
181
|
{
|
|
182
182
|
xmlns: "http://www.w3.org/2000/svg",
|
|
183
183
|
viewBox: "0 0 24 24",
|
|
184
|
-
|
|
184
|
+
strokeWidth: "1",
|
|
185
185
|
stroke: "currentColor",
|
|
186
186
|
fill: "currentColor",
|
|
187
187
|
className: "icon-svg-large"
|
package/package.json
CHANGED
package/src/ChatPanel.tsx
CHANGED
|
@@ -205,7 +205,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
|
|
|
205
205
|
<svg
|
|
206
206
|
xmlns="http://www.w3.org/2000/svg"
|
|
207
207
|
viewBox="0 0 24 24"
|
|
208
|
-
|
|
208
|
+
strokeWidth="2"
|
|
209
209
|
stroke="currentColor"
|
|
210
210
|
fill="none"
|
|
211
211
|
strokeLinecap="round"
|
|
@@ -220,7 +220,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
|
|
|
220
220
|
<svg
|
|
221
221
|
xmlns="http://www.w3.org/2000/svg"
|
|
222
222
|
viewBox="0 0 24 24"
|
|
223
|
-
|
|
223
|
+
strokeWidth="1"
|
|
224
224
|
stroke="currentColor"
|
|
225
225
|
fill="currentColor"
|
|
226
226
|
className="icon-svg-large"
|