- Seamless integration of Transformers.js
- Support for various open-source language models
- Real-time, streaming responses
- Customizable appearance
- Easy-to-use API
<page-tx-chat></page-tx-chat>
<page-tx-chat
model="string" <!-- Specifies the Hugging Face model to use -->
theme="string" <!-- Sets the color theme ("light" or "dark") -->
placeholder="string"<!-- Sets the placeholder text for the input field -->
send-button-text="string" <!-- Sets the text for the send button -->
task="string" <!-- Specifies the task for the AI model -->
></page-tx-chat>
| Attribute | Type | Default | Description |
|-----------|------|---------|-------------|
| model | String | "Xenova/Phi-3-mini-4k-instruct" | Specifies the Hugging Face model to use |
| theme | String | "light" | Sets the color theme ("light" or "dark") |
| placeholder | String | "Type a message" | Sets the placeholder text for the input field |
| send-button-text | String | "Send" | Sets the text for the send button |
| task | String | "text-generation" | Specifies the task for the AI model |
<page-tx-chat
model="Xenova/Phi-3-mini-4k-instruct"
theme="dark"
placeholder="Ask me anything..."
send-button-text="Go"
task="text-generation"
></page-tx-chat>
page-tx-chat {
--chat-bg-color: #f0f0f0;
--chat-text-color: #333;
--chat-input-bg: #fff;
--chat-input-color: #000;
--chat-button-bg: #4CAF50;
--chat-button-color: #fff;
}
This component relies on modern web technologies including Custom Elements v1 and Shadow DOM v1. It is supported in all major modern browsers.
- The AI model is loaded and run client-side, which may require significant processing power and memory.
- Initial load time may be longer due to downloading the model.
- Consider using a smaller model for better performance on less powerful devices.
As the AI processing happens client-side, no data is sent to external servers, enhancing privacy and data security.
This component is released under the MIT License.