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: remove unused imports and f-string formatting (#12935)
Liu An1b587013d86a
diff --git a/api/db/db_models.py b/api/db/db_models.pyindex 95ad570c58..84b3b110aa 100644--- a/api/db/db_models.py+++ b/api/db/db_models.py@@ -50,7 +50,6 @@ class TextFieldType(Enum):MYSQL = "LONGTEXT"OCEANBASE = "LONGTEXT"POSTGRES = "TEXT"- POSTGRES = "TEXT"class LongTextField(TextField):diff --git a/tests/unit/test_oceanbase_peewee.py b/tests/unit/test_oceanbase_peewee.pyindex 9156e8dc5c..7ff0ef2d25 100644--- a/tests/unit/test_oceanbase_peewee.py+++ b/tests/unit/test_oceanbase_peewee.py@@ -3,7 +3,6 @@ Tests for OceanBase Peewee ORM support."""import pytest-from unittest.mock import Mock, patch, MagicMockfrom api.db.db_models import (RetryingPooledOceanBaseDatabase,PooledDatabase,diff --git a/tools/es-to-oceanbase-migration/src/es_ob_migration/cli.py b/tools/es-to-oceanbase-migration/src/es_ob_migration/cli.pyindex bc703266f1..bb3ec2477f 100644--- a/tools/es-to-oceanbase-migration/src/es_ob_migration/cli.py+++ b/tools/es-to-oceanbase-migration/src/es_ob_migration/cli.py@@ -15,7 +15,6 @@ from .es_client import ESClientfrom .ob_client import OBClientfrom .migrator import ESToOceanBaseMigratorfrom .verify import MigrationVerifier-from .schema import RAGFLOW_COLUMNSconsole = Console()@@ -115,7 +114,7 @@ def migrate(indices_to_migrate = [(index, table if table else index)]else:# Auto-discover all ragflow_* indices- console.print(f"\n[cyan]Discovering RAGFlow indices...[/]")+ console.print("\n[cyan]Discovering RAGFlow indices...[/]")ragflow_indices = es_client.list_ragflow_indices()if not ragflow_indices:@@ -166,7 +165,7 @@ def migrate(# Summary for multiple indicesif len(indices_to_migrate) > 1:console.print(f"\n[bold]{'='*60}[/]")- console.print(f"[bold]Migration Summary[/]")+ console.print("[bold]Migration Summary[/]")console.print(f"[bold]{'='*60}[/]")console.print(f" Total indices: {len(indices_to_migrate)}")console.print(f" [green]Successful: {total_success}[/]")@@ -232,13 +231,13 @@ def schema(ctx, es_host, es_port, es_user, es_password, index, output):# Vector fieldsif analysis['vector_fields']:- console.print(f"\n[cyan]Vector fields detected:[/]")+ console.print("\n[cyan]Vector fields detected:[/]")for vf in analysis['vector_fields']:console.print(f" - {vf['name']} (dimension: {vf['dimension']})")# Unknown fieldsif analysis['unknown_fields']:- console.print(f"\n[yellow]Unknown fields (will be stored in 'extra'):[/]")+ console.print("\n[yellow]Unknown fields (will be stored in 'extra'):[/]")for uf in analysis['unknown_fields']:console.print(f" - {uf}")diff --git a/tools/es-to-oceanbase-migration/src/es_ob_migration/migrator.py b/tools/es-to-oceanbase-migration/src/es_ob_migration/migrator.pyindex ef59e34d19..ba194dcd10 100644--- a/tools/es-to-oceanbase-migration/src/es_ob_migration/migrator.py+++ b/tools/es-to-oceanbase-migration/src/es_ob_migration/migrator.py@@ -18,7 +18,7 @@ from rich.progress import (from .es_client import ESClientfrom .ob_client import OBClient-from .schema import RAGFlowSchemaConverter, RAGFlowDataConverter, VECTOR_FIELD_PATTERN+from .schema import RAGFlowSchemaConverter, RAGFlowDataConverterfrom .progress import ProgressManager, MigrationProgressfrom .verify import MigrationVerifierdiff --git a/tools/es-to-oceanbase-migration/src/es_ob_migration/ob_client.py b/tools/es-to-oceanbase-migration/src/es_ob_migration/ob_client.pyindex 4d5a7b234a..50a6d92de9 100644--- a/tools/es-to-oceanbase-migration/src/es_ob_migration/ob_client.py+++ b/tools/es-to-oceanbase-migration/src/es_ob_migration/ob_client.py@@ -4,15 +4,14 @@ OceanBase Client for RAGFlow data migration.This client is specifically designed for RAGFlow's data structure."""-import jsonimport loggingfrom typing import Anyfrom pyobvector import ObVecClient, FtsIndexParam, FtsParser, VECTOR, ARRAY-from sqlalchemy import Column, String, Integer, Float, JSON, Text, text, Double+from sqlalchemy import Column, String, Integer, Float, JSON, Doublefrom sqlalchemy.dialects.mysql import LONGTEXT, TEXT as MYSQL_TEXT-from .schema import RAGFLOW_COLUMNS, ARRAY_COLUMNS, FTS_COLUMNS_TKS+from .schema import RAGFLOW_COLUMNS, FTS_COLUMNS_TKSlogger = logging.getLogger(__name__)diff --git a/tools/es-to-oceanbase-migration/src/es_ob_migration/progress.py b/tools/es-to-oceanbase-migration/src/es_ob_migration/progress.pyindex 738fb476ae..29c23bb4bc 100644--- a/tools/es-to-oceanbase-migration/src/es_ob_migration/progress.py+++ b/tools/es-to-oceanbase-migration/src/es_ob_migration/progress.py@@ -4,7 +4,6 @@ Progress tracking and resume capability for migration.import jsonimport logging-import osfrom dataclasses import dataclass, field, asdictfrom datetime import datetimefrom pathlib import Pathdiff --git a/tools/es-to-oceanbase-migration/src/es_ob_migration/verify.py b/tools/es-to-oceanbase-migration/src/es_ob_migration/verify.pyindex c02d2b5257..0df94bbc92 100644--- a/tools/es-to-oceanbase-migration/src/es_ob_migration/verify.py+++ b/tools/es-to-oceanbase-migration/src/es_ob_migration/verify.py@@ -9,7 +9,7 @@ from typing import Anyfrom .es_client import ESClientfrom .ob_client import OBClient-from .schema import RAGFLOW_COLUMNS, ARRAY_COLUMNS, JSON_COLUMNS+from .schema import ARRAY_COLUMNS, JSON_COLUMNSlogger = logging.getLogger(__name__)diff --git a/tools/es-to-oceanbase-migration/tests/test_progress.py b/tools/es-to-oceanbase-migration/tests/test_progress.pyindex 443c8db896..0e7368d548 100644--- a/tools/es-to-oceanbase-migration/tests/test_progress.py+++ b/tools/es-to-oceanbase-migration/tests/test_progress.py@@ -7,7 +7,6 @@ import osimport tempfileimport pytestfrom pathlib import Path-from datetime import datetimefrom es_ob_migration.progress import MigrationProgress, ProgressManager@@ -90,7 +89,7 @@ class TestProgressManager:def test_create_progress_manager_creates_dir(self, temp_dir):"""Test that progress manager creates directory."""new_dir = os.path.join(temp_dir, "new_progress")- manager = ProgressManager(progress_dir=new_dir)+ ProgressManager(progress_dir=new_dir)assert Path(new_dir).exists()def test_create_progress(self, manager):@@ -225,7 +224,7 @@ class TestProgressManager:def test_can_resume_running(self, manager):"""Test can_resume for running migration."""- progress = manager.create_progress(+ manager.create_progress(es_index="ragflow_resume_running",ob_table="ragflow_resume_running",total_documents=1000,@@ -291,7 +290,7 @@ class TestProgressManager:def test_progress_file_path(self, manager):"""Test progress file naming."""- progress = manager.create_progress(+ manager.create_progress(es_index="ragflow_abc123",ob_table="ragflow_abc123",total_documents=100,diff --git a/tools/es-to-oceanbase-migration/tests/test_schema.py b/tools/es-to-oceanbase-migration/tests/test_schema.pyindex 942de94497..cd55f98ceb 100644--- a/tools/es-to-oceanbase-migration/tests/test_schema.py+++ b/tools/es-to-oceanbase-migration/tests/test_schema.py@@ -9,7 +9,6 @@ This module tests:"""import json-import pytestfrom es_ob_migration.schema import (RAGFlowSchemaConverter,RAGFlowDataConverter,diff --git a/tools/es-to-oceanbase-migration/tests/test_verify.py b/tools/es-to-oceanbase-migration/tests/test_verify.pyindex 6a5f288e79..d0b9ee225e 100644--- a/tools/es-to-oceanbase-migration/tests/test_verify.py+++ b/tools/es-to-oceanbase-migration/tests/test_verify.py@@ -2,9 +2,8 @@Tests for migration verification."""-import jsonimport pytest-from unittest.mock import Mock, MagicMock+from unittest.mock import Mockfrom es_ob_migration.verify import MigrationVerifier, VerificationResult