{"id":17513016,"url":"https://github.com/toi500/toibot","last_synced_at":"2025-04-23T13:12:24.183Z","repository":{"id":258431844,"uuid":"873917654","full_name":"toi500/toibot","owner":"toi500","description":"ToiBot is a chatbot application built with Node.js that showcases the capabilities of the Flowise SDK.","archived":false,"fork":false,"pushed_at":"2024-10-17T17:56:15.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-20T05:34:33.306Z","etag":null,"topics":["ai","ai-agent","chatbot","flowise","flowiseai","generative-ai","langchain","langgraph-js"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toi500.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-17T00:17:49.000Z","updated_at":"2024-10-17T21:37:20.000Z","dependencies_parsed_at":"2024-10-19T01:07:25.275Z","dependency_job_id":null,"html_url":"https://github.com/toi500/toibot","commit_stats":null,"previous_names":["toi500/toibot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toi500%2Ftoibot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toi500%2Ftoibot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toi500%2Ftoibot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toi500%2Ftoibot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toi500","download_url":"https://codeload.github.com/toi500/toibot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":220692115,"owners_count":16688825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agent","chatbot","flowise","flowiseai","generative-ai","langchain","langgraph-js"],"created_at":"2024-10-20T06:06:43.833Z","updated_at":"2025-03-05T17:32:55.401Z","avatar_url":"https://github.com/toi500.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ToiBot Chatbot\n\nToiBot is a chatbot application built with Node.js and powered by [Flowise SDK](https://www.npmjs.com/package/flowise-sdk). It provides a functional and customizable chatbot web interface that enables users to interact with their Flowise workflows.\n\nhttps://github.com/user-attachments/assets/f48f6434-a2dc-4aa1-b218-e1622079b760\n\nNew on Flowise? Check out [FlowiseAI](https://flowiseai.com) to get started.\n\n##  🚀 Features\n\n- **Real-time Chat Interface**: Engage with your Flowise flows in real time through a user-friendly interface.\n- **Streaming**: Receive responses in a continuous stream, providing a more natural and engaging conversational experience.\n- **Follow-up Prompts**: Suggest follow-up questions to enhance user engagement.\n- **File Upload Support**: Upload and process various file types including TXT, PDF, DOC, DOCX, CSV, JSON, and XML.\n- **Image Upload Support**: Upload and process image files with preview functionality.\n- **Image Display**: The chatbot can display images received in the conversation.\n- **Attachment Preview**: Shows thumbnails for uploaded images and file information for documents.\n- **File Size Limits**: Enforces configurable size limits based on Flowise settings.\n- **Drag-and-Drop Functionality**: Supports drag-and-drop for uploading files and images.\n- **AI Message Copying**: Users can easily copy AI-generated messages.\n- **Dynamic Upload Controls**: Shows/hides upload buttons based on Flowise configuration.\n- **Session Management**: Preserve context throughout interactions by utilizing session IDs.\n- **Chat History**: Maintains conversation history across sessions using local storage.\n- **Reset Functionality**: Allows users to start fresh conversations.\n- **Auto-growing Input**: The chat input field automatically expands as you type, providing a comfortable writing experience while maintaining a clean interface.\n- **Boxed/Full Screen Mode**: Allows users to switch between a boxed chat interface and a fullscreen experience.\n- **Customizable Welcome Message**: Allows defining a personalized welcome message to greet users upon entering the chat.\n- **Visual Feedback**: Displays loading animations and progress indicators during operations.\n- **Markdown Support**: Responses are displayed with Markdown formatting to improve readability and presentation.\n- **API Proxy**: The proxy ensures that sensitive information like your API host and chatflow ID are never exposed to the client-side code.\n- **Security**: Employs the Flowise API key to ensure continuous chatbot security.\n- **Embed Feature**: Easily embed the chatbot on any webpage with a simple script tag.\n\n## 📋 Prerequisites \n\n- An active [Flowise workflow](https://github.com/FlowiseAI/Flowise) and Flowise API key (free!).\n- Node.js (version 14 or higher)\n- npm (Node Package Manager)\n\n## 🛠️ Installation \n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/toi500/ToiBot.git\n   cd ToiBot\n   ```\n\n2. Install the dependencies:\n\n   ```bash\n   npm install\n   ```\n\n3. Create a `.env` file in the root directory and add your Flowise API credentials:\n\n   ```plaintext\n   FLOWISE_API_KEY=your_api_key_here\n   FLOWISE_BASE_URL=your_base_url_here\n   FLOWISE_CHATFLOW_ID=your_chatflow_id_here\n   ```\n\n4. Start the server:\n\n   ```bash\n   npm start # or\n   npm run dev\n   ```\n\n5. Open a web browser and navigate to `http://localhost:3000` to interact with the chatbot.\n\n## 🌐 Embedding the Chatbot \n\n### Basic Integration\n\nTo embed the chatbot on any webpage, include the following script tag and custom element:\n\n```html\n\u003c!-- Basic usage (defaults to fullscreen) --\u003e\n\u003cscript defer src=\"https://your-server-url/embed/toibot.js\"\u003e\u003c/script\u003e\n\u003ctoi-bot\u003e\u003c/toi-bot\u003e\n```\n\n```html\n\u003c!-- With customization --\u003e\n\u003cscript defer src=\"https://your-server-url/embed/toibot.js\"\u003e\u003c/script\u003e\n\u003ctoi-bot\n  fullscreen=\"false\"\n  hide-fullscreen-toggle=\"false\"\n  welcome-message=\"Hello! How can I assist you today?\"\n  custom-styles=\"\n    .chat-container { background: #f5f5f5; }\n    .message.bot { background: #e3f2fd; }\n    .message.user { background: #f5f5f5; }\n    /* Add more custom styles here */\n  \"\n\u003e\u003c/toi-bot\u003e\n```\n\n#### Available Attributes\n\n- **`fullscreen`**: Controls whether the chatbot opens in fullscreen mode\n  - `\"true\"` (default) - Opens in fullscreen\n  - `\"false\"` - Opens in boxed mode\n- **`hide-fullscreen-toggle`**: Controls visibility of the fullscreen toggle button\n  - `\"true\"` (default) - Hides the toggle\n  - `\"false\"` - Shows the toggle\n- **`welcome-message`**: Sets a custom welcome message for new chat sessions\n- **`custom-styles`**: Injects custom CSS to modify the chatbot's appearance\n\n## 🔧 Server File Configuration \n\n### System Override\n\nIn `server.js`, you can customize the AI's behavior by modifying the `predictionConfig` object: (via `overrideConfig`)\n\n```javascript:server.js\nconst predictionConfig = {\n  chatflowId: process.env.FLOWISE_CHATFLOW_ID,\n  question,\n  chatId: sessionId || uuidv4(),\n  streaming: true,\n  uploads: [],\n  overrideConfig: {\n    systemMessage: 'You are a helpful AI assistant. You are friendly and concise...'\n  }\n};\n```\n\n### Available Override Options\n\nThe `overrideConfig` property accepts the following configurations:\n\n```javascript\noverrideConfig: {\n  systemMessage: 'Your system message here',\n  // Add other Flowise-supported configurations\n}\n```\n\n## ⚙️ Dynamic Configuration \n\nThe chatbot now automatically adapts to your Flowise chatflow configuration:\n\n- **Upload Features**: Buttons for file and image uploads are dynamically shown/hidden based on your Flowise settings.\n- **Follow-up Prompts**: Can be enabled/disabled through Flowise configuration.\n\n## 🔒 Security Considerations \n\n### API Protection Layer\n\n![capture](https://github.com/user-attachments/assets/9e5a177f-3a7a-4bd6-91b3-e43f59c7b7a4)\n\nToiBot implements a robust security architecture to protect sensitive information and prevent direct exposure of your Flowise infrastructure:\n\n- **Proxy Protection**: All API calls are routed through a secure backend proxy (`your-server-url/api/chat`), ensuring that sensitive endpoints and credentials are never exposed to the client side.\n- **Credential Isolation**: Flowise API keys, base URLs, and chatflow IDs remain strictly server-side, preventing exposure in client-side code or network requests.\n- **Request Validation**: All incoming requests are validated and sanitized before being forwarded to the Flowise API.\n\n### Network Architecture\n\n```plaintext\nClient Browser \u003c-\u003e ToiBot Server (Proxy) \u003c-\u003e Flowise API\n         [your-server-url/api/*]    [Your Flowise Instance]\n```\n\nThis architecture ensures that:\n- Client-side code never directly accesses the Flowise API\n- API credentials remain secure on the server\n- All requests are properly authenticated and validated\n- Response data is sanitized before being sent to the client\n\n### Best Practices\n\nWhen deploying ToiBot:\n- Always use environment variables for sensitive credentials\n- Keep all dependencies updated to patch security vulnerabilities\n\n## ⚠️ Disclaimer \n\nUsers are encouraged to fork the project and adapt it to their specific needs and use cases. Please note that ongoing support or updates should not be expected.\n\n## License 📄\n\nThis project is licensed under the [ISC License](https://opensource.org/license/isc-license-txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoi500%2Ftoibot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoi500%2Ftoibot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoi500%2Ftoibot/lists"}