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
Update version display on web UI (#3405)
Jin Haie4c4fdabbdae
diff --git a/api/apps/system_app.py b/api/apps/system_app.pyindex 33f89fc2fd..964aa00021 100644--- a/api/apps/system_app.py+++ b/api/apps/system_app.py@@ -30,7 +30,7 @@ from api.utils.api_utils import (server_error_response,generate_confirmation_token,)-from api.versions import get_rag_version+from api.versions import get_ragflow_versionfrom api.settings import docStoreConnfrom rag.utils.storage_factory import STORAGE_IMPL, STORAGE_IMPL_TYPEfrom timeit import default_timer as timer@@ -58,7 +58,7 @@ def version():type: stringdescription: Version number."""- return get_json_result(data=get_rag_version())+ return get_json_result(data=get_ragflow_version())@manager.route("/status", methods=["GET"])diff --git a/api/db/runtime_config.py b/api/db/runtime_config.pyindex 2ab484cb00..e3e0fb7874 100644--- a/api/db/runtime_config.py+++ b/api/db/runtime_config.py@@ -13,7 +13,7 @@# See the License for the specific language governing permissions and# limitations under the License.#-from api.versions import get_versions+from api.versions import get_ragflow_versionfrom .reload_config_base import ReloadConfigBase@@ -35,7 +35,7 @@ class RuntimeConfig(ReloadConfigBase):@classmethoddef init_env(cls):- cls.ENV.update(get_versions())+ cls.ENV.update({"version": get_ragflow_version()})@classmethoddef load_config_manager(cls):diff --git a/api/ragflow_server.py b/api/ragflow_server.pyindex 0049f01a5b..7be85c078e 100644--- a/api/ragflow_server.py+++ b/api/ragflow_server.py@@ -44,7 +44,7 @@ from api import utilsfrom api.db.db_models import init_database_tables as init_web_dbfrom api.db.init_data import init_web_data-from api.versions import get_versions, RAGFLOW_VERSION_INFO+from api.versions import get_ragflow_versiondef update_progress():@@ -66,7 +66,7 @@ if __name__ == '__main__':""")logging.info(- f'RAGFlow version: {RAGFLOW_VERSION_INFO}'+ f'RAGFlow version: {get_ragflow_version()}')logging.info(f'project base: {utils.file_utils.get_project_base_directory()}'@@ -87,7 +87,7 @@ if __name__ == '__main__':)args = parser.parse_args()if args.version:- print(get_versions())+ print(get_ragflow_version())sys.exit(0)RuntimeConfig.DEBUG = args.debug@@ -103,7 +103,7 @@ if __name__ == '__main__':# start http servertry:- logging.info("RAG Flow http server start...")+ logging.info("RAGFlow HTTP server start...")run_simple(hostname=HOST,port=HTTP_PORT,diff --git a/api/versions.py b/api/versions.pyindex 54d151b34f..13f120f507 100644--- a/api/versions.py+++ b/api/versions.py@@ -17,35 +17,33 @@ import dotenvimport typingimport subprocess--def get_versions() -> typing.Mapping[str, typing.Any]:- dotenv.load_dotenv(dotenv.find_dotenv())- return dotenv.dotenv_values()---def get_rag_version() -> typing.Optional[str]:- return get_versions().get("RAGFLOW_IMAGE", "infiniflow/ragflow:dev").split(":")[-1]+def get_ragflow_version() -> typing.Optional[str]:+ return RAGFLOW_VERSION_INFORAGFLOW_VERSION_INFO = "dev"def get_closest_tag_and_count():- # Get the current commit hash- commit_id = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode('utf-8')- # Get the closest tag- closest_tag = subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).strip().decode('utf-8')- # Get the commit hash of the closest tag- closest_tag_commit = subprocess.check_output(['git', 'rev-list', '-n', '1', closest_tag]).strip().decode('utf-8')- # Get the commit count since the closest tag- process = subprocess.Popen(['git', 'rev-list', '--count', f'{closest_tag}..HEAD'], stdout=subprocess.PIPE)- commits_count, _ = process.communicate()- commits_count = int(commits_count.strip())-- if commits_count == 0:- return closest_tag- else:- return f"{commit_id}({closest_tag}~{commits_count})"+ try:+ # Get the current commit hash+ commit_id = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode('utf-8')+ # Get the closest tag+ closest_tag = subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).strip().decode('utf-8')+ # Get the commit hash of the closest tag+ closest_tag_commit = subprocess.check_output(['git', 'rev-list', '-n', '1', closest_tag]).strip().decode(+ 'utf-8')+ # Get the commit count since the closest tag+ process = subprocess.Popen(['git', 'rev-list', '--count', f'{closest_tag}..HEAD'], stdout=subprocess.PIPE)+ commits_count, _ = process.communicate()+ commits_count = int(commits_count.strip())++ if commits_count == 0:+ return closest_tag+ else:+ return f"{commit_id}({closest_tag}~{commits_count})"+ except Exception as e:+ return 'unknown'if RAGFLOW_VERSION_INFO == 'dev':