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
Refactor:Improve the logic so that it does not decode base 64 for the test image each time (#9264)
Stephen Hu1409bb30dfd0
diff --git a/api/apps/llm_app.py b/api/apps/llm_app.pyindex 8214bead01..9f44fe2903 100644--- a/api/apps/llm_app.py+++ b/api/apps/llm_app.py@@ -15,7 +15,6 @@#import loggingimport json-import base64from flask import requestfrom flask_login import login_required, current_userfrom api.db.services.llm_service import LLMFactoriesService, TenantLLMService, LLMService@@ -24,7 +23,7 @@ from api.utils.api_utils import server_error_response, get_data_error_result, vafrom api.db import StatusEnum, LLMTypefrom api.db.db_models import TenantLLMfrom api.utils.api_utils import get_json_result-from api.utils.base64_image import test_image_base64+from api.utils.base64_image import test_imagefrom rag.llm import EmbeddingModel, ChatModel, RerankModel, CvModel, TTSModel@@ -256,7 +255,7 @@ def add_llm():base_url=llm["api_base"])try:- image_data = base64.b64decode(test_image_base64)+ image_data = test_imagem, tc = mdl.describe(image_data)if not m and not tc:raise Exception(m)diff --git a/api/utils/base64_image.py b/api/utils/base64_image.pyindex b602b80871..d9dd4cde9c 100644--- a/api/utils/base64_image.py+++ b/api/utils/base64_image.py@@ -1 +1,3 @@+import base64test_image_base64 = "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAA6ElEQVR4nO3QwQ3AIBDAsIP9d25XIC+EZE8QZc18w5l9O+AlZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBWYFZgVmBT+IYAHHLHkdEgAAAABJRU5ErkJggg=="+test_image = base64.b64decode(test_image_base64)\ No newline at end of file