This repository has been archived by the owner on Jan 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #671 from vernondegoede/vernon/improve-chat-custom…
…izations Introduce more chat customization options
- Loading branch information
Showing
48 changed files
with
402 additions
and
469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,57 @@ | ||
# Copilot widget | ||
# OpenCopilot widget | ||
|
||
This is the widget for your copilot, it's what your users will interact with. | ||
This is the widget for OpenCopilot: it's what your users will interact with. | ||
|
||
It's a simple react application built to be used in any webpage as a widget, to download the latest build of the widget, go to the actions tab and download the latest build artifact. | ||
It's a simple React application that can be used in any webpage as a widget. To download the latest build of the widget, go to the actions tab in GitHub and download the latest build artifact. | ||
|
||
## How to install | ||
|
||
1. download the latest build artifact from the actions tab. | ||
1. Download the latest build artifact from the actions tab. | ||
|
||
2. extract the zip file. | ||
2. Extract the zip file. | ||
|
||
3. copy the `assets/*.js` file to your project. | ||
3. Copy the `assets/*.js` file to your project. | ||
|
||
4. reference the js file in your html file as follows: | ||
4. Reference the js file in your HTML file as follows: | ||
|
||
```html | ||
<script src="[some_js_file].js"></script> | ||
``` | ||
|
||
5. init the widget. | ||
5. Initialize the widget. | ||
|
||
```html | ||
<script> | ||
// you should run it after window loads | ||
window.onload = () => { | ||
initAiCoPilot({ | ||
initialMessage: "Hi Sir", // initial message obiviously. | ||
token: "not_super_secret_token", // your copilot token. | ||
rootId: "copilot-widget", //@optional: the root element id in which the widget will mount on | ||
triggerSelector: "#triggerSelector", // the selector of the element that will trigger the widget on click. | ||
apiUrl: "https://cloud.openchat.so/api", // the url of the copilot api. | ||
initialMessage: "Hey, how can I help you today?", // initial bot message | ||
token: "not_super_secret_token", // your OpenCopilot token | ||
rootId: "copilot-widget", // @optional: the root element id in which the widget will mount on | ||
triggerSelector: "#triggerSelector", // the selector of the element that will trigger the widget on click | ||
apiUrl: "https://cloud.openchat.so/api", // the url of the OpenCopilot api. | ||
headers: { | ||
// headers that you want to send with every message request. | ||
Authorization: "Bearer your_auth_token_goes_here", | ||
}, | ||
user: { name: "Some User" }, // @optional: user object | ||
}, // @optional: headers that you want to send with every message request | ||
bot: { | ||
name: "AI Assistant", | ||
avatarUrl: "https://example.com/company-logo.png" | ||
}, // @optional: bot object – this info will be used in the chat | ||
user: { | ||
name: "John Doe", | ||
avatarUrl: "https://example.com/user-avatar.png" | ||
}, // @optional: user object – this info will be used in the chat | ||
containerProps: {}, // @optional: `HTMLProps` | ||
warnBeforeClose: true, // @optional: Set to false if you don't want to warn the user before closing the chat | ||
}); | ||
}; | ||
</script> | ||
``` | ||
|
||
### How to use | ||
## How to use | ||
|
||
1. click on the trigger element to open the widget. | ||
1. Click on the trigger element to open the widget. | ||
|
||
2. type your message and press enter to send it. | ||
2. Type your message and press enter to send it. | ||
|
||
<img width="394" alt="OpenCopilot widget" src="https://github.com/openchatai/OpenCopilot/assets/32633162/77b30faa-c59e-4a3a-821a-d14a61a49a65"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.