diff --git a/conf/models/gitee.json b/conf/models/gitee.json index f2989f0244..629a7e2892 100644 --- a/conf/models/gitee.json +++ b/conf/models/gitee.json @@ -71,6 +71,12 @@ "ocr" ] }, + { + "name": "jina-clip-v2", + "model_types": [ + "embedding" + ] + }, { "name": "HunyuanOCR", "model_types": [ diff --git a/internal/development.md b/internal/development.md index 8e0f275e17..f702461560 100644 --- a/internal/development.md +++ b/internal/development.md @@ -67,30 +67,30 @@ $ ./ragflow_cli Welcome to RAGFlow CLI Type \? for help, \q to quit -RAGFlow(user)> REGISTER USER 'aaa@aaa.com' AS 'aaa' PASSWORD 'aaa'; +RAGFlow(api/default)> REGISTER USER 'aaa@aaa.com' AS 'aaa' PASSWORD 'aaa'; Register successfully -RAGFlow(user)> login user 'aaa@aaa.com'; +RAGFlow(api/default)> login user 'aaa@aaa.com'; password for aaa@aaa.com: Password: Login user aaa@aaa.com successfully -RAGFlow(user)> logout; +RAGFlow(api/default)> logout; SUCCESS ``` ### 6.2. List currently supported providers ``` -RAGFlow(user)> list available providers; +RAGFlow(api/default)> list available providers; ``` ### 6.3. Add or delete a provider for the current tenant ``` -RAGFlow(user)> add provider 'openai'; +RAGFlow(api/default)> add provider 'openai'; ``` ``` -RAGFlow(user)> delete provider 'openai'; +RAGFlow(api/default)> delete provider 'openai'; ``` ### 6.4. Create a model instance for a specific provider ``` -RAGFlow(user)> create provider 'openai' instance 'instance_name' key 'api-key'; +RAGFlow(api/default)> 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. @@ -98,55 +98,55 @@ Note: The api-key is a valid API key that needs to be applied for. You can creat 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(api/default)> create provider 'vllm' instance 'instance_name' key '' url 'http://192.168.1.96:8123/v1'; ``` ### 6.5. List and delete an instance ``` -RAGFlow(user)> list instances from 'openai'; +RAGFlow(api/default)> list instances from 'openai'; ``` ``` -RAGFlow(user)> drop instance 'instance_name' from 'openai'; +RAGFlow(api/default)> drop instance 'instance_name' from 'openai'; ``` ### 6.6. List models supported by a model instance ``` -RAGFlow(user)> list models from 'openai' 'instance_name'; +RAGFlow(api/default)> list models from 'openai' 'instance_name'; ``` ### 6.7. Chat with LLM - Chat ``` -RAGFlow(user)> chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM'; +RAGFlow(api/default)> 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 ``` - Chat with Thinking (Reasoning) ``` -RAGFlow(user)> think chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM'; +RAGFlow(api/default)> 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 ``` - Streaming Chat ``` -RAGFlow(user)> stream chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM'; +RAGFlow(api/default)> 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 ``` - Streaming Chat with Thinking ``` -RAGFlow(user)> stream think chat with 'glm-4.5-flash@test@zhipu-ai' message '20 words introduce LLM'; +RAGFlow(api/default)> 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 ``` - Image Understanding ``` -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' +RAGFlow(api/default)> 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 ``` - Video Understanding ``` -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' +RAGFlow(api/default)> 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 ``` @@ -154,34 +154,39 @@ Note: Both image and video understanding support streaming and thinking modes as ### 6.8. Generate Embeddings ``` -RAGFlow(user)> embed text 'what is rag' 'who are you' with 'embedding-3@test@zhipu-ai' dimension 16; +RAGFlow(api/default)> embed text 'what is rag' 'who are you' with 'embedding-3@test@zhipu-ai' dimension 16; ``` ### 6.9. Document Reranking ``` -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(api/default)> 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; ``` ### 6.10. Get supported models from provider API ``` -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(api/default)> list supported models from 'gitee' 'test'; ++-----------+---------------------------+---------------+------------+-----------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------+ +| dimension | dimensions | max_dimension | max_tokens | model_types | name | thinking | ++-----------+---------------------------+---------------+------------+-----------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------+ +| | | | | | bce-embedding-base_v1@maidalun1020 | | +| | | | | | bce-embedding-base_v1@maidalun1020 | | +| | | | 8192 | [rerank] | jina-reranker-m0@jinaai | | +| | | | 8192 | [rerank] | jina-reranker-m0@jinaai | | +| | [64 128 256 512 768] | | 8192 | [embedding vision] | jina-clip-v1@jinaai | | +| | [64 128 256 512 768] | | 8192 | [embedding vision] | jina-clip-v1@jinaai | | +| | | | 32768 | [chat] | Qwen2.5-Coder-14B-Instruct@Qwen | | +| | | | 32768 | [chat] | Qwen2.5-Coder-14B-Instruct@Qwen | | +| | [64 128 256 512 768 1024] | | 8192 | [embedding vision] | jina-clip-v2@jinaai | | +| | | | 262144 | [chat image2text vision video_understanding] | Qwen3.6-27B@Qwen | map[clear_thinking:true default_value:true] | +| | | | 262144 | [chat image2text vision video_understanding] | Qwen3.6-27B@Qwen | map[clear_thinking:true default_value:true] | +| | | | 32768 | [rerank] | Qwen3-Reranker-0.6B@Qwen | | ++-----------+---------------------------+---------------+------------+-----------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------+ ``` ### 6.11. Get preset models of a provider ``` -RAGFlow(user)> list models from 'minimax'; +RAGFlow(api/default)> list models from 'minimax'; +------------+-------------+------------------------+ | max_tokens | model_types | name | +------------+-------------+------------------------+ @@ -199,7 +204,7 @@ RAGFlow(user)> list models from 'minimax'; ### 6.12. List instances of a provider ``` -RAGFlow(user)> list instances from 'zhipu-ai'; +RAGFlow(api/default)> list instances from 'zhipu-ai'; +---------+----------------------+----------------------------------+--------------+----------------------------------+--------+ | apiKey | extra | id | instanceName | providerID | status | +---------+----------------------+----------------------------------+--------------+----------------------------------+--------+ @@ -209,7 +214,7 @@ RAGFlow(user)> list instances from 'zhipu-ai'; ### 6.13. Show instance of a provider ``` -RAGFlow(user)> show instance 'test' from 'zhipu-ai'; +RAGFlow(api/default)> show instance 'test' from 'zhipu-ai'; +----------------------------------+--------------+----------------------------------+---------+--------+ | id | instanceName | providerID | region | status | +----------------------------------+--------------+----------------------------------+---------+--------+ @@ -220,7 +225,7 @@ RAGFlow(user)> show instance 'test' from 'zhipu-ai'; ### 6.14. List models of a specific instance ``` -RAGFlow(user)> list models from 'minimax' 'test'; +RAGFlow(api/default)> list models from 'minimax' 'test'; +------------+-------------+------------------------+--------+ | max_tokens | model_types | name | status | +------------+-------------+------------------------+--------+ @@ -237,7 +242,7 @@ RAGFlow(user)> list models from 'minimax' 'test'; ### 6.15. List added providers ``` -RAGFlow(user)> list providers; +RAGFlow(api/default)> list providers; +--------------------------------------------------------------------------+-------------+--------------+ | base_url | name | total_models | +--------------------------------------------------------------------------+-------------+--------------+ @@ -250,45 +255,45 @@ RAGFlow(user)> list providers; ### 6.16. Deactivate / activate a model ``` -RAGFlow(user)> disable model 'deepseek-v4-pro' from 'deepseek' 'test'; +RAGFlow(api/default)> disable model 'deepseek-v4-pro' from 'deepseek' 'test'; SUCCESS -RAGFlow(user)> list models from 'deepseek' 'test'; +RAGFlow(api/default)> 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'; +RAGFlow(api/default)> enable model 'deepseek-v4-pro' from 'deepseek' 'test'; SUCCESS ``` ### 6.17. Set current model ``` -RAGFlow(user)> use model 'glm-4.5-flash@test@zhipu-ai'; +RAGFlow(api/default)> use model 'glm-4.5-flash@test@zhipu-ai'; SUCCESS -RAGFlow(user)> chat message '20 words introduce LLM'; +RAGFlow(api/default)> 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 ``` ### 6.18. Set, reset, and list default models ``` -RAGFlow(user)> set default chat model 'zhipu-ai/test/glm-4.5-flash'; +RAGFlow(api/default)> set default chat model 'zhipu-ai/test/glm-4.5-flash'; SUCCESS -RAGFlow(user)> set default vision model 'zhipu-ai/test/glm-4.5v'; +RAGFlow(api/default)> set default vision model 'zhipu-ai/test/glm-4.5v'; SUCCESS -RAGFlow(user)> set default embedding model 'zhipu-ai/test/embedding-2'; +RAGFlow(api/default)> set default embedding model 'zhipu-ai/test/embedding-2'; SUCCESS -RAGFlow(user)> set default rerank model 'zhipu-ai/test/rerank'; +RAGFlow(api/default)> set default rerank model 'zhipu-ai/test/rerank'; SUCCESS -RAGFlow(user)> set default ocr model 'zhipu-ai/test/glm-ocr'; +RAGFlow(api/default)> set default ocr model 'zhipu-ai/test/glm-ocr'; SUCCESS -RAGFlow(user)> set default tts model 'zhipu-ai/test/glm-tts'; +RAGFlow(api/default)> set default tts model 'zhipu-ai/test/glm-tts'; SUCCESS -RAGFlow(user)> set default asr model 'zhipu-ai/test/glm-asr-2512'; +RAGFlow(api/default)> set default asr model 'zhipu-ai/test/glm-asr-2512'; SUCCESS -RAGFlow(user)> list default models; +RAGFlow(api/default)> list default models; +--------+----------------+---------------+----------------+------------+ | enable | model_instance | model_name | model_provider | model_type | +--------+----------------+---------------+----------------+------------+ @@ -300,11 +305,11 @@ RAGFlow(user)> list default models; | true | test | glm-ocr | zhipu-ai | ocr | | true | test | glm-tts | zhipu-ai | tts | +--------+----------------+---------------+----------------+------------+ -RAGFlow(user)> reset default embedding model; +RAGFlow(api/default)> reset default embedding model; SUCCESS -RAGFlow(user)> reset default chat model +RAGFlow(api/default)> reset default chat model SUCCESS -RAGFlow(user)> list default models; +RAGFlow(api/default)> list default models; +--------+----------------+--------------+----------------+------------+ | enable | model_instance | model_name | model_provider | model_type | +--------+----------------+--------------+----------------+------------+ @@ -318,7 +323,7 @@ RAGFlow(user)> list default models; ### 6.19. Show current balance of a provider instance ``` -RAGFlow(user)> show balance from 'gitee' 'test'; +RAGFlow(api/default)> show balance from 'gitee' 'test'; +-------------+----------+ | balance | currency | +-------------+----------+ @@ -328,27 +333,27 @@ RAGFlow(user)> show balance from 'gitee' 'test'; ### 6.20. Check provider instance availability ``` -RAGFlow(user)> check instance 'test' from 'zhipu-ai'; +RAGFlow(api/default)> check instance 'test' from 'zhipu-ai'; SUCCESS ``` ### 6.21. Add local model to RAGFlow, only for local deployed inference server, such as ollama ``` -RAGFlow(user)> add model 'Qwen/Qwen2.5-0.5B' to provider 'vllm' instance 'test' with tokens 131072 chat; +RAGFlow(api/default)> add model 'Qwen/Qwen2.5-0.5B' to provider 'vllm' instance 'test' with tokens 131072 chat; SUCCESS -RAGFlow(user)> list models from 'vllm' 'test'; +RAGFlow(api/default)> 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'; +RAGFlow(api/default)> drop model 'Qwen/Qwen2.5-0.5B' from 'vllm' 'test'; SUCCESS ``` ### 6.22. List datasets ``` -RAGFlow(user)> list datasets; +RAGFlow(api/default)> list datasets; +-------------+--------------+----------------+----------------------+----------------------------------+----------+------+----------+------------+----------------------------------+-----------+---------------+ | chunk_count | chunk_method | document_count | embedding_model | id | language | name | nickname | permission | tenant_id | token_num | update_time | +-------------+--------------+----------------+----------------------+----------------------------------+----------+------+----------+------------+----------------------------------+-----------+---------------+ @@ -359,14 +364,14 @@ RAGFlow(user)> list datasets; ### 6.23 Text to Speech ``` -RAGFlow(user)> tts with 'speech-2.8-hd@test@minimax' text 'He who desires but acts not, breeds pestilence.' play format 'wav' save './internal' param '{"voice_setting": {"voice_id": "English_radiant_girl", "speed": 1, "vol": 1, "pitch": 0}, "audio_setting": {"sample_rate": 32000, "bitrate": 128000, "format": "wav", "channel": 1}, "output_format": "hex"}' +RAGFlow(api/default)> tts with 'speech-2.8-hd@test@minimax' text 'He who desires but acts not, breeds pestilence.' play format 'wav' save './internal' param '{"voice_setting": {"voice_id": "English_radiant_girl", "speed": 1, "vol": 1, "pitch": 0}, "audio_setting": {"sample_rate": 32000, "bitrate": 128000, "format": "wav", "channel": 1}, "output_format": "hex"}' Saved to directory: /home/infiniflow/Documents/development/ragflow/internal/speech-2.8-hd_output.wav SUCCESS ``` ### 6.24 Audio to Speech ``` -RAGFlow(user)> asr with 'FunAudioLLM/SenseVoiceSmall@test@siliconflow' audio './internal/test.wav' param '' +RAGFlow(api/default)> asr with 'FunAudioLLM/SenseVoiceSmall@test@siliconflow' audio './internal/test.wav' param '' +----------------------------------------------------------------------------------------------------------------------+ | text | +----------------------------------------------------------------------------------------------------------------------+ @@ -376,7 +381,7 @@ RAGFlow(user)> asr with 'FunAudioLLM/SenseVoiceSmall@test@siliconflow' audio './ ### 6.25 Optical Character Recognition\ ``` -RAGFlow(user)> ocr with 'paddleocr-vl-0.9b@test@baidu' file './internal/text.jpg' +RAGFlow(api/default)> ocr with 'paddleocr-vl-0.9b@test@baidu' file './internal/text.jpg' +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | text | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -388,63 +393,63 @@ RAGFlow(user)> ocr with 'paddleocr-vl-0.9b@test@baidu' file './internal/text.jpg - Create a chunk store with vector size ``` -RAGFlow(user)> CREATE CHUNK STORE FOR DATASET 'test' VECTOR SIZE 384 +RAGFlow(api/default)> CREATE CHUNK STORE FOR DATASET 'test' VECTOR SIZE 384 ``` - Insert data from JSON files ``` -RAGFlow(user)> INSERT CHUNKS FROM FILE 'insert_kb.json' +RAGFlow(api/default)> INSERT CHUNKS FROM FILE 'insert_kb.json' ``` - Update a chunk's content ``` -RAGFlow(user)> UPDATE CHUNK 'deb165dc6a732a64' OF DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' SET '{"content": "Updated chunk content here", "important_keywords": ["keyword1", "keyword2"], "questions": ["What is this about?", "Why is it important?"], "available": true, "tag_kwd": ["tag5", "tag2"]}' +RAGFlow(api/default)> UPDATE CHUNK 'deb165dc6a732a64' OF DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' SET '{"content": "Updated chunk content here", "important_keywords": ["keyword1", "keyword2"], "questions": ["What is this about?", "Why is it important?"], "available": true, "tag_kwd": ["tag5", "tag2"]}' ``` - Remove tags from a dataset ``` -RAGFlow(user)> REMOVE TAGS 'tag1', 'tag2' FROM DATASET 'test' +RAGFlow(api/default)> REMOVE TAGS 'tag1', 'tag2' FROM DATASET 'test' ``` - Remove specific chunks from a document ``` -RAGFlow(user)> REMOVE CHUNKS '29cc4f6d7a5c6e7c' '0360e3d8519eab12' FROM DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' +RAGFlow(api/default)> REMOVE CHUNKS '29cc4f6d7a5c6e7c' '0360e3d8519eab12' FROM DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' ``` - Remove all chunks from a document ``` -RAGFlow(user)> REMOVE ALL CHUNKS FROM DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' +RAGFlow(api/default)> REMOVE ALL CHUNKS FROM DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' ``` - Drop chunk store ``` -RAGFlow(user)> DROP CHUNK STORE FOR DATASET 'test' +RAGFlow(api/default)> DROP CHUNK STORE FOR DATASET 'test' ``` - Search chunks ``` -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' ``` - Get chunks ``` -RAGFlow(user)> GET CHUNK '29cc4f6d7a5c6e7c' OF DATASET 'test' DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' +RAGFlow(api/default)> GET CHUNK '29cc4f6d7a5c6e7c' OF DATASET 'test' DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' IN DATASET 'test' ``` ### 6.27 Metadata Management Commands - Create metadata store ``` -RAGFlow(user)> CREATE METADATA STORE +RAGFlow(api/default)> CREATE METADATA STORE ``` - Insert metadata from JSON files ``` -RAGFlow(user)> INSERT METADATA FROM FILE 'insert_metadata.json' +RAGFlow(api/default)> INSERT METADATA FROM FILE 'insert_metadata.json' ``` - Set metadata for a document ``` -RAGFlow(user)> SET METADATA OF DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' TO '{"author": ["John", "Tom"], "category": "tech"}'; +RAGFlow(api/default)> SET METADATA OF DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' TO '{"author": ["John", "Tom"], "category": "tech"}'; ``` - Delete metadata of a document @@ -459,45 +464,45 @@ DELETE METADATA OF DOCUMENT 'bbe55942535e11f1bc5184ba59049aa3' KEYS '["key1", "k - Drop metadata store ``` -RAGFlow(user)> DROP METADATA STORE +RAGFlow(api/default)> DROP METADATA STORE ``` - Get metadata ``` -RAGFlow(user)> GET METADATA OF DATASET 'test' 'test2' +RAGFlow(api/default)> GET METADATA OF DATASET 'test' 'test2' ``` ### 6.28 Search datasets - Search datasets ``` -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test'; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test'; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test1' 'test2'; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test1' 'test2'; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH top_k 1; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH top_k 1; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH page 2 page_size 20; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH page 2 page_size 20; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH similarity_threshold 0.5; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH similarity_threshold 0.5; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH vector_similarity_weight 0.0; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH vector_similarity_weight 0.0; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH keyword true; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH keyword true; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH use_kg true; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH use_kg true; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH rerank_id 'BAAI/bge-reranker-v2-m3@CI@SILICONFLOW'; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH rerank_id 'BAAI/bge-reranker-v2-m3@CI@SILICONFLOW'; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH search_id 'abc123'; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH search_id 'abc123'; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH cross_languages ['Chinese']; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH cross_languages ['Chinese']; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH doc_ids ['doc_a', 'doc_b']; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH doc_ids ['doc_a', 'doc_b']; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH meta_data_filter '{"method":"auto"}'; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH meta_data_filter '{"method":"auto"}'; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH meta_data_filter '{"method":"manual","conditions":[{"key":"author","op":"eq","value":"Luo"}]}'; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH meta_data_filter '{"method":"manual","conditions":[{"key":"author","op":"eq","value":"Luo"}]}'; -RAGFlow(user)> SEARCH 'AI' ON DATASETS 'test' WITH top_k 50 similarity_threshold 0.5 vector_similarity_weight 0.5 use_kg true; +RAGFlow(api/default)> SEARCH 'AI' ON DATASETS 'test' WITH top_k 50 similarity_threshold 0.5 vector_similarity_weight 0.5 use_kg true; ``` \ No newline at end of file diff --git a/internal/entity/models/model.go b/internal/entity/models/model.go index 091bdd8f8a..441f26a348 100644 --- a/internal/entity/models/model.go +++ b/internal/entity/models/model.go @@ -312,15 +312,24 @@ func InitProviderManager(dirPath string) error { alias2ModelIndex := make(map[string]int) for idx, model := range allModels.Models { - if model.Alias == nil { - alias2ModelIndex[strings.ToLower(model.Name)] = idx - } else { - for _, alias := range model.Alias { - lowerAlias := strings.ToLower(alias) - if existingIdx, ok := alias2ModelIndex[lowerAlias]; ok && existingIdx != idx { - return fmt.Errorf("duplicate alias %q for models %q and %q", alias, allModels.Models[existingIdx].Name, model.Name) - } - alias2ModelIndex[lowerAlias] = idx + addModelAlias := func(alias string) error { + alias = strings.TrimSpace(alias) + if alias == "" { + return nil + } + lowerAlias := strings.ToLower(alias) + if existingIdx, ok := alias2ModelIndex[lowerAlias]; ok && existingIdx != idx { + return fmt.Errorf("duplicate alias %q for models %q and %q", alias, allModels.Models[existingIdx].Name, model.Name) + } + alias2ModelIndex[lowerAlias] = idx + return nil + } + if err = addModelAlias(model.Name); err != nil { + return err + } + for _, alias := range model.Alias { + if err = addModelAlias(alias); err != nil { + return err } } } @@ -440,15 +449,11 @@ func (pm *ProviderManager) ListModels(providerName string) ([]map[string]interfa modelList := []map[string]interface{}{} for _, model := range provider.Models { modelData := map[string]interface{}{ - "name": model.Name, - "max_tokens": model.MaxTokens, - "model_types": model.ModelTypes, - } - if model.MaxDimension != nil { - modelData["max_dimension"] = *model.MaxDimension - } - if len(model.Dimensions) > 0 { - modelData["dimensions"] = model.Dimensions + "name": model.Name, + "max_tokens": model.MaxTokens, + "model_types": model.ModelTypes, + "max_dimension": model.MaxDimension, + "dimensions": model.Dimensions, } modelList = append(modelList, modelData) }