simple-ai-chat
v0.1.28
Published
AI chat application based on large language models (LLMs), supports web and command-line interfaces. Available at `simple-ai.io`.
Downloads
99
Readme
Simple AI
Simple AI (simple-ai-chat) is a command-based AI chat application that supports both the web and CLI, aimed at providing users with an easy and simple AI experience.
It can use advanced large language models (LLMs) from multiple companies: OpenAI, xAI, Google AI, Anthropic, and Ollama models.
Text generation, image generation, and vision models are supported. Features like function calling and the Model Control Protocol (MCP) are also supported.
The application is deployed at simple-ai.io.
You can fork this code and deploy it on your own machine for non-commercial use. (For details, please refer to the LICENSE file.) For bugs or suggestions, please report them to the repository's GitHub Issues page.
Quick Start
Web use
https://simple-ai.ioCommand-line interface (CLI) use
Install:npm i simple-ai-chat -g
Start:schat
npm package:simple-ai-chatMCP client
Install:npm i simple-ai-chat -g
Usesmcp(or justschat) to start the client service.
Themcpconfig.jsonfile is located in the~/.simple.Ollama
Set the environment variableOLLAMA_ORIGINSto*or your domain to allow CORS.
Use:model lsto list the models, and:model use <model>to use the Ollama models.
To use function calling, set:stream offas in Ollama it's not supported.
Documentation
The documentation is available at simple-ai.io.
In the webpage, there is a little dot on the bottom right corner, click it to open the back page.
Alternatively, you can use the command :store use "Simple AI Documentation" to enable the data to AI, and ask it.
Local Installation
Prerequisites
OpenAI API key (get from https://platform.openai.com/account/api-keys)Install the requirements.
npm installCreate
.envand setup it.
Create.envfrom.env.example
For setup refer to the.envsection below.Build and run the app.
npm run build
Then usenpm run devornpm start
Dependencies
OpenAI https://platform.openai.com/docs/api-reference
React https://reactjs.org/
Next.js https://nextjs.org/
tailwind https://tailwindcss.com/docs/
Anthropic https://www.anthropic.com/
Google AI https://ai.google.dev/gemini-api/docs
xAI https://x.ai/
Ollama https://ollama.com/
WolframAlpha APIs https://products.wolframalpha.com/api
.env
Copy .env.example to .env and fill in the values.
NODE_ENV
For development environment use development.
For production environment use production.
NEXT_PUBLIC_BASE_URL
Fill in the base URL, for example: http://localhost:3000
ROOT_PASS
System root password, will be set when database initialized.
OPENAI_BASE_URL and OPENAI_API_KEY
Key can get from https://platform.openai.com/account/api-keys
Base URL is the API endpoint, https://api.openai.com/v1, etc...
MODEL
Large language model, gpt-4o, etc...
TEMPERATURE
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random
lower values like 0.2 will make it more focused and deterministic.
TOP_P
Range 0 ~ 1, 0.1 means only the tokens comprising the top 10% probability mass are considered.
ROLE_CONTENT_SYSTEM
Set the system prompt.
WELCOME_MESSAGE, INIT_PLACEHOLDER and ENTER
Control the custom welcome message, placeholder text and enter key text.
WAITING, QUERYING, GENERATING, SEARCHING
Indicating the message that will show when waiting and querying.
WOLFRAM_ALPHA_APPID
For API calls for wolfram alpha API.
Get from https://products.wolframalpha.com/api
USE_NODE_AI
Simple AI Node is available to help the chat answer with data.
To use multiple nodes, consider using Simple AI Hub.
DB
Database engline, example DB=sqlite.
Supported engine: sqlite.
JWT_SECRET
Secret for user authentication.
Generate with openssl rand -hex 16.
AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_S3_BUCKET_NAME
Config to use AWS service, eg, S3 Bucket, SES.
USE_ACCESS_CONTROL
When it enabled, will count user usage and limit access for normal user.
The value should be true or false.
USE_PAYMENT
Enable payment for upgrading user account.
The value should be true or false.
PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET
When using paypal as a payment method.
SAME_SITE_COOKIE
In production set to SameSite=Lax; Secure
USE_EMAIL
Use email to reset password or notifications.
The value should be true or false.
NEXT_PUBLIC_ROLE_USAGE_LIMIT and NEXT_PUBLIC_ROLE_AMOUNT
Usage limit is for setting limit for different roles.
Format: role:daily_limit,weekly_limit,monthly_limit.
Role amount is for setting price.
Format role:amount.
Roles are separated by ;.
HUNTER_API_KEY
Use hunter API to verify email.
GOOGLE_API_KEY
Use for detect accurate address.
MINIMALIST
For minimalist, a more simple UI.
The value should be true or false.
IPINFO_TOKEN
IP info (ipinfo.io) is used for getting country from IP.
Use IP info is for enable or disable the IP support, the value should be true or false.ipinfo.io token will be used.
NEXT_PUBLIC_DISCORD and NEXT_PUBLIC_YOUTUBE
Discord invitation link and YouTube channel link.
USE_USER_ACCOUNTS
Enable user accounts, the value should be true or false.
DEFAULT_FUNCTIONS, DEFAULT_ROLE, DEFAULT_STORES, DEFAULT_NODE
Default functions, role, stores and node.
Example:
DEFAULT_FUNCTIONS=get_time,get_weather,redirect_to_url
DEFAULT_STORES=store1,store2
Originally Forked from https://github.com/openai/openai-quickstart-node
