internal/development.md
docker compose -f docker/docker-compose-base.yml up -d
./build.sh --cpp
./build.sh --go
Note: admin_server must be started first; otherwise, ragflow_server will encounter errors when sending heartbeats.
# Start admin server
./bin/admin_server
# Start RAGFlow server
./bin/ragflow_server
# Run CLI
./bin/ragflow_cli
cd web && export API_PROXY_SCHEME=hybrid && npm run dev
After updating or implementing an API, update the frontend development environment routes in web/vite.config.ts under proxySchemes.
| Scheme | Description |
|---|---|
python | All API requests from the frontend are routed to the Python server |
hybrid | API requests are partially routed to the Go server and partially to the Python server |
go | All API requests from the frontend are routed to the Go server |
You can use the following CLI commands to test the corresponding API implementations.
$ ./ragflow_cli
Welcome to RAGFlow CLI
Type \? for help, \q to quit
RAGFlow(user)> REGISTER USER '[email protected]' AS 'aaa' PASSWORD 'aaa';
Register successfully
RAGFlow(user)> login user '[email protected]';
password for [email protected]: Password:
Login user [email protected] successfully
RAGFlow(user)> logout;
SUCCESS
RAGFlow(user)> list available providers;
RAGFlow(user)> add provider 'openai';
RAGFlow(user)> delete provider 'openai';
RAGFlow(user)> create provider 'openai' instance 'instance_name' key 'api-key';
Note: The api-key is a valid API key that needs to be applied for. You can create multiple instances for the same model provider, each with a different API key.
For locally deployed models (e.g., ollama, vLLM), use the following command to add a model instance:
RAGFlow(user)> create provider 'vllm' instance 'instance_name' key '' url 'http://192.168.1.96:8123/v1';
RAGFlow(user)> list instances from 'openai';
RAGFlow(user)> drop instance 'instance_name' from 'openai';
RAGFlow(user)> list models from 'openai' 'instance_name';
RAGFlow(user)> chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM';
Answer: A large language model is an AI trained on vast text data to understand, generate, and refine human-like language.
Time: 1.052269
RAGFlow(user)> think chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM';
Thinking: I need to create a concise 20-word introduction to LLMs...
Answer: Large Language Models are AI systems trained on vast datasets, enabling human-like text generation, comprehension, and problem-solving across diverse applications.
Time: 11.592358
RAGFlow(user)> stream chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM';
Answer: Language Models are advanced AI systems. They process text to learn, generate human-like responses, and perform diverse tasks through machine learning.
Time: 2.615930
RAGFlow(user)> stream think chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM';
Thinking: The user is asking for a very concise introduction to LLMs...
Answer: language models are AI systems trained on vast text datasets to understand and generate human-like text for diverse tasks.
Time: 11.958035
RAGFlow(user)> chat with 'glm-4.6v-flash@test@zhipu-ai' message 'What are the pics talk about?' image 'https://cdn.bigmodel.cn/static/logo/register.png' 'https://cdn.bigmodel.cn/static/logo/api-key.png'
Answer: The first picture shows a login/register modal... The second picture displays the API keys management page...
Time: 31.600545
RAGFlow(user)> chat with 'glm-4.6v-flash@test@zhipu-ai' message 'What are the video talk about?' video 'https://cdn.bigmodel.cn/agent-demos/lark/113123.mov'
Answer: Based on the sequence of frames provided, the video is a demonstration of a web search and navigation process...
Time: 76.582520
Note: Both image and video understanding support streaming and thinking modes as well.
RAGFlow(user)> embed text 'what is rag' 'who are you' with 'embedding-3@test@zhipu-ai' dimension 16;
RAGFlow(user)> rerank query 'what is rag' document 'rag is retrieval augment generation' 'rag need llm' 'famous rag project includes ragflow' with 'rerank@test@zhipu-ai' top 2;
RAGFlow(user)> list supported models from 'minimax' 'test';
+------------------------+
| model_name |
+------------------------+
| MiniMax-M2.7 |
| MiniMax-M2.7-highspeed |
| MiniMax-M2.5 |
| MiniMax-M2.5-highspeed |
| MiniMax-M2.1 |
| MiniMax-M2.1-highspeed |
| MiniMax-M2 |
+------------------------+
RAGFlow(user)> list models from 'minimax';
+------------+-------------+------------------------+
| max_tokens | model_types | name |
+------------+-------------+------------------------+
| 204800 | [chat] | minimax-m2.7 |
| 204800 | [chat] | minimax-m2.7-highspeed |
| 204800 | [chat] | minimax-m2.5 |
| 204800 | [chat] | minimax-m2.5-highspeed |
| 204800 | [chat] | minimax-m2.1 |
| 204800 | [chat] | minimax-m2.1-highspeed |
| 204800 | [chat] | minimax-m2 |
| 65536 | [chat] | minimax-m2-her |
+------------+-------------+------------------------+
RAGFlow(user)> list instances from 'zhipu-ai';
+---------+----------------------+----------------------------------+--------------+----------------------------------+--------+
| apiKey | extra | id | instanceName | providerID | status |
+---------+----------------------+----------------------------------+--------------+----------------------------------+--------+
| api-key | {"region":"default"} | 19f620e73c7a11f1a51138a74640adcc | test | d21a3758398f11f1ab4838a74640adcc | enable |
+---------+----------------------+----------------------------------+--------------+----------------------------------+--------+
RAGFlow(user)> show instance 'test' from 'zhipu-ai';
+----------------------------------+--------------+----------------------------------+---------+--------+
| id | instanceName | providerID | region | status |
+----------------------------------+--------------+----------------------------------+---------+--------+
| 19f620e73c7a11f1a51138a74640adcc | test | d21a3758398f11f1ab4838a74640adcc | default | enable |
+----------------------------------+--------------+----------------------------------+---------+--------+
RAGFlow(user)> list models from 'minimax' 'test';
+------------+-------------+------------------------+--------+
| max_tokens | model_types | name | status |
+------------+-------------+------------------------+--------+
| 204800 | [chat] | minimax-m2.7 | active |
| 204800 | [chat] | minimax-m2.7-highspeed | active |
| 204800 | [chat] | minimax-m2.5 | active |
| 204800 | [chat] | minimax-m2.5-highspeed | active |
| 204800 | [chat] | minimax-m2.1 | active |
| 204800 | [chat] | minimax-m2.1-highspeed | active |
| 204800 | [chat] | minimax-m2 | active |
| 65536 | [chat] | minimax-m2-her | active |
+------------+-------------+------------------------+--------+
RAGFlow(user)> list providers;
+--------------------------------------------------------------------------+-------------+--------------+
| base_url | name | total_models |
+--------------------------------------------------------------------------+-------------+--------------+
| map[default:https://ark.cn-beijing.volces.com/api/v3] | VolcEngine | 2 |
| map[default:https://api.minimaxi.com/ global:https://api.minimax.io/] | MiniMax | 8 |
| map[default:https://api.moark.com/v1] | Gitee | 5 |
+--------------------------------------------------------------------------+-------------+--------------+
RAGFlow(user)> disable model 'deepseek-v4-pro' from 'deepseek' 'test';
SUCCESS
RAGFlow(user)> list models from 'deepseek' 'test';
+------------+-------------+-------------------+----------+
| max_tokens | model_types | name | status |
+------------+-------------+-------------------+----------+
| 1048576 | [chat] | deepseek-v4-flash | active |
| 1048576 | [chat] | deepseek-v4-pro | inactive |
+------------+-------------+-------------------+----------+
RAGFlow(user)> enable model 'deepseek-v4-pro' from 'deepseek' 'test';
SUCCESS
RAGFlow(user)> use model 'glm-4.5-flash@test@zhipu-ai';
SUCCESS
RAGFlow(user)> chat message '20 words introduce LLM';
Answer: Large language models are advanced AI systems. They process text to understand, generate, and refine human-like language for countless tasks.
Time: 1.680416
RAGFlow(user)> set default chat model 'zhipu-ai/test/glm-4.5-flash';
SUCCESS
RAGFlow(user)> set default vision model 'zhipu-ai/test/glm-4.5v';
SUCCESS
RAGFlow(user)> set default embedding model 'zhipu-ai/test/embedding-2';
SUCCESS
RAGFlow(user)> set default rerank model 'zhipu-ai/test/rerank';
SUCCESS
RAGFlow(user)> set default ocr model 'zhipu-ai/test/glm-ocr';
SUCCESS
RAGFlow(user)> set default tts model 'zhipu-ai/test/glm-tts';
SUCCESS
RAGFlow(user)> set default asr model 'zhipu-ai/test/glm-asr-2512';
SUCCESS
RAGFlow(user)> list default models;
+--------+----------------+---------------+----------------+------------+
| enable | model_instance | model_name | model_provider | model_type |
+--------+----------------+---------------+----------------+------------+
| true | test | glm-4.5-flash | zhipu-ai | chat |
| true | test | embedding-2 | zhipu-ai | embedding |
| true | test | rerank | zhipu-ai | rerank |
| true | test | glm-asr-2512 | zhipu-ai | asr |
| true | test | glm-4.5v | zhipu-ai | vision |
| true | test | glm-ocr | zhipu-ai | ocr |
| true | test | glm-tts | zhipu-ai | tts |
+--------+----------------+---------------+----------------+------------+
RAGFlow(user)> reset default embedding model;
SUCCESS
RAGFlow(user)> reset default chat model
SUCCESS
RAGFlow(user)> list default models;
+--------+----------------+--------------+----------------+------------+
| enable | model_instance | model_name | model_provider | model_type |
+--------+----------------+--------------+----------------+------------+
| true | test | rerank | zhipu-ai | rerank |
| true | test | glm-asr-2512 | zhipu-ai | asr |
| true | test | glm-4.5v | zhipu-ai | vision |
| true | test | glm-ocr | zhipu-ai | ocr |
| true | test | glm-tts | zhipu-ai | tts |
+--------+----------------+--------------+----------------+------------+
RAGFlow(user)> show balance from 'gitee' 'test';
+-------------+----------+
| balance | currency |
+-------------+----------+
| 82.49835029 | CNY |
+-------------+----------+
RAGFlow(user)> check instance 'test' from 'zhipu-ai';
SUCCESS
RAGFlow(user)> add model 'Qwen/Qwen2.5-0.5B' to provider 'vllm' instance 'test' with tokens 131072 chat;
SUCCESS
RAGFlow(user)> list models from 'vllm' 'test';
+-------------------+--------+
| name | status |
+-------------------+--------+
| Qwen/Qwen2.5-0.5B | active |
+-------------------+--------+
RAGFlow(user)> drop model 'Qwen/Qwen2.5-0.5B' from 'vllm' 'test';
SUCCESS
RAGFlow(user)> list datasets;
+-------------+--------------+----------------+----------------------+----------------------------------+----------+------+----------+------------+----------------------------------+-----------+---------------+
| chunk_count | chunk_method | document_count | embedding_model | id | language | name | nickname | permission | tenant_id | token_num | update_time |
+-------------+--------------+----------------+----------------------+----------------------------------+----------+------+----------+------------+----------------------------------+-----------+---------------+
| 492 | naive | 1 | embedding-2@ZHIPU-AI | e93ab2c04ad111f1b17438a74640adcc | English | aaa | aaa | me | 2ba4881420fa11f19e9c38a74640adcc | 74278 | 1778245825722 |
| 0 | naive | 1 | embedding-2@ZHIPU-AI | 0abe79f9423311f1ad8d38a74640adcc | English | ccc | aaa | me | 2ba4881420fa11f19e9c38a74640adcc | 0 | 1777375201933 |
+-------------+--------------+----------------+----------------------+----------------------------------+----------+------+----------+------------+----------------------------------+-----------+---------------+