@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.
Files changed (58) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +126 -173
  3. package/dist/smarter-chat-library.es.js +44286 -12088
  4. package/dist/smarter-chat-library.es.js.map +1 -1
  5. package/dist/smarter-chat-library.umd.js +340 -121
  6. package/dist/smarter-chat-library.umd.js.map +1 -1
  7. package/dist/types/src/components/AppTitle/Component.d.ts +13 -0
  8. package/dist/types/src/components/AppTitle/index.d.ts +2 -0
  9. package/dist/types/src/components/Console/Component.d.ts +17 -0
  10. package/dist/types/src/components/Console/ServerLogs.d.ts +8 -0
  11. package/dist/types/src/components/Console/data.d.ts +7 -0
  12. package/dist/types/src/components/Console/enums.d.ts +9 -0
  13. package/dist/types/src/components/Console/index.d.ts +2 -0
  14. package/dist/types/src/components/ErrorBoundary/Component.d.ts +17 -0
  15. package/dist/types/src/components/ErrorBoundary/index.d.ts +2 -0
  16. package/dist/types/src/components/SmarterChat/Component.d.ts +26 -0
  17. package/dist/types/src/components/SmarterChat/icons.d.ts +17 -0
  18. package/dist/types/src/components/SmarterChat/index.d.ts +2 -0
  19. package/dist/types/src/const.d.ts +5 -0
  20. package/dist/types/src/index.d.ts +12 -0
  21. package/dist/types/src/lib/ansi.d.ts +33 -0
  22. package/dist/types/src/lib/api.d.ts +73 -0
  23. package/dist/types/src/lib/code.d.ts +32 -0
  24. package/dist/types/src/lib/cookie.d.ts +17 -0
  25. package/dist/types/src/lib/enums.d.ts +26 -0
  26. package/dist/types/src/lib/layout.d.ts +42 -0
  27. package/dist/types/src/lib/logStream.d.ts +30 -0
  28. package/dist/types/src/lib/math.d.ts +18 -0
  29. package/dist/types/src/lib/mermaid.d.ts +27 -0
  30. package/dist/types/src/lib/messages.d.ts +52 -0
  31. package/dist/types/src/types.d.ts +143 -0
  32. package/dist/ui-chat.css +2 -1
  33. package/package.json +87 -59
  34. package/src/components/Console/Component.css +0 -47
  35. package/src/components/Console/Component.jsx +0 -186
  36. package/src/components/Console/HeadStyles.jsx +0 -20
  37. package/src/components/Console/enums.js +0 -7
  38. package/src/components/Console/index.js +0 -2
  39. package/src/components/ErrorModal/ErrorModal.css +0 -35
  40. package/src/components/ErrorModal/ErrorModal.jsx +0 -56
  41. package/src/components/ErrorModal/index.js +0 -3
  42. package/src/components/SmarterChat/Component.jsx +0 -431
  43. package/src/components/SmarterChat/ErrorBoundary.jsx +0 -32
  44. package/src/components/SmarterChat/Layout.js +0 -47
  45. package/src/components/SmarterChat/api.js +0 -200
  46. package/src/components/SmarterChat/enums.js +0 -17
  47. package/src/components/SmarterChat/index.js +0 -3
  48. package/src/components/SmarterChat/styles.css +0 -152
  49. package/src/components/SmarterChat/utils.jsx +0 -148
  50. package/src/components/enums.js +0 -1
  51. package/src/components/index.js +0 -3
  52. package/src/components/shared/cookie.js +0 -51
  53. package/src/constants.js +0 -2
  54. package/src/index.js +0 -4
  55. package/src/types/index.js +0 -2
  56. package/src/types/propTypes.js +0 -154
  57. package/src/version.js +0 -2
  58. 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
- EdX Inc. wishes to state, in clarification of the above license terms, that
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 edX's copyrighted works by any form of inter-service
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
  [![NPM](https://a11ybadges.com/badge?logo=npm)](https://www.npmjs.com/package/@smarter.sh/ui-chat)
2
2
  [![GitHub](https://a11ybadges.com/badge?logo=github)](https://github.com/smarter-sh/smarter-chat/)
3
+ [![Test Status](https://github.com/smarter-sh/smarter-chat/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/smarter-sh/smarter-chat/actions/workflows/test.yml)
4
+ [![Coverage](https://img.shields.io/codecov/c/github/smarter-sh/smarter-chat/main?label=coverage&logo=codecov)](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
- # SmarterChat React.js component for smarter.sh
8
-
9
- This project contains the source code for the interactive chatbot found in the Smarter web console [developer workbench](https://platform.smarter.sh/chatbots/example/). It integrates natively with Smarter Saas and on-premise installations. You can optionally enable the meta data output behavior found in the Smarter sandbox. See [Smarter Technical Overview](./doc/README.md)
10
-
11
- This project is also suitable for all front-end cross-platform projects. For example, use this code base to create a react.js run-time for use inside of Wordpress plugins, salesforce.com apps, .net components and Sharepoint add-ins.
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
  ![Basic Usage](./doc/img/readme-usage4.png)
14
29
 
15
- ## Usage
30
+ See the [Smarter Chat documentation](https://docs.smarter.sh/en/latest/smarter-framework/developer-reference/react-integration/smarter-chat.html).
16
31
 
17
- Generic usage of the published npm package is as follows
32
+ ## Usage
18
33
 
19
34
  ```console
20
35
  npm install @smarter.sh/ui-chat
21
36
  ```
22
37
 
23
- ```jsx
24
- import React from "react";
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
- const rootElement = document.getElementById("smarter-sh-v1-ui-chat-root");
29
- const root = ReactDOM.createRoot(rootElement);
30
- const apiUrl = rootElement.getAttribute("smarter-chatbot-api-url") || "http://localhost:9357/api/v1/chatbots/1/";
31
- const toggleMetadata = rootElement.getAttribute("smarter-toggle-metadata") === "true";
32
- const csrfCookieName = rootElement.getAttribute("smarter-csrf-cookie-name") || "csrftoken";
33
- const sessionCookieName = rootElement.getAttribute("smarter-session-cookie-name") || "session_key";
34
- const cookieDomain = rootElement.getAttribute("smarter-cookie-domain") || "localhost";
35
- const authSessionCookieName = rootElement.getAttribute("django-session-cookie-name") || "sessionid";
36
- const csrftoken = rootElement.getAttribute("django-csrftoken");
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
- ### Build from source
54
+ React 19 is a peer dependency.
62
55
 
63
- To build and deploy for use in the Smarter Web Console Prompt Engineer Workbench, do the following.
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
- ```console
67
- export ROOT_DOMAIN=example.com
68
- export PLATFORM_SUBDOMAIN=platform
69
- npm install
70
- make build
71
- make release
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
- ## Integrate to an existing web page
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
- We integrate this react component to the [Smarter developer workbench](https://platform.smarter.sh/) using this small repo, [github.com/smarter-sh/web-integration-example](https://github.com/smarter-sh/web-integration-example). This methodology provides a layer of separation between Django and react.js, which keeps things simple. smarter-workbench substantially consists of the following three files:
80
+ ### The Smarter api
77
81
 
78
- - [main.jsx](https://github.com/smarter-sh/smarter-workbench/blob/main/src/main.jsx): a 40-line react.js mini app for configuring this npm component with a Smarter Api url and any initialization settings we choose to include.
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
- Meanwhile, Django adds a pair of DOM elements like the following example, where app-loader.js launches itself with an "iffe", (Immediately Invoked Function Expression).
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
- ```html
85
- <div
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
- ## Developers
96
+ ## Development
95
97
 
96
- SmarterChat is created with [React](https://react.dev/) leveraging [@chatscope/chat-ui-kit-react](https://www.npmjs.com/package/@chatscope/chat-ui-kit-react)
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
- npx create-react-app smarter-chat-test
112
- cd smarter-chat-test
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
- 3. Link your local package to the test app. This is a 1-time operation.
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
- ```console
118
- yalc add @smarter.sh/ui-chat
119
- npm install # verifies peer dependencies
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
- 4. In the test app, import and use your component as you described.
123
+ ### Inside the Smarter repository
123
124
 
124
- 5. Start the test app
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
- yalc update @smarter.sh/ui-chat
128
- npm run build
129
- npm start
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
- ### Backend integration
133
-
134
- See [Getting Started with the Smarter Chatbot Api](./doc/CHATBOT_API.md)
135
- This app interacts with two endpoints from the [smarter.sh/v1](https://platform.smarter.sh/docs/api/) chatbot api:
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
- - GET `/config/`: retrieves a json dict, structured in 4 major sections, with all information required by the react app.
138
- - POST `/chat/`: send a text completion prompt to the Smarter Api.
141
+ ### Commits, versions and releases
139
142
 
140
- Smarter chatbot urls use either of these two naming conventions:
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
- - public: `https://<name>.<account_number>.example.com/`
143
- - authenticated: `https://platform.smarter.sh/chatbots/<name>/`. This react component looks for and adds the Smarter platform sessionid cookie value to request headers, if it exists.
144
-
145
- Public api url example for a deployed chatbot:
146
-
147
- - `https://my-chatbot.3141-5926-5359.api.smarter.sh/config/`
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
- ## Contributor Reference
154
+ semantic-release does not publish to npm. After a release on `main`, publish it with `make release`.
206
155
 
207
- ### Getting Started
156
+ ### Source
208
157
 
209
- - `make`: prints a full menu of commands to the console.
210
- - `make init`: Setup your environment for first time use. sets up your Node environment for you. initializes pre-commit, which you need to run prior to creating pull requests.
211
- - `make run`: Run the dev server locally
212
- - `make build`: Build the react.js project. saves vite.js output to `./build` in the root of this project.
213
- - `make release`: Deploy the react.js project. **REQUIRES awscli + keypair with sufficient permissions**. Publishes the contents of the `./build` folder to an AWS S3 bucket served by the host defined by the value of `CDN_HOST_BASE_URL` located in shared/constant.js. For example, the react app for the Smarter workbench is initialized and served from these endpoints: a. [index.html](https://cdn.platform.smarter.sh/ui-chat/index.html): the react app build artifacts, and b. [app-loader.js](https://cdn.platform.smarter.sh/ui-chat/app-loader.js): a script to insert the react app build artifacts into the DOM.
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
- ### Architecture
166
+ ## License
216
167
 
217
- - [Vite](https://vitejs.dev/)
218
- - [React](https://react.dev/)
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 addition to Pull requests, this project would benefit from contributors focused on documentation and how-to video content creation, testing, community engagement, and stewards to help us to ensure that we comply with evolving standards for the ethical use of AI.
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.