@smarter.sh/ui-chat 0.3.0 → 0.7.0
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/LICENSE +2 -2
- package/README.md +126 -173
- package/dist/smarter-chat-library.es.js +44286 -12088
- package/dist/smarter-chat-library.es.js.map +1 -1
- package/dist/smarter-chat-library.umd.js +340 -121
- package/dist/smarter-chat-library.umd.js.map +1 -1
- package/dist/types/src/components/AppTitle/Component.d.ts +13 -0
- package/dist/types/src/components/AppTitle/index.d.ts +2 -0
- package/dist/types/src/components/Console/Component.d.ts +17 -0
- package/dist/types/src/components/Console/ServerLogs.d.ts +8 -0
- package/dist/types/src/components/Console/data.d.ts +7 -0
- package/dist/types/src/components/Console/enums.d.ts +9 -0
- package/dist/types/src/components/Console/index.d.ts +2 -0
- package/dist/types/src/components/ErrorBoundary/Component.d.ts +17 -0
- package/dist/types/src/components/ErrorBoundary/index.d.ts +2 -0
- package/dist/types/src/components/SmarterChat/Component.d.ts +26 -0
- package/dist/types/src/components/SmarterChat/icons.d.ts +17 -0
- package/dist/types/src/components/SmarterChat/index.d.ts +2 -0
- package/dist/types/src/const.d.ts +5 -0
- package/dist/types/src/index.d.ts +12 -0
- package/dist/types/src/lib/ansi.d.ts +33 -0
- package/dist/types/src/lib/api.d.ts +73 -0
- package/dist/types/src/lib/code.d.ts +32 -0
- package/dist/types/src/lib/cookie.d.ts +17 -0
- package/dist/types/src/lib/enums.d.ts +26 -0
- package/dist/types/src/lib/layout.d.ts +42 -0
- package/dist/types/src/lib/logStream.d.ts +30 -0
- package/dist/types/src/lib/math.d.ts +18 -0
- package/dist/types/src/lib/mermaid.d.ts +27 -0
- package/dist/types/src/lib/messages.d.ts +52 -0
- package/dist/types/src/types.d.ts +143 -0
- package/dist/ui-chat.css +2 -1
- package/package.json +87 -59
- package/src/components/Console/Component.css +0 -47
- package/src/components/Console/Component.jsx +0 -186
- package/src/components/Console/HeadStyles.jsx +0 -20
- package/src/components/Console/enums.js +0 -7
- package/src/components/Console/index.js +0 -2
- package/src/components/ErrorModal/ErrorModal.css +0 -35
- package/src/components/ErrorModal/ErrorModal.jsx +0 -56
- package/src/components/ErrorModal/index.js +0 -3
- package/src/components/SmarterChat/Component.jsx +0 -431
- package/src/components/SmarterChat/ErrorBoundary.jsx +0 -32
- package/src/components/SmarterChat/Layout.js +0 -47
- package/src/components/SmarterChat/api.js +0 -200
- package/src/components/SmarterChat/enums.js +0 -17
- package/src/components/SmarterChat/index.js +0 -3
- package/src/components/SmarterChat/styles.css +0 -152
- package/src/components/SmarterChat/utils.jsx +0 -148
- package/src/components/enums.js +0 -1
- package/src/components/index.js +0 -3
- package/src/components/shared/cookie.js +0 -51
- package/src/constants.js +0 -2
- package/src/index.js +0 -4
- package/src/types/index.js +0 -2
- package/src/types/propTypes.js +0 -154
- package/src/version.js +0 -2
- package/types/index.d.ts +0 -17
package/LICENSE
CHANGED
|
@@ -660,9 +660,9 @@ if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
|
660
660
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
661
661
|
<http://www.gnu.org/licenses/>.
|
|
662
662
|
|
|
663
|
-
|
|
663
|
+
Lawrence McDaniel wishes to state, in clarification of the above license terms, that
|
|
664
664
|
any public, independently available web service offered over the network and
|
|
665
|
-
communicating with
|
|
665
|
+
communicating with Lawrence McDaniel's copyrighted works by any form of inter-service
|
|
666
666
|
communication, including but not limited to Remote Procedure Call (RPC)
|
|
667
667
|
interfaces, is not a work based on our copyrighted work within the meaning
|
|
668
668
|
of the license. "Corresponding Source" of this work, or works based on this
|
package/README.md
CHANGED
|
@@ -1,225 +1,178 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@smarter.sh/ui-chat)
|
|
2
2
|
[](https://github.com/smarter-sh/smarter-chat/)
|
|
3
|
+
[](https://github.com/smarter-sh/smarter-chat/actions/workflows/test.yml)
|
|
4
|
+
[](https://codecov.io/gh/smarter-sh/smarter-chat)
|
|
3
5
|
<a href="https://smarter.sh">
|
|
4
6
|
<img src="https://img.shields.io/badge/Smarter.sh-orange?style=flat&logo=appveyor&logoColor=white" height="32">
|
|
5
7
|
</a>
|
|
6
8
|
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
# Smarter Chat
|
|
10
|
+
|
|
11
|
+
Smarter Chat is the React chat component of the [Smarter](https://smarter.sh) LLMClient prompt engineering
|
|
12
|
+
workbench. Beside the chat, its Console displays the LLMClient's configuration, and the chat session's api calls,
|
|
13
|
+
tool calls and plugin usage, and optionally streams your server logs, in color, with long lines that scroll or wrap.
|
|
14
|
+
Drag the separator between the chat and the Console to resize them, or hide the Console, which slides out to the right.
|
|
15
|
+
The new chat button starts a new chat session, and clears the server logs. The Sandbox mode / Production mode button
|
|
16
|
+
shows and hides the backend's own messages in the chat thread. While a prompt runs, its progress (LLM requests, tool,
|
|
17
|
+
plugin and MCP server calls) is displayed in the thread, and a failed prompt is displayed with the LLM provider's error
|
|
18
|
+
message. Responses are rendered as GitHub flavored markdown (headings, emphasis, lists, tables, block quotes, code,
|
|
19
|
+
links and images), with raw html escaped, and images are scaled to fit their chat bubble. Math, written in LaTeX as
|
|
20
|
+
`\( ... \)` inline, or `\[ ... \]` or `$$ ... $$` displayed, is typeset by [KaTeX](https://katex.org). A `mermaid` code block is drawn as a
|
|
21
|
+
[Mermaid](https://mermaid.js.org) diagram, which is downloaded only when a message first has one, with a button that
|
|
22
|
+
shows its code.
|
|
23
|
+
|
|
24
|
+
It is also published to npm as [@smarter.sh/ui-chat](https://www.npmjs.com/package/@smarter.sh/ui-chat), so that
|
|
25
|
+
any web page can use a Smarter LLMClient as its chat backend: a Wordpress or Squarespace site, a Salesforce portal,
|
|
26
|
+
a Shopify storefront, a Sharepoint add-in, or your own web application.
|
|
12
27
|
|
|
13
28
|

|
|
14
29
|
|
|
15
|
-
|
|
30
|
+
See the [Smarter Chat documentation](https://docs.smarter.sh/en/latest/smarter-framework/developer-reference/react-integration/smarter-chat.html).
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
## Usage
|
|
18
33
|
|
|
19
34
|
```console
|
|
20
35
|
npm install @smarter.sh/ui-chat
|
|
21
36
|
```
|
|
22
37
|
|
|
23
|
-
```
|
|
24
|
-
import
|
|
25
|
-
import ReactDOM from "react-dom/client";
|
|
38
|
+
```tsx
|
|
39
|
+
import { createRoot } from "react-dom/client";
|
|
26
40
|
import { SmarterChat } from "@smarter.sh/ui-chat";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const debugMode = rootElement.getAttribute("smarter-debug-mode") === "true";
|
|
38
|
-
const debugCookieName = "debug";
|
|
39
|
-
|
|
40
|
-
root.render(
|
|
41
|
-
<React.StrictMode>
|
|
42
|
-
<SmarterChat
|
|
43
|
-
apiUrl={apiUrl}
|
|
44
|
-
apiKey={apiKey}
|
|
45
|
-
toggleMetadata={toggleMetadata}
|
|
46
|
-
csrfCookieName={csrfCookieName}
|
|
47
|
-
csrftoken={csrftoken}
|
|
48
|
-
debugCookieName={debugCookieName}
|
|
49
|
-
debugCookieExpiration={debugCookieExpiration}
|
|
50
|
-
debugMode={debugMode}
|
|
51
|
-
sessionCookieName={sessionCookieName}
|
|
52
|
-
sessionCookieExpiration={sessionCookieExpiration}
|
|
53
|
-
authSessionCookieName={authSessionCookieName}
|
|
54
|
-
showConsole={true}
|
|
55
|
-
cookieDomain={cookieDomain}
|
|
56
|
-
/>
|
|
57
|
-
</React.StrictMode>,
|
|
41
|
+
import "@smarter.sh/ui-chat/dist/ui-chat.css";
|
|
42
|
+
// the stylesheet and fonts of math in the responses. katex is installed with @smarter.sh/ui-chat.
|
|
43
|
+
import "katex/dist/katex.min.css";
|
|
44
|
+
|
|
45
|
+
createRoot(document.getElementById("chat")!).render(
|
|
46
|
+
<SmarterChat
|
|
47
|
+
apiUrl="https://stackademy.3141-5926-5359.api.example.com/"
|
|
48
|
+
cookieDomain="example.com"
|
|
49
|
+
showConsole={false}
|
|
50
|
+
/>,
|
|
58
51
|
);
|
|
59
52
|
```
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
React 19 is a peer dependency.
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
This assumes that you have already built your AWS cloud infrastructure using [github.com/smarter-sh/smarter-infrastructure](https://github.com/smarter-sh/smarter-infrastructure) and that a CDN exists at cdn.platform.example.com.
|
|
56
|
+
### Props
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
| Prop | Default | Description |
|
|
59
|
+
| ------------------------- | --------------- | ------------------------------------------------------------------------------------------------------- |
|
|
60
|
+
| `apiUrl` | (required) | The url of the LLMClient's api. The chat appends `config/` for its configuration. |
|
|
61
|
+
| `apiKey` | `null` | A Smarter api key, sent as `Authorization: Token <apiKey>`, for LLMClients that require authentication. |
|
|
62
|
+
| `toggleMetadata` | `false` | Show the button that shows and hides the backend's messages (system prompt, tool results, Smarter's). |
|
|
63
|
+
| `showConsole` | `true` | Show the Console beside the chat. It needs a wide page. |
|
|
64
|
+
| `debugMode` | `false` | Log to the browser console. |
|
|
65
|
+
| `csrfCookieName` | `"csrftoken"` | The name of Django's CSRF cookie, whose value is sent as the `X-CSRFToken` header. |
|
|
66
|
+
| `csrftoken` | `null` | The CSRF token, when the page cannot read the CSRF cookie. |
|
|
67
|
+
| `sessionCookieName` | `"session_key"` | The cookie in which the chat saves its chat session's key, for the page's path. |
|
|
68
|
+
| `sessionCookieExpiration` | one day | The session cookie's lifetime, in milliseconds. |
|
|
69
|
+
| `debugCookieName` | `"debug"` | The cookie in which the chat saves the LLMClient's debug mode. |
|
|
70
|
+
| `debugCookieExpiration` | one day | The debug cookie's lifetime, in milliseconds. |
|
|
71
|
+
| `cookieDomain` | `""` | The domain whose cookies the chat reads. Empty means the page's own domain. |
|
|
72
|
+
| `smarterRequestId` | `""` | A unique id of the page request, sent as the `X-Smarter-RequestId` header. |
|
|
73
|
+
| `streamProgress` | `true` | Display a running prompt's progress, which the prompt api streams as Server-Sent Events. |
|
|
74
|
+
| `logStreamUrl` | `null` | The url of a server log stream (Server-Sent Events), for the Console's "Server Logs" tab. |
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
The package also exports the `Console` component, the `MessageDirectionEnum`, `SenderRoleEnum`,
|
|
77
|
+
`ValidMessageRolesEnum` and `MenuItems` enums, `version`, and TypeScript types for its props and for the
|
|
78
|
+
Smarter api's data (`SmarterChatProps`, `ChatConfig`, `ChatMessage`, `PromptProgressEvent`, ...).
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
### The Smarter api
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
- [app-loader.js](https://github.com/smarter-sh/smarter-workbench/blob/main/src/public/app-loader.js): a small js script that injects the react.js build assets into your DOM, initiating the React boot-up process.
|
|
80
|
-
- [Makefile](https://github.com/smarter-sh/smarter-workbench/blob/main/Makefile): for automating build and release to AWS Cloudfront, where the react ui-chat app is served.
|
|
82
|
+
Smarter Chat calls two apis, both with POST requests that send the browser's cookies:
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
- `<apiUrl>config/?session_key=<key>`: the LLMClient's configuration, including the chat session's history,
|
|
85
|
+
which restores the chat thread when the page reloads. A new chat session's key is saved in the session cookie.
|
|
86
|
+
- `chatbot.url_chatbot` in the configuration: the LLMClient's prompt api. It receives the chat thread with each
|
|
87
|
+
new message, `{"session_key": "...", "messages": [...]}`, and returns the completion as a JSON string, in
|
|
88
|
+
`data.body`, whose `smarter.messages` are added to the thread. A failed prompt returns the LLM provider's status,
|
|
89
|
+
and `{"error": {"status", "message"}, "response": <the completion>}` in its body. With `streamProgress`, the
|
|
90
|
+
request accepts `text/event-stream`, and the response is `progress` events while the prompt runs, then a `result`
|
|
91
|
+
event, `{"status": <http status>, "response": <the same JSON>}`. A server that doesn't stream answers with JSON.
|
|
83
92
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
id="smarter-sh-v1-ui-chat-root"
|
|
87
|
-
smarter-chatbot-api-url="https://openai.3141-5926-5359.api.smarter.sh/"
|
|
88
|
-
smarter-toggle-metadata="False"
|
|
89
|
-
style="height: 88vh;"
|
|
90
|
-
></div>
|
|
91
|
-
<script async="" src="https://cdn.platform.smarter.sh/ui-chat/app-loader.js"></script>
|
|
92
|
-
```
|
|
93
|
+
Requests from your page to the Smarter api are cross-origin, so your page's origin must be allowed by the Smarter
|
|
94
|
+
platform's CORS configuration.
|
|
93
95
|
|
|
94
|
-
##
|
|
96
|
+
## Development
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### Setup
|
|
99
|
-
|
|
100
|
-
1. Build your component
|
|
101
|
-
|
|
102
|
-
```console
|
|
103
|
-
npm install -g yalc
|
|
104
|
-
npm run build
|
|
105
|
-
yalc publish
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
2. Create a separate test React app (outside your library folder)
|
|
98
|
+
This repository is self-contained: clone it, and its Makefile does the rest. The Smarter backend is optional.
|
|
109
99
|
|
|
110
100
|
```console
|
|
111
|
-
|
|
112
|
-
cd smarter-chat
|
|
101
|
+
git clone https://github.com/smarter-sh/smarter-chat.git
|
|
102
|
+
cd smarter-chat
|
|
103
|
+
make init # npm install
|
|
104
|
+
make serve # Storybook, at http://localhost:6006
|
|
113
105
|
```
|
|
114
106
|
|
|
115
|
-
|
|
107
|
+
`make serve` browses the components in Storybook, whose stories mock the Smarter api with
|
|
108
|
+
[MSW](https://mswjs.io/), so no backend is needed. When the Smarter dev server is running at http://localhost:9357, the
|
|
109
|
+
stories use the web console's own stylesheets; without it, they use Bootstrap, which the web console's theme is built
|
|
110
|
+
on.
|
|
116
111
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
| Command | What it does |
|
|
113
|
+
| --------------- | ------------------------------------------------------------------------------------------------- |
|
|
114
|
+
| `make init` | Installs the dependencies. |
|
|
115
|
+
| `make serve` | Browses the components in Storybook, with the Smarter api mocked. |
|
|
116
|
+
| `make run` | Runs the app with Vite's dev server, proxying api requests to the Smarter dev server (port 9357). |
|
|
117
|
+
| `make build` | Builds the app, with a Vite manifest for Django, and the npm package into `dist/`. |
|
|
118
|
+
| `make test` | Runs the unit tests (Vitest and React Testing Library). Every story is also rendered as a test. |
|
|
119
|
+
| `make coverage` | Runs the unit tests with a coverage report in `coverage/`, which CI uploads to Codecov. |
|
|
120
|
+
| `make lint` | Lints with ESLint, type-checks with TypeScript, and checks formatting with Prettier. |
|
|
121
|
+
| `make release` | Runs the tests, then builds the npm package into `dist/` and publishes it to npm. |
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
### Inside the Smarter repository
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
Smarter's web console hosts Smarter Chat as one of the React apps in its npm workspace. `make react-install`, in the
|
|
126
|
+
[Smarter repository](https://github.com/smarter-sh/smarter), clones this repository into
|
|
127
|
+
`smarter/react/packages/smarter-chat`:
|
|
125
128
|
|
|
126
129
|
```console
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
git clone https://github.com/smarter-sh/smarter.git
|
|
131
|
+
cd smarter
|
|
132
|
+
make react-install # clones smarter-chat's main branch
|
|
133
|
+
make react-install SMARTER_CHAT_BRANCH=alpha # or another branch
|
|
130
134
|
```
|
|
131
135
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
The same `make` commands work there, in `smarter/react/packages/smarter-chat`, which is this repository's own git
|
|
137
|
+
working tree. Two differ: `make init` installs the whole workspace's dependencies, and `make build` builds the app into
|
|
138
|
+
the Smarter web console's static files, rather than into `build/`. The Smarter repository's `make react-test` and
|
|
139
|
+
`make react-lint`, and its GitHub Actions workflows, also test and lint Smarter Chat along with the other React apps.
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
- POST `/chat/`: send a text completion prompt to the Smarter Api.
|
|
141
|
+
### Commits, versions and releases
|
|
139
142
|
|
|
140
|
-
Smarter
|
|
143
|
+
Run `make pre-commit-init` once per clone (the Smarter repository's `make react-install` does it when its virtual
|
|
144
|
+
environment is active). It installs two git hooks: pre-commit, which runs codespell, Prettier and
|
|
145
|
+
ESLint, and the standard pre-commit-hooks checks, and commit-msg, which runs commitlint.
|
|
141
146
|
|
|
142
|
-
|
|
143
|
-
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- `https://my-chatbot.3141-5926-5359.api.smarter.sh/chat/`
|
|
149
|
-
|
|
150
|
-
Authenticated api url example for any chatbot in your Smarter account:
|
|
151
|
-
|
|
152
|
-
- `https://platform.smarter.sh/chatbots/my-chatbot/config/`
|
|
153
|
-
- `https://platform.smarter.sh/chatbots/my-chatbot/chat/`
|
|
154
|
-
|
|
155
|
-
#### Config
|
|
156
|
-
|
|
157
|
-
A Json dict containing all configuration data for the chatbot. This is downloaded at run-time when the reactapp is initializing.
|
|
158
|
-
Example: [/chatbots/example/config/?session_key=YOUR-SESSION-KEY](http://localhost:8000/chatbots/example/config/)
|
|
159
|
-
|
|
160
|
-
See: [sample config](./data/sample-config.json)
|
|
161
|
-
|
|
162
|
-
#### Api
|
|
163
|
-
|
|
164
|
-
A REST Api for sending and receiving chat prompt requests. The url comes from the config dict (above): data.chatbot.url_chatbot.
|
|
165
|
-
example: `http://api.smarter.sh/v1/chatbots/smarter/example/`
|
|
166
|
-
|
|
167
|
-
example http request:
|
|
168
|
-
|
|
169
|
-
```json
|
|
170
|
-
{
|
|
171
|
-
"method": "POST",
|
|
172
|
-
"credentials": "include",
|
|
173
|
-
"mode": "cors",
|
|
174
|
-
"headers": {
|
|
175
|
-
"Accept": "application/json",
|
|
176
|
-
"Content-Type": "application/json",
|
|
177
|
-
"X-CSRFToken": "q9WXqqIhYJMI3ZSBIOE18JMORBMqAHri",
|
|
178
|
-
"Origin": "http://localhost:8000",
|
|
179
|
-
"Cookie": "session_key=a07593ecfaecd24008ca4251096732663ac0213b8cc6bdcce4f4c043276ab0b5; debug=true;"
|
|
180
|
-
},
|
|
181
|
-
"body": "{\"session_key\":\"a07593ecfaecd24008ca4251096732663ac0213b8cc6bdcce4f4c043276ab0b5\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a helpful chatbot."},{\"role\":\"assistant\",\"content\":\"Welcome to the Smarter demo!\"}]}"
|
|
182
|
-
}
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
example http response:
|
|
186
|
-
|
|
187
|
-
```json
|
|
188
|
-
{
|
|
189
|
-
"data": {
|
|
190
|
-
"isBase64Encoded": false,
|
|
191
|
-
"statusCode": 200,
|
|
192
|
-
"headers": {
|
|
193
|
-
"Content-Type": "application/json"
|
|
194
|
-
},
|
|
195
|
-
"body": "{\"id\": \"chatcmpl-AoDpMvoAhf8iSJuEm6pMqkX62HK4G\", \"choices\": [{\"finish_reason\": \"stop\", \"index\": 0, \"logprobs\": null, \"message\": {\"content\": \"Hello! While I'm not your mom, I'm here to help you with any questions or tasks you have. What can I assist you with today?\", \"refusal\": null, \"role\": \"assistant\", \"audio\": null, \"function_call\": null, \"tool_calls\": null}}], \"created\": 1736532916, \"model\": \"gpt-4-turbo-2024-04-09\", \"object\": \"chat.completion\", \"service_tier\": \"default\", \"system_fingerprint\": \"fp_f17929ee92\", \"usage\": {\"completion_tokens\": 33, \"prompt_tokens\": 1122, \"total_tokens\": 1155, \"completion_tokens_details\": {\"accepted_prediction_tokens\": 0, \"audio_tokens\": 0, \"reasoning_tokens\": 0, \"rejected_prediction_tokens\": 0}, \"prompt_tokens_details\": {\"audio_tokens\": 0, \"cached_tokens\": 0}}, \"metadata\": {\"tool_calls\": null, \"model\": \"gpt-4-turbo\", \"temperature\": 0.5, \"max_tokens\": 256, \"input_text\": \"hi mom\"}}"
|
|
196
|
-
},
|
|
197
|
-
"api": "smarter.sh/v1",
|
|
198
|
-
"thing": "Chatbot",
|
|
199
|
-
"metadata": {
|
|
200
|
-
"command": "chat"
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
```
|
|
147
|
+
Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/), as Smarter's do, because
|
|
148
|
+
[semantic-release](https://semantic-release.gitbook.io/) versions this package from them. On each push to `alpha`
|
|
149
|
+
(prereleases, e.g. `1.0.0-alpha.1`) and to `main`, `.github/workflows/pushMain.yml` determines the next version, writes
|
|
150
|
+
it to `package.json`, adds the release notes to `CHANGELOG.md`, tags the commit and creates a GitHub release. A release
|
|
151
|
+
on `main` is then merged back into `alpha`. `feat` commits are minor releases, `fix` and `perf` commits are patches, and
|
|
152
|
+
a `BREAKING CHANGE:` footer is a major release. See `release.config.cjs`.
|
|
204
153
|
|
|
205
|
-
|
|
154
|
+
semantic-release does not publish to npm. After a release on `main`, publish it with `make release`.
|
|
206
155
|
|
|
207
|
-
###
|
|
156
|
+
### Source
|
|
208
157
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
158
|
+
| Path | Contents |
|
|
159
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------ |
|
|
160
|
+
| `src/index.ts` | The npm package's public api. |
|
|
161
|
+
| `src/main.tsx`, `src/App.tsx` | The app that the Smarter web console renders, configured by its root element's attributes. |
|
|
162
|
+
| `src/components/` | `SmarterChat`, `Console`, `AppTitle` and `ErrorBoundary`, with their stories and tests. |
|
|
163
|
+
| `src/lib/` | The Smarter api calls, the chat thread's messages, and cookies. |
|
|
164
|
+
| `src/mocks/` | Example api data and MSW handlers, for the stories and tests. |
|
|
214
165
|
|
|
215
|
-
|
|
166
|
+
## License
|
|
216
167
|
|
|
217
|
-
|
|
218
|
-
-
|
|
219
|
-
- [Chat UI Kit React](https://www.npmjs.com/package/@chatscope/chat-ui-kit-react)
|
|
168
|
+
Smarter Chat is licensed under the GNU Affero General Public License v3.0 or later
|
|
169
|
+
([AGPL-3.0-or-later](./LICENSE)), as Smarter is.
|
|
220
170
|
|
|
221
171
|
## Contributing
|
|
222
172
|
|
|
223
|
-
We welcome contributions! There are a variety of ways for you to get involved, regardless of your background. In
|
|
173
|
+
We welcome contributions! There are a variety of ways for you to get involved, regardless of your background. In
|
|
174
|
+
addition to Pull requests, this project would benefit from contributors focused on documentation and how-to video
|
|
175
|
+
content creation, testing, community engagement, and stewards to help us to ensure that we comply with evolving
|
|
176
|
+
standards for the ethical use of AI.
|
|
224
177
|
|
|
225
178
|
You can also contact [Lawrence McDaniel](https://lawrencemcdaniel.com/contact) directly.
|