RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix typo (#9766)
Jin Hai5abd0bbac1bc
diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.pyindex 14ea257717..e790b4e2de 100644--- a/api/apps/chunk_app.py+++ b/api/apps/chunk_app.py@@ -93,6 +93,7 @@ def list_chunk():def get():chunk_id = request.args["chunk_id"]try:+ chunk = Nonetenants = UserTenantService.query(user_id=current_user.id)if not tenants:return get_data_error_result(message="Tenant not found!")diff --git a/api/apps/dialog_app.py b/api/apps/dialog_app.pyindex 1340f60d37..e7f1e068a8 100644--- a/api/apps/dialog_app.py+++ b/api/apps/dialog_app.py@@ -66,7 +66,7 @@ def set_dialog():if not is_create:if not req.get("kb_ids", []) and not prompt_config.get("tavily_api_key") and "{knowledge}" in prompt_config['system']:- return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no knowledge base/Tavily used here.")+ return get_data_error_result(message="Please remove `{knowledge}` in system prompt since no knowledge base / Tavily used here.")for p in prompt_config["parameters"]:if p["optional"]:diff --git a/api/apps/llm_app.py b/api/apps/llm_app.pyindex a876cd712b..1ef1c3e71e 100644--- a/api/apps/llm_app.py+++ b/api/apps/llm_app.py@@ -243,7 +243,7 @@ def add_llm():model_name=mdl_nm,base_url=llm["api_base"])- arr, tc = mdl.similarity("Hello~ Ragflower!", ["Hi, there!", "Ohh, my friend!"])+ arr, tc = mdl.similarity("Hello~ RAGFlower!", ["Hi, there!", "Ohh, my friend!"])if len(arr) == 0:raise Exception("Not known.")except KeyError:@@ -271,7 +271,7 @@ def add_llm():key=llm["api_key"], model_name=mdl_nm, base_url=llm["api_base"])try:- for resp in mdl.tts("Hello~ Ragflower!"):+ for resp in mdl.tts("Hello~ RAGFlower!"):passexcept RuntimeError as e:msg += f"\nFail to access model({factory}/{mdl_nm})." + str(e)diff --git a/api/apps/mcp_server_app.py b/api/apps/mcp_server_app.pyindex ef1fba79c4..f9922827bd 100644--- a/api/apps/mcp_server_app.py+++ b/api/apps/mcp_server_app.py@@ -82,7 +82,7 @@ def create() -> Response:server_name = req.get("name", "")if not server_name or len(server_name.encode("utf-8")) > 255:- return get_data_error_result(message=f"Invaild MCP name or length is {len(server_name)} which is large than 255.")+ return get_data_error_result(message=f"Invalid MCP name or length is {len(server_name)} which is large than 255.")e, _ = MCPServerService.get_by_name_and_tenant(name=server_name, tenant_id=current_user.id)if e:@@ -90,7 +90,7 @@ def create() -> Response:url = req.get("url", "")if not url:- return get_data_error_result(message="Invaild url.")+ return get_data_error_result(message="Invalid url.")headers = safe_json_parse(req.get("headers", {}))req["headers"] = headers@@ -141,10 +141,10 @@ def update() -> Response:return get_data_error_result(message="Unsupported MCP server type.")server_name = req.get("name", mcp_server.name)if server_name and len(server_name.encode("utf-8")) > 255:- return get_data_error_result(message=f"Invaild MCP name or length is {len(server_name)} which is large than 255.")+ return get_data_error_result(message=f"Invalid MCP name or length is {len(server_name)} which is large than 255.")url = req.get("url", mcp_server.url)if not url:- return get_data_error_result(message="Invaild url.")+ return get_data_error_result(message="Invalid url.")headers = safe_json_parse(req.get("headers", mcp_server.headers))req["headers"] = headers@@ -218,7 +218,7 @@ def import_multiple() -> Response:continueif not server_name or len(server_name.encode("utf-8")) > 255:- results.append({"server": server_name, "success": False, "message": f"Invaild MCP name or length is {len(server_name)} which is large than 255."})+ results.append({"server": server_name, "success": False, "message": f"Invalid MCP name or length is {len(server_name)} which is large than 255."})continuebase_name = server_name@@ -409,7 +409,7 @@ def test_mcp() -> Response:url = req.get("url", "")if not url:- return get_data_error_result(message="Invaild MCP url.")+ return get_data_error_result(message="Invalid MCP url.")server_type = req.get("server_type", "")if server_type not in VALID_MCP_SERVER_TYPES:diff --git a/api/apps/search_app.py b/api/apps/search_app.pyindex 0df7743f61..e0002f8161 100644--- a/api/apps/search_app.py+++ b/api/apps/search_app.py@@ -43,7 +43,7 @@ def create():return get_data_error_result(message=f"Search name length is {len(search_name)} which is large than 255.")e, _ = TenantService.get_by_id(current_user.id)if not e:- return get_data_error_result(message="Authorizationd identity.")+ return get_data_error_result(message="Authorized identity.")search_name = search_name.strip()search_name = duplicate_name(SearchService.query, name=search_name, tenant_id=current_user.id, status=StatusEnum.VALID.value)@@ -78,7 +78,7 @@ def update():tenant_id = req["tenant_id"]e, _ = TenantService.get_by_id(tenant_id)if not e:- return get_data_error_result(message="Authorizationd identity.")+ return get_data_error_result(message="Authorized identity.")search_id = req["search_id"]if not SearchService.accessible4deletion(search_id, current_user.id):diff --git a/deepdoc/vision/seeit.py b/deepdoc/vision/seeit.pyindex e820e89a51..e90c09ed80 100644--- a/deepdoc/vision/seeit.py+++ b/deepdoc/vision/seeit.py@@ -31,11 +31,11 @@ def save_results(image_list, results, labels, output_dir='output/', threshold=0.logging.debug("save result to: " + out_path)-def draw_box(im, result, lables, threshold=0.5):+def draw_box(im, result, labels, threshold=0.5):draw_thickness = min(im.size) // 320draw = ImageDraw.Draw(im)- color_list = get_color_map_list(len(lables))- clsid2color = {n.lower():color_list[i] for i,n in enumerate(lables)}+ color_list = get_color_map_list(len(labels))+ clsid2color = {n.lower():color_list[i] for i,n in enumerate(labels)}result = [r for r in result if r["score"] >= threshold]for dt in result:diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.pyindex e766241134..18a0cabda1 100644--- a/rag/nlp/__init__.py+++ b/rag/nlp/__init__.py@@ -554,8 +554,8 @@ def naive_merge(sections, chunk_token_num=128, delimiter="\n。;!?", overlif num_tokens_from_string(sec) < chunk_token_num:add_chunk(sec, pos)continue- splited_sec = re.split(r"(%s)" % dels, sec, flags=re.DOTALL)- for sub_sec in splited_sec:+ split_sec = re.split(r"(%s)" % dels, sec, flags=re.DOTALL)+ for sub_sec in split_sec:if re.match(f"^{dels}$", sub_sec):continueadd_chunk(sub_sec, pos)@@ -600,14 +600,14 @@ def naive_merge_with_images(texts, images, chunk_token_num=128, delimiter="\n。if isinstance(text, tuple):text_str = text[0]text_pos = text[1] if len(text) > 1 else ""- splited_sec = re.split(r"(%s)" % dels, text_str)- for sub_sec in splited_sec:+ split_sec = re.split(r"(%s)" % dels, text_str)+ for sub_sec in split_sec:if re.match(f"^{dels}$", sub_sec):continueadd_chunk(sub_sec, image, text_pos)else:- splited_sec = re.split(r"(%s)" % dels, text)- for sub_sec in splited_sec:+ split_sec = re.split(r"(%s)" % dels, text)+ for sub_sec in split_sec:if re.match(f"^{dels}$", sub_sec):continueadd_chunk(sub_sec, image)@@ -684,8 +684,8 @@ def naive_merge_docx(sections, chunk_token_num=128, delimiter="\n。;!?"):dels = get_delimiters(delimiter)for sec, image in sections:- splited_sec = re.split(r"(%s)" % dels, sec)- for sub_sec in splited_sec:+ split_sec = re.split(r"(%s)" % dels, sec)+ for sub_sec in split_sec:if re.match(f"^{dels}$", sub_sec):continueadd_chunk(sub_sec, image,"")diff --git a/rag/utils/mcp_tool_call_conn.py b/rag/utils/mcp_tool_call_conn.pyindex 80b5973740..36ea642741 100644--- a/rag/utils/mcp_tool_call_conn.py+++ b/rag/utils/mcp_tool_call_conn.py@@ -148,7 +148,7 @@ class MCPToolCallSession(ToolCallSession):if result.isError:return f"MCP server error: {result.content}"- # For now we only support text content+ # For now, we only support text contentif isinstance(result.content[0], TextContent):return result.content[0].textelse:diff --git a/rag/utils/redis_conn.py b/rag/utils/redis_conn.pyindex 5571d8b2f6..3d0d10b175 100644--- a/rag/utils/redis_conn.py+++ b/rag/utils/redis_conn.py@@ -336,7 +336,7 @@ class RedisDB:def delete_if_equal(self, key: str, expected_value: str) -> bool:"""- Do follwing atomically:+ Do following atomically:Delete a key if its value is equals to the given one, do nothing otherwise."""return bool(self.lua_delete_if_equal(keys=[key], args=[expected_value], client=self.REDIS))