An AI-powered chat bot that can help with various tasks through natural language conversation. Engage in meaningful dialogue, get help with questions, and explore different topics through an intuitive chat interface.
Note: This is a development tool and proof-of-concept. Not intended for production use.
- Node.js 20.6.0 or higher
- OpenAI API key and/or AWS Bedrock credentials
- LDAP server (optional, for directory services)
- AI-powered conversational interface with streaming support
- Real-time chat interactions with context awareness
- Project management system
- File system operations and management
- Comprehensive tool integration system
- Responsive UI with collapsible panels
- Robust interrupt system for tools and text generation
- LDAP Tool: Directory services integration and user search
- Math Tool: Mathematical computations and expressions
- HTML Tool: Advanced HTML rendering and visualization
- Fetch Tool: HTTP request handling
- File Tools: File system operations (read/write/tree)
- Code Executor: Secure code execution environment
- Data Store: Data persistence and management
- Octokit Tool: GitHub API integration and repository management
- Bash Tool: Secure shell command execution
- X Tool: X (Twitter) integration for posts and feeds
- Project Search Tool: Search across projects and messages
-
Clone and setup environment:
git clone https://github.com/philwilliammee/tool-bot cd tool-bot cp example.env .env
-
Configure environment variables:
# Required OPENAI_API_KEY=your_openai_key # Optional AWS_ACCESS_KEY_ID=your_aws_key AWS_SECRET_ACCESS_KEY=your_aws_secret LDAP_URL=your_ldap_url LDAP_BASE_DN=your_base_dn GITHUB_TOKEN=your_github_token X_API_KEY=your_x_api_key
-
Install and run:
npm install npm run dev
-
Open
http://localhost:5173
in your browser
Script | Description |
---|---|
dev |
Starts both client (Vite) and server (Nodemon) in dev mode |
build |
Builds client and compiles server to dist-server/ |
start:dev |
Runs compiled server in development mode |
start:prod |
Runs server in production mode with .env |
clean |
Deletes dist folders |
preview |
Serves production build at http://localhost:4173 |
-
Build:
docker build -t tool-bot .
-
Development mode:
docker run -p 3000:3000 \ -v $(pwd):/usr/src/app \ -v /usr/src/app/node_modules \ --env-file .env \ tool-bot
-
Production mode:
docker run -p 3000:3000 --env-file .env tool-bot
- Chat Context: Manages conversation state and tool execution
- Project System: Handles project data and settings
- Tool Registry: Manages tool registration and execution
- Data Store: Persistent storage for projects and data
- Error Handling: Robust error recovery system
- UI State Management: Signal-based reactive state management
- Interrupt System: Manages interruption of tools and text generation
- Logger Utility: Structured, level-based logging system
The application features a responsive layout system with three main states:
- Normal: Default state with left panel at 30% width
- Left-expanded: Left panel expanded to full width, right panel collapsed
- Right-expanded: Right panel expanded to full width, left panel collapsed
Toggle buttons in each panel allow users to switch between these states.
The application also includes intelligent tab management:
- HTML Content Auto-switching: When HTML content is generated in a response, the application automatically switches to the Preview tab and sets the layout to normal mode for optimal viewing
- Re-execute Button: HTML content includes a re-execute button that refreshes the HTML and switches to the Preview tab
Tool-Bot uses IndexedDB for efficient data storage with these features:
- Separate storage for projects and messages
- Optimized queries with indexes
- Performance monitoring and metrics
- Batch operations for improved efficiency
- Support for large datasets
- Project search capabilities
For detailed implementation, see the Database directory in the source code.
- Keep API keys secure and never commit them to version control
- LDAP connections should use appropriate authentication
- Code execution is sandboxed but should be used cautiously
- Review tool permissions before deployment
- Validate all inputs in server-side tools
The application features a comprehensive interrupt system that allows users to:
- Interrupt specific running tools by their ID
- Interrupt all running tools at once
- Interrupt text generation
- Get immediate feedback on interrupt status
The interrupt button intelligently handles different scenarios:
- If a specific tool is running: Interrupts that tool
- If multiple tools are running: Interrupts all tools
- If text is being generated: Interrupts the generation
- Provides clear feedback through toast messages
The application includes a structured logging system with different severity levels:
- ERROR: Critical application errors (always displayed)
- WARN: Potential issues that don't stop the application
- INFO: General information about application operations
- DEBUG: Detailed debugging information (disabled in production)
The Logger automatically adjusts verbosity based on the environment (development vs. production) and can be further configured at runtime.
For detailed instructions on creating custom tools, please refer to the tools/README.md file.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- Use TypeScript for type safety
- Follow existing patterns for tool implementation
- Include tests for new features
- Update documentation as needed
- Store event handlers as class properties for proper cleanup
- Implemented IndexedDB for improved storage capacity and performance
- Added project search tool with filtering and relevance sorting
- Fixed incremental tool use input processing for highly fragmented chunks
- Fixed JSON parsing for streaming responses with escaped quotes and split chunks
- Improved error handling for unbalanced JSON in stream chunks
- Added comprehensive tests for LLMHandler and ConverseStore
- Signal-based reactive state management implementation
- Improved event handler management for proper cleanup
- Fixed UI toggle functionality
- Enhanced WorkArea component with better message display
- X Tool integration for social media interaction
- Enhanced GitHub integration via Octokit
- Auto-switching to preview tab for HTML content
- Added robust tool and text generation interrupt system
- Code and test coverage optimization
- SQL tool implementation
- Workflow system development
- Tool configuration UI
- Tool response formatting inconsistencies
- Minor UI rendering glitches in some browsers
Performance degrades with very large chat histories(Fixed with IndexedDB โ )Streaming JSON parsing failures(Fixed โ )
- Initial project setup and architecture
- Basic tool system implementation
- Chat interface with streaming
- File system operations
- Directory services integration
- Advanced HTML rendering
- Mathematical computation support
- Data persistence layer
- GitHub integration
- Social media integration
- Responsive UI layout system
- SQL integration
- โ Archive management
- Workflow automation
- โ Tool configuration UI
- Enhanced security features
- โ Efficient data storage with IndexedDB
- WebAssembly tool integration
- Multi-model AI support
- Real-time collaboration
- Custom tool marketplace
- Advanced visualization capabilities
- AI-powered workflow automation
- Standardize Import/Export Format
For issues and feature requests, please use the GitHub issue tracker.
This project is licensed under the MIT License - see the LICENSE file for details.
Tool-Bot includes a robust project management system that allows you to:
- Create multiple projects with different configurations
- Switch between projects easily
- Configure project-specific AI models and system prompts
- Enable or disable specific tools for each project
- Clone existing projects to use as templates or backups
- Manage project metadata and settings
- Import/export projects for backup or sharing
- Persistent storage using IndexedDB for larger data capacity
The application includes a powerful search tool that allows you to:
- Search across all projects and messages
- Filter by project, date range, or message type
- Sort results by date or relevance
- Navigate directly to search results
To configure tools for a project:
- Click "Manage Projects" in the project dropdown
- Find the project you want to configure
- In the Project Configuration section, check or uncheck tools in the "Enabled Tools" list
- Click "Save Configuration" to apply your changes
This allows you to create specialized projects with only the tools needed for specific tasks.
To clone a project:
- Click "Manage Projects" in the project dropdown
- Find the project you want to clone
- Click the "Clone" button
- Enter a name for the new project (or accept the default "Copy of [Original]")
- The cloned project will appear in your project list with all the same settings
When developing components for Tool-Bot, follow these best practices:
-
Event Handler Management:
- Store event handler functions as class properties
- Use these stored references when both adding and removing event listeners
- This ensures proper cleanup and prevents memory leaks
-
State Management:
- Use signals for reactive state
- Prefer computed signals for derived state
- Set up effects to respond to state changes
-
Component Lifecycle:
- Initialize all resources in a consistent way
- Clean up all resources in the destroy method
- Store cleanup functions in an array for easy management
-
UI Layout Interactions:
- Respect the established layout system (normal, left-expanded, right-expanded)
- Avoid duplicate event handlers for layout controls
- Use the signals from AppStore for layout state
When writing tests for Tool-Bot, follow these guidelines:
-
Mock External Dependencies:
- Use Vitest's mocking capabilities to isolate the component being tested
- Mock complex handlers like LLMHandler, ToolHandler, and MessageManager
-
Test Edge Cases:
- Include tests for escaped characters in JSON responses
- Test handling of split chunks
- Verify error recovery mechanisms work correctly
-
Test Structure:
- Use clear describe/it blocks to organize tests
- Set up mocks in beforeEach blocks
- Clear mocks in afterEach blocks
- Use meaningful test names that describe the behavior being tested
-
Test Config:
- Exclude temporary directories (e.g., .local) using vitest.config.ts
- Configure appropriate timeouts for async tests