
lota canada
一个基于 Next.js 构建的 TypeScript 项目,支持 React 19 并集成 LOTA-LLM 工具。
Repository Info
About This Server
一个基于 Next.js 构建的 TypeScript 项目,支持 React 19 并集成 LOTA-LLM 工具。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Lota Project
This is the Lota project, a Next.js application deployed on Vercel.
Deployment
This project is automatically deployed to Vercel using GitHub Actions.
Getting Started
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
React 19 Compatibility
This project uses React 19, which is the latest version of React. However, some dependencies haven't updated their peer dependencies to support React 19 yet. To handle this, we use the --legacy-peer-deps flag when installing dependencies.
Development Container Setup
When using the development container:
- The container will automatically install all dependencies and start the development server.
- The container includes all necessary tools for development, including Node.js, npm, and Git.
- The container also includes MCP tools and browser tools for enhanced development experience.
MCP and Browser Tools
The development container includes MCP (Multi-Cloud Platform) tools and browser tools:
MCP Tools
- MCP VS Code Extension for AI-powered code completion and assistance
- MCP CLI for command-line interface to MCP services
To use MCP tools, you need to set the MCP_API_KEY environment variable on your host machine before starting the container. You can use the provided setup script:
# Make the script executable
chmod +x setup-mcp.sh
# Run the setup script
./setup-mcp.sh
The script will:
- Create the necessary MCP directories
- Prompt you for your MCP API key
- Store the API key in the MCP config directory
- Add the API key to your shell profile
- Set the environment variable for the current session
Browser Tools
- Playwright for end-to-end testing with browser automation
- Browser Preview for previewing web pages in VS Code
- Live Server for launching a local development server
For more details, see MCP and Browser Tools Documentation.
Manual Installation
If you're not using the development container, install dependencies with:
npm install --legacy-peer-deps
Project Structure
The project follows a structured approach to organize the codebase efficiently. Below is an overview of the project structure:
lota-canada/
├── app/ # Next.js App Router pages
├── components/ # Reusable React components
│ ├── ui/ # UI components (buttons, cards, etc.)
│ └── [feature]/ # Feature-specific components
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and shared code
├── public/ # Static assets
└── styles/ # Global styles
TypeScript Standards
This project uses TypeScript for type safety and better developer experience. Follow these guidelines:
- Use TypeScript for all new files: Create
.tsxfor React components and.tsfor utility functions. - Avoid JavaScript files: Do not create new
.jsxor.jsfiles. - Type definitions: Define interfaces and types for component props and function parameters.
- Strict mode: TypeScript is configured in strict mode. Avoid using
anytype when possible.
Component Guidelines
-
Component Organization:
- UI components go in
components/ui/ - Feature-specific components go in
components/[feature]/
- UI components go in
-
Component Structure:
- Use functional components with hooks
- Define prop types with interfaces
- Export components as named exports when appropriate
-
Component Example:
import { FC } from "react"; interface ButtonProps { variant?: "primary" | "secondary"; size?: "sm" | "md" | "lg"; children: React.ReactNode; onClick?: () => void; } export const Button: FC<ButtonProps> = ({ variant = "primary", size = "md", children, onClick, }) => { // Component implementation };
Import Standards
-
Import Order:
- React and Next.js imports first
- Third-party libraries next
- Project imports last
- Separate each group with a blank line
-
Import Paths:
- Use absolute imports with
@/prefix for project files - Example:
import { Button } from "@/components/ui/button";
- Use absolute imports with
Common Issues and Solutions
Duplicate Page Errors
If you see warnings like Duplicate page detected. app/page.jsx and app/page.tsx resolve to /:
- Use the cleanup script to remove duplicate files
- Ensure you're only using TypeScript files
Component Import Errors
If you encounter errors like Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined:
- Check that the component is properly exported
- Verify the import path is correct
- Run the fix-imports script to standardize imports
Scripts
Cleanup Duplicates Script
This script identifies and removes duplicate .jsx files where .tsx versions exist.
# Make the script executable
chmod +x cleanup-duplicates.sh
# Run the script
./cleanup-duplicates.sh
The script will:
- Find all
.jsxfiles in the app, components, lib, and hooks directories - Check if a corresponding
.tsxfile exists - Ask for confirmation before removing each duplicate file
Fix Imports Script
This script identifies and fixes component import inconsistencies.
# Make the script executable
chmod +x fix-imports.sh
# Run the script
./fix-imports.sh
The script will:
- Find all TypeScript and JavaScript files in the project
- Check for UI component imports
- Replace any temporary component imports with the standard ones
TypeScript Check Script
This script checks for TypeScript errors in the project.
# Make the script executable
chmod +x check-typescript.sh
# Run the script
./check-typescript.sh
The script will:
- Run the TypeScript compiler in noEmit mode
- Report any type errors found in the project
Additional Resources
For more detailed information about the project structure and TypeScript standards, refer to the PROJECT_STRUCTURE.md and README-TYPESCRIPT.md files.
Learn More
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
LOTA-LLM Website Integration Demo
This project demonstrates how to deploy LOTA-LLM locally and integrate it into a website using the embed widget.
Prerequisites
- Docker installed on your machine
- Node.js installed on your machine
- An OpenAI API key (or another supported LLM provider)
Setup Instructions
1. Deploy LOTA-LLM
-
Navigate to the SolnAI-llm/docker directory:
cd SolnAI-llm/docker -
Edit the
.envfile and set your OpenAI API key:OPEN_AI_KEY='your-openai-api-key-here' -
Start the LOTA-LLM Docker container:
docker-compose up -d -
Access LOTA-LLM at http://localhost:3001
2. Configure LOTA-LLM
- Create an account (since multi-user mode is enabled)
- Create a workspace
- Upload documents to the workspace
- Go to Settings > Embedding in the workspace
- Enable embedding and copy the embed ID
3. Update the Website
- Edit the
website-with-embed.htmlfile and replaceyour-embed-id-herewith your actual embed ID from LOTA-LLM.
4. Start the Website
-
Start the website server:
node server.js -
Access the website at http://localhost:8080
How It Works
- LOTA-LLM runs in a Docker container and provides the backend for document processing, vector storage, and LLM integration.
- The embed widget is loaded from the LOTA-LLM server and injected into your website.
- The embed widget connects to your LOTA-LLM instance and allows users to chat with your documents.
Customization
You can customize the embed widget by modifying the data attributes in the script tag:
<script
data-embed-id="your-embed-id-here"
data-base-api-url="http://localhost:3001/api/embed"
data-button-color="#4a6cf7"
data-greeting="Hello! How can I help you today?"
data-assistant-name="Your Company Assistant"
data-position="bottom-right"
src="http://localhost:3001/embed/lota-llm-chat-widget.min.js"
></script>
See the LOTA-LLM Embed documentation for more customization options.
Production Deployment
For production deployment:
- Deploy LOTA-LLM to a server with a domain name
- Update the
data-base-api-urlto point to your production LOTA-LLM instance - Update the
srcattribute to point to your production LOTA-LLM embed script - Deploy your website to a production server
Security Considerations
- Make sure to set the
CHAT_EMBED_WHITELISTin the LOTA-LLM.envfile to restrict which domains can embed the chat widget - Consider setting limits on the number of chats per embedding and per session
- Secure your LOTA-LLM instance with proper authentication and HTTPS
Quick Start
Clone the repository
git clone https://github.com/dislovemartin/lota-canadaInstall dependencies
cd lota-canada
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.